@@ -361,7 +361,7 @@ function Header(props) { | |||||
alignItems="center" | alignItems="center" | ||||
spacing={0} | spacing={0} | ||||
> | > | ||||
<Box sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}> | |||||
<Box mt={0.5} sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}> | |||||
<AdminLogo /> | <AdminLogo /> | ||||
</Box> | </Box> | ||||
<IconButton | <IconButton | ||||
@@ -15,27 +15,24 @@ export default function EmailTemplateTable({ recordList }) { | |||||
// const navigate = useNavigate() | // const navigate = useNavigate() | ||||
useEffect(() => { | useEffect(() => { | ||||
console.log(recordList) | |||||
setRows(recordList); | setRows(recordList); | ||||
}, [recordList]); | }, [recordList]); | ||||
// const handleEditClick = (id) => () => { | |||||
// navigate('/emailTemplate/' + id); | |||||
// }; | |||||
const columns = [ | const columns = [ | ||||
{ | { | ||||
id: 'holiday_DAY', | |||||
field: 'holiday_DAY', | |||||
id: 'HOLIDAY_DAY', | |||||
field: 'HOLIDAY_DAY', | |||||
headerName: 'Date', | headerName: 'Date', | ||||
flex: 4, | flex: 4, | ||||
renderCell: (params) => { | renderCell: (params) => { | ||||
let holiday_DAY = params.row.holiday_DAY; | |||||
return <div style={{ margin: 4 }}>{dateStr(holiday_DAY)}</div> | |||||
let HOLIDAY_DAY = params.row.HOLIDAY_DAY; | |||||
return <div style={{ margin: 4 }}>{dateStr(HOLIDAY_DAY)}</div> | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
id: 'description', | |||||
field: 'description', | |||||
id: 'DESCRIPTION', | |||||
field: 'DESCRIPTION', | |||||
headerName: 'Description', | headerName: 'Description', | ||||
flex: 5, | flex: 5, | ||||
}, | }, | ||||
@@ -3,7 +3,7 @@ import { | |||||
Button, | Button, | ||||
Grid, | Grid, | ||||
TextField, | TextField, | ||||
// Autocomplete, | |||||
Autocomplete, | |||||
Typography | Typography | ||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
@@ -16,25 +16,38 @@ import {ThemeProvider} from "@emotion/react"; | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
const SearchPublicNoticeForm = ({ applySearch, comboData}) => { | |||||
const [selectedYear, setSelectedYear] = React.useState([]); | |||||
// const [defaultYear, setDefaultYear] = React.useState(searchCriteria.year); | |||||
const [comboList, setComboList] = React.useState([]); | |||||
// const [onReady, setOnReady] = React.useState(false); | |||||
// const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); | |||||
const [maxDate] = React.useState(searchCriteria.dateFrom); | |||||
// const [status, setStatus] = React.useState(ComboData.paymentStatus[0]); | |||||
const { | |||||
// register, | |||||
handleSubmit } = useForm() | |||||
const { register, handleSubmit } = useForm() | |||||
const onSubmit = (data) => { | |||||
const temp = { | |||||
// code: data.code, | |||||
// transNo: data.transNo, | |||||
dateFrom: data.dateFrom, | |||||
dateTo: data.dateTo, | |||||
// status : (status?.type && status?.type != 'all') ? status?.type : "", | |||||
}; | |||||
applySearch(temp); | |||||
const onSubmit = () => { | |||||
if (selectedYear !=null){ | |||||
const temp = { | |||||
year: selectedYear.label, | |||||
}; | |||||
applySearch(temp); | |||||
} | |||||
}; | }; | ||||
React.useEffect(() => { | |||||
if (comboData && comboData.length > 0) { | |||||
// console.log(comboData) | |||||
// const labelValue = comboData.find(obj => obj.label === searchCriteria.year); | |||||
// console.log(labelValue) | |||||
if(selectedYear.length == 0){ | |||||
setSelectedYear(comboData[0]) | |||||
} | |||||
setComboList(comboData) | |||||
// setSelectedYear(searchCriteria.dateFrom) | |||||
} | |||||
}, [comboData]); | |||||
return ( | return ( | ||||
<MainCard xs={12} md={12} lg={12} | <MainCard xs={12} md={12} lg={12} | ||||
@@ -45,29 +58,32 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
<form onSubmit={handleSubmit(onSubmit)} > | <form onSubmit={handleSubmit(onSubmit)} > | ||||
<Grid container sx={{ backgroundColor: '#ffffff', ml: 2, mt: 1}} width="98%"> | <Grid container sx={{ backgroundColor: '#ffffff', ml: 2, mt: 1}} width="98%"> | ||||
{/*row 1*/} | {/*row 1*/} | ||||
<Grid item justifyContent="space-between" alignItems="center" sx={{mt:1,ml:3,mb:2.5}}> | |||||
<Grid item justifyContent="space-between" alignItems="center" sx={{mt:1,ml:3,mb:1}}> | |||||
<Typography variant="h5" > | <Typography variant="h5" > | ||||
Date | |||||
Year | |||||
</Typography> | </Typography> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
<Grid container display="flex" alignItems={"center"}> | <Grid container display="flex" alignItems={"center"}> | ||||
<Grid item xs={9} s={6} md={4} lg={4} sx={{ ml: 3, mr: 3, mb: 3 }}> | <Grid item xs={9} s={6} md={4} lg={4} sx={{ ml: 3, mr: 3, mb: 3 }}> | ||||
<TextField | |||||
fullWidth | |||||
{...register("dateFrom")} | |||||
id="dateFrom" | |||||
type="date" | |||||
label="Credit Date" | |||||
defaultValue={searchCriteria.dateFrom} | |||||
InputProps={{ inputProps: { max: maxDate } }} | |||||
// onChange={(newValue) => { | |||||
// setMinDate(DateUtils.dateStr(newValue)); | |||||
// }} | |||||
InputLabelProps={{ | |||||
shrink: true | |||||
<Autocomplete | |||||
disablePortal | |||||
id="year-combo" | |||||
value={selectedYear} | |||||
// defaultValue={selectedYear} | |||||
options={comboList} | |||||
// disabled={checkCountry} | |||||
getOptionLabel={(option) => option.label ? option.label : ""} | |||||
onChange={(event, newValue) => { | |||||
setSelectedYear(newValue); | |||||
}} | |||||
sx={{ | |||||
"& .MuiInputBase-root": { height: "41px" }, | |||||
"#year-combo": { padding: "0px 0px 0px 0px" }, | |||||
"& .MuiAutocomplete-endAdornment": { top: "auto" }, | |||||
}} | }} | ||||
renderInput={(params) => <TextField {...params} placeholder={""}/>} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
@@ -38,10 +38,11 @@ import { notifySaveSuccess } from 'utils/CommonFunction'; | |||||
const Index = () => { | const Index = () => { | ||||
const [record, setRecord] = React.useState([]); | const [record, setRecord] = React.useState([]); | ||||
const [comboData, setComboData] = React.useState([]); | |||||
const [onReady, setOnReady] = React.useState(false); | const [onReady, setOnReady] = React.useState(false); | ||||
// const navigate = useNavigate() | // const navigate = useNavigate() | ||||
const [searchCriteria, setSearchCriteria] = React.useState({ | const [searchCriteria, setSearchCriteria] = React.useState({ | ||||
dateFrom: dateStr_Year(new Date()), | |||||
year: dateStr_Year(new Date()), | |||||
// dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)), | // dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)), | ||||
}); | }); | ||||
const [attachments, setAttachments] = React.useState([]); | const [attachments, setAttachments] = React.useState([]); | ||||
@@ -49,20 +50,41 @@ const Index = () => { | |||||
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); | ||||
const [warningText, setWarningText] = React.useState(""); | const [warningText, setWarningText] = React.useState(""); | ||||
React.useLayoutEffect(() => { | |||||
loadForm(); | |||||
}, []); | |||||
// React.useLayoutEffect(() => { | |||||
// loadForm(); | |||||
// }, []); | |||||
React.useLayoutEffect(() => { | React.useLayoutEffect(() => { | ||||
setOnReady(true); | |||||
}, [record]); | |||||
if (comboData && comboData.length > 0) { | |||||
setOnReady(true); | |||||
} | |||||
}, [comboData]); | |||||
const loadForm = () => { | |||||
React.useEffect(() => { | |||||
// console.log(searchCriteria) | |||||
loadForm(); | |||||
}, [searchCriteria]); | |||||
function loadForm() { | |||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: UrlUtils.GET_HOLIDAY, | url: UrlUtils.GET_HOLIDAY, | ||||
params: searchCriteria, | |||||
onSuccess: (responseData) => { | onSuccess: (responseData) => { | ||||
console.log(dateStr_Year(new Date())) | |||||
console.log(comboData) | |||||
setRecord(responseData); | setRecord(responseData); | ||||
if (comboData.length == 0) { | |||||
loadCombo(); | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
function loadCombo() { | |||||
HttpUtils.get({ | |||||
url: UrlUtils.GET_HOLIDAY_COMBO, | |||||
onSuccess: (responseData) => { | |||||
let combo = responseData; | |||||
setComboData(combo); | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
@@ -72,11 +94,9 @@ const Index = () => { | |||||
} | } | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
if (!attachments || attachments.length <= 0) { | |||||
setAttachments([]); | |||||
return; | |||||
if (attachments.length > 0) { | |||||
importHoliday(); | |||||
} | } | ||||
importHoliday(); | |||||
}, [attachments]); | }, [attachments]); | ||||
const readFile = (event) => { | const readFile = (event) => { | ||||
@@ -166,6 +186,7 @@ const Index = () => { | |||||
applySearch={applySearch} | applySearch={applySearch} | ||||
// generateXML={generateXML} | // generateXML={generateXML} | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
comboData={comboData} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
@@ -171,4 +171,5 @@ export const GEN_GFMIS_XML = apiPath+'/gfmis'; //GET | |||||
//Holiday | //Holiday | ||||
export const GET_HOLIDAY = apiPath+'/holiday/list'; //GET | export const GET_HOLIDAY = apiPath+'/holiday/list'; //GET | ||||
export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST | |||||
export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST | |||||
export const GET_HOLIDAY_COMBO = apiPath+'/holiday/combo'; //GET |