| @@ -7,6 +7,7 @@ import { | |||||
| } from "@mui/x-data-grid"; | } from "@mui/x-data-grid"; | ||||
| import RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline'; | import RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline'; | ||||
| import { useEffect } from "react"; | import { useEffect } from "react"; | ||||
| import { useIntl } from 'react-intl'; | |||||
| // 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 { | import { | ||||
| @@ -17,6 +18,8 @@ import { | |||||
| // ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
| export default function UploadFileTable({ recordList, setRecordList, showPageColumn, _checkCode, _expectedCode }) { | export default function UploadFileTable({ recordList, setRecordList, showPageColumn, _checkCode, _expectedCode }) { | ||||
| const intl = useIntl(); | |||||
| const deleteFileLabel = intl.formatMessage({ id: 'ariaDeleteFile' }); | |||||
| const [rows, setRows] = React.useState(recordList); | const [rows, setRows] = React.useState(recordList); | ||||
| const [rowModesModel, setRowModesModel] = React.useState({}); | const [rowModesModel, setRowModesModel] = React.useState({}); | ||||
| @@ -67,6 +70,25 @@ export default function UploadFileTable({ recordList, setRecordList, showPageCol | |||||
| setRows(rows.filter((row) => row.id !== id)); | setRows(rows.filter((row) => row.id !== id)); | ||||
| } | } | ||||
| const renderDeleteAction = (id) => ( | |||||
| <GridActionsCellItem | |||||
| key="delete" | |||||
| icon={<RemoveCircleOutlineIcon />} | |||||
| label={deleteFileLabel} | |||||
| title={deleteFileLabel} | |||||
| className="textPrimary" | |||||
| onClick={handleCancelClick(id)} | |||||
| onKeyDown={(event) => { | |||||
| if (event.key === 'Enter' || event.key === ' ') { | |||||
| event.preventDefault(); | |||||
| event.stopPropagation(); | |||||
| handleCancelClick(id)(event); | |||||
| } | |||||
| }} | |||||
| color="error" | |||||
| /> | |||||
| ); | |||||
| const handlePreviewClick = (param) => () => { | const handlePreviewClick = (param) => () => { | ||||
| var reader = new FileReader(); | var reader = new FileReader(); | ||||
| reader.onload = function () { | reader.onload = function () { | ||||
| @@ -94,17 +116,7 @@ export default function UploadFileTable({ recordList, setRecordList, showPageCol | |||||
| width: 30, | width: 30, | ||||
| cellClassName: 'actions', | cellClassName: 'actions', | ||||
| // hide:true, | // hide:true, | ||||
| getActions: ({ id }) => { | |||||
| return [ | |||||
| <GridActionsCellItem | |||||
| key="OutSave" | |||||
| icon={<RemoveCircleOutlineIcon />} | |||||
| label="delete" | |||||
| className="textPrimary" | |||||
| onClick={handleCancelClick(id)} | |||||
| color="error" | |||||
| />] | |||||
| }, | |||||
| getActions: ({ id }) => [renderDeleteAction(id)], | |||||
| }, | }, | ||||
| { | { | ||||
| field: 'name', | field: 'name', | ||||
| @@ -139,17 +151,7 @@ export default function UploadFileTable({ recordList, setRecordList, showPageCol | |||||
| width: 30, | width: 30, | ||||
| cellClassName: 'actions', | cellClassName: 'actions', | ||||
| // hide:true, | // hide:true, | ||||
| getActions: ({ id }) => { | |||||
| return [ | |||||
| <GridActionsCellItem | |||||
| key="OutSave" | |||||
| icon={<RemoveCircleOutlineIcon />} | |||||
| label="delete" | |||||
| className="textPrimary" | |||||
| onClick={handleCancelClick(id)} | |||||
| color="error" | |||||
| />] | |||||
| }, | |||||
| getActions: ({ id }) => [renderDeleteAction(id)], | |||||
| }, | }, | ||||
| { | { | ||||
| field: 'name', | field: 'name', | ||||
| @@ -55,7 +55,7 @@ import {PNSPS_LONG_BUTTON_THEME} from "../../../themes/buttonConst"; | |||||
| import {ThemeProvider} from "@emotion/react"; | import {ThemeProvider} from "@emotion/react"; | ||||
| import {FormattedMessage, useIntl} from "react-intl"; | import {FormattedMessage, useIntl} from "react-intl"; | ||||
| //import { Invaild } from 'utils/IconUtils'; | //import { Invaild } from 'utils/IconUtils'; | ||||
| import { notifyActionError } from 'utils/CommonFunction'; | |||||
| import { handleActionKeyDown, notifyActionError } from 'utils/CommonFunction'; | |||||
| // ============================|| FIREBASE - REGISTER ||============================ // | // ============================|| FIREBASE - REGISTER ||============================ // | ||||
| @@ -822,10 +822,12 @@ const BusCustomFormWizard = (props) => { | |||||
| <InputAdornment position="end"> | <InputAdornment position="end"> | ||||
| <IconButton | <IconButton | ||||
| role="button" | role="button" | ||||
| tabIndex={0} | |||||
| aria-label={intl.formatMessage({ | aria-label={intl.formatMessage({ | ||||
| id: showPassword ? "ariaHidePassword" : "ariaShowPassword" | id: showPassword ? "ariaHidePassword" : "ariaShowPassword" | ||||
| })} | })} | ||||
| onClick={handleClickShowPassword} | onClick={handleClickShowPassword} | ||||
| onKeyDown={(event) => handleActionKeyDown(event, handleClickShowPassword)} | |||||
| onMouseDown={handleMouseDownPassword} | onMouseDown={handleMouseDownPassword} | ||||
| edge="end" | edge="end" | ||||
| size="large" | size="large" | ||||
| @@ -899,10 +901,12 @@ const BusCustomFormWizard = (props) => { | |||||
| <InputAdornment position="end"> | <InputAdornment position="end"> | ||||
| <IconButton | <IconButton | ||||
| role="button" | role="button" | ||||
| tabIndex={0} | |||||
| aria-label={intl.formatMessage({ | aria-label={intl.formatMessage({ | ||||
| id: showConfirmPassword ? "ariaHidePassword" : "ariaShowPassword" | id: showConfirmPassword ? "ariaHidePassword" : "ariaShowPassword" | ||||
| })} | })} | ||||
| onClick={handleClickShowConfirmPassword} | onClick={handleClickShowConfirmPassword} | ||||
| onKeyDown={(event) => handleActionKeyDown(event, handleClickShowConfirmPassword)} | |||||
| onMouseDown={handleMouseDownPassword} | onMouseDown={handleMouseDownPassword} | ||||
| edge="end" | edge="end" | ||||
| size="large" | size="large" | ||||
| @@ -1546,6 +1550,7 @@ const BusCustomFormWizard = (props) => { | |||||
| variant="contained" | variant="contained" | ||||
| sx={{ height: '40px' }} | sx={{ height: '40px' }} | ||||
| type="button" | type="button" | ||||
| tabIndex={0} | |||||
| onClick={() => { | onClick={() => { | ||||
| if (fileInputRef.current) { | if (fileInputRef.current) { | ||||
| fileInputRef.current.click(); | fileInputRef.current.click(); | ||||
| @@ -1659,7 +1664,14 @@ const BusCustomFormWizard = (props) => { | |||||
| <img src={captchaImg} alt="" /> | <img src={captchaImg} alt="" /> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={1} lg={1} style={{ "border": "0px solid black" }}> | <Grid item xs={1} lg={1} style={{ "border": "0px solid black" }}> | ||||
| <IconButton role="button" aria-label={intl.formatMessage({ id: 'ariaRefreshCaptcha' })} size="large" onClick={() => { onCaptchaChange() }}> | |||||
| <IconButton | |||||
| role="button" | |||||
| tabIndex={0} | |||||
| aria-label={intl.formatMessage({ id: 'ariaRefreshCaptcha' })} | |||||
| size="large" | |||||
| onClick={() => { onCaptchaChange() }} | |||||
| onKeyDown={(event) => handleActionKeyDown(event, () => onCaptchaChange())} | |||||
| > | |||||
| <LoopIcon fontSize="inherit" /> | <LoopIcon fontSize="inherit" /> | ||||
| </IconButton> | </IconButton> | ||||
| </Grid> | </Grid> | ||||
| @@ -47,7 +47,7 @@ import { FormattedMessage, useIntl } from "react-intl"; | |||||
| import { Link } from 'react-router-dom'; | import { Link } from 'react-router-dom'; | ||||
| import { PNSPS_LONG_BUTTON_THEME } from "../../../themes/buttonConst"; | import { PNSPS_LONG_BUTTON_THEME } from "../../../themes/buttonConst"; | ||||
| import * as HttpUtils from "../../../utils/HttpUtils"; | import * as HttpUtils from "../../../utils/HttpUtils"; | ||||
| import { notifyActionError } from 'utils/CommonFunction'; | |||||
| import { handleActionKeyDown, notifyActionError } from 'utils/CommonFunction'; | |||||
| // ============================|| FIREBASE - REGISTER ||============================ // | // ============================|| FIREBASE - REGISTER ||============================ // | ||||
| const CustomFormWizard = (props) => { | const CustomFormWizard = (props) => { | ||||
| @@ -1040,10 +1040,12 @@ const CustomFormWizard = (props) => { | |||||
| <InputAdornment position="end"> | <InputAdornment position="end"> | ||||
| <IconButton | <IconButton | ||||
| role="button" | role="button" | ||||
| tabIndex={0} | |||||
| aria-label={intl.formatMessage({ | aria-label={intl.formatMessage({ | ||||
| id: showPassword ? "ariaHidePassword" : "ariaShowPassword" | id: showPassword ? "ariaHidePassword" : "ariaShowPassword" | ||||
| })} | })} | ||||
| onClick={handleClickShowPassword} | onClick={handleClickShowPassword} | ||||
| onKeyDown={(event) => handleActionKeyDown(event, handleClickShowPassword)} | |||||
| onMouseDown={handleMouseDownPassword} | onMouseDown={handleMouseDownPassword} | ||||
| edge="end" | edge="end" | ||||
| size="large" | size="large" | ||||
| @@ -1117,10 +1119,12 @@ const CustomFormWizard = (props) => { | |||||
| <InputAdornment position="end"> | <InputAdornment position="end"> | ||||
| <IconButton | <IconButton | ||||
| role="button" | role="button" | ||||
| tabIndex={0} | |||||
| aria-label={intl.formatMessage({ | aria-label={intl.formatMessage({ | ||||
| id: showConfirmPassword ? "ariaHidePassword" : "ariaShowPassword" | id: showConfirmPassword ? "ariaHidePassword" : "ariaShowPassword" | ||||
| })} | })} | ||||
| onClick={handleClickShowConfirmPassword} | onClick={handleClickShowConfirmPassword} | ||||
| onKeyDown={(event) => handleActionKeyDown(event, handleClickShowConfirmPassword)} | |||||
| onMouseDown={handleMouseDownPassword} | onMouseDown={handleMouseDownPassword} | ||||
| edge="end" | edge="end" | ||||
| size="large" | size="large" | ||||
| @@ -1874,6 +1878,7 @@ const CustomFormWizard = (props) => { | |||||
| variant="contained" | variant="contained" | ||||
| sx={{ height: '40px' }} | sx={{ height: '40px' }} | ||||
| type="button" | type="button" | ||||
| tabIndex={0} | |||||
| onClick={() => { | onClick={() => { | ||||
| if (fileInputRef.current) { | if (fileInputRef.current) { | ||||
| fileInputRef.current.click(); | fileInputRef.current.click(); | ||||
| @@ -1987,7 +1992,14 @@ const CustomFormWizard = (props) => { | |||||
| <img src={captchaImg} alt="" /> | <img src={captchaImg} alt="" /> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={1} lg={1} style={{ "border": "0px solid black" }}> | <Grid item xs={1} lg={1} style={{ "border": "0px solid black" }}> | ||||
| <IconButton role="button" aria-label={intl.formatMessage({ id: 'ariaRefreshCaptcha' })} size="large" onClick={() => { onCaptchaChange() }}> | |||||
| <IconButton | |||||
| role="button" | |||||
| tabIndex={0} | |||||
| aria-label={intl.formatMessage({ id: 'ariaRefreshCaptcha' })} | |||||
| size="large" | |||||
| onClick={() => { onCaptchaChange() }} | |||||
| onKeyDown={(event) => handleActionKeyDown(event, () => onCaptchaChange())} | |||||
| > | |||||
| <LoopIcon fontSize="inherit" /> | <LoopIcon fontSize="inherit" /> | ||||
| </IconButton> | </IconButton> | ||||
| </Grid> | </Grid> | ||||
| @@ -2116,8 +2128,10 @@ const CustomFormWizard = (props) => { | |||||
| <IconButton | <IconButton | ||||
| role="button" | role="button" | ||||
| tabIndex={0} | |||||
| aria-label={intl.formatMessage({ id: 'ariaToggleIdVisibility' })} | aria-label={intl.formatMessage({ id: 'ariaToggleIdVisibility' })} | ||||
| onClick={handleClickShowId} | onClick={handleClickShowId} | ||||
| onKeyDown={(event) => handleActionKeyDown(event, handleClickShowId)} | |||||
| onMouseDown={handleMouseDownId} | onMouseDown={handleMouseDownId} | ||||
| edge="end" | edge="end" | ||||
| size="medium" | size="medium" | ||||
| @@ -14,6 +14,7 @@ import { | |||||
| Typography | Typography | ||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import { FormattedMessage, useIntl } from "react-intl"; | import { FormattedMessage, useIntl } from "react-intl"; | ||||
| import { handleActionKeyDown } from 'utils/CommonFunction'; | |||||
| // ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
| export default function UploadFileTable({ recordList, setUpdateRows, }) { | export default function UploadFileTable({ recordList, setUpdateRows, }) { | ||||
| @@ -74,8 +75,10 @@ export default function UploadFileTable({ recordList, setUpdateRows, }) { | |||||
| size="small" | size="small" | ||||
| color="error" | color="error" | ||||
| role="button" | role="button" | ||||
| aria-label={intl.formatMessage({ id: 'delete' })} | |||||
| tabIndex={0} | |||||
| aria-label={intl.formatMessage({ id: 'ariaDeleteFile' })} | |||||
| onClick={() => handleCancelClick(row.id)} | onClick={() => handleCancelClick(row.id)} | ||||
| onKeyDown={(event) => handleActionKeyDown(event, () => handleCancelClick(row.id))} | |||||
| > | > | ||||
| <RemoveCircleOutlineIcon fontSize="small" /> | <RemoveCircleOutlineIcon fontSize="small" /> | ||||
| </IconButton> | </IconButton> | ||||
| @@ -7,7 +7,7 @@ const MainLayout = Loadable(lazy(() => import('layout/MainLayout'))); | |||||
| import {isGranted, isGrantedAny} from "auth/utils"; | import {isGranted, isGrantedAny} from "auth/utils"; | ||||
| // import { isPasswordExpiry } from "utils/Utils"; | // import { isPasswordExpiry } from "utils/Utils"; | ||||
| // render - dashboard | // render - dashboard | ||||
| const DashboardDefault = Loadable(lazy(() => import('pages/Dashboard/GLD'))); | |||||
| const DashboardDefault = Loadable(lazy(() => import('pages/dashboard/GLD'))); | |||||
| const ApplicationDetail = Loadable(lazy(() => import('pages/PublicNotice/Details_GLD'))); | const ApplicationDetail = Loadable(lazy(() => import('pages/PublicNotice/Details_GLD'))); | ||||
| const ApplicationSearch = Loadable(lazy(() => import('pages/PublicNotice/Search_GLD'))); | const ApplicationSearch = Loadable(lazy(() => import('pages/PublicNotice/Search_GLD'))); | ||||
| const ApplicationMarkAsPaidSearch = Loadable(lazy(() => import('pages/PublicNotice/Search_Mark_As_Paid_GLD'))); | const ApplicationMarkAsPaidSearch = Loadable(lazy(() => import('pages/PublicNotice/Search_Mark_As_Paid_GLD'))); | ||||
| @@ -7,7 +7,7 @@ const MainLayout = Loadable(lazy(() => import('layout/MainLayout'))); | |||||
| // import { isPasswordExpiry } from "utils/Utils"; | // import { isPasswordExpiry } from "utils/Utils"; | ||||
| // render - dashboard | // render - dashboard | ||||
| const DashboardDefault = Loadable(lazy(() => import('pages/Dashboard/Public'))); | |||||
| const DashboardDefault = Loadable(lazy(() => import('pages/dashboard/Public'))); | |||||
| const ManageOrgUser = Loadable(lazy(() => import('pages/User/ManagePage_OrgPublic'))); | const ManageOrgUser = Loadable(lazy(() => import('pages/User/ManagePage_OrgPublic'))); | ||||
| const PublicNotice = Loadable(lazy(() => import('pages/PublicNotice/ListPanel'))); | const PublicNotice = Loadable(lazy(() => import('pages/PublicNotice/ListPanel'))); | ||||
| const PublicNoticeApplyForm = Loadable(lazy(() => import('pages/PublicNotice/ApplyForm'))); | const PublicNoticeApplyForm = Loadable(lazy(() => import('pages/PublicNotice/ApplyForm'))); | ||||
| @@ -652,6 +652,7 @@ | |||||
| "ariaApplicationGroup": "Application Group", | "ariaApplicationGroup": "Application Group", | ||||
| "ariaProfileTabs": "Profile tabs", | "ariaProfileTabs": "Profile tabs", | ||||
| "ariaUploadPdfFile": "Upload PDF file", | "ariaUploadPdfFile": "Upload PDF file", | ||||
| "ariaDeleteFile": "Delete file", | |||||
| "ariaExportHolidayTemplate": "Export holiday template", | "ariaExportHolidayTemplate": "Export holiday template", | ||||
| "ariaUploadExcelFile": "Upload Excel file (.xlsx)", | "ariaUploadExcelFile": "Upload Excel file (.xlsx)", | ||||
| "ariaBackToHome": "Back to home", | "ariaBackToHome": "Back to home", | ||||
| @@ -648,6 +648,7 @@ | |||||
| "ariaApplicationGroup": "申请组别", | "ariaApplicationGroup": "申请组别", | ||||
| "ariaProfileTabs": "个人资料选项卡", | "ariaProfileTabs": "个人资料选项卡", | ||||
| "ariaUploadPdfFile": "上传 PDF 文件", | "ariaUploadPdfFile": "上传 PDF 文件", | ||||
| "ariaDeleteFile": "删除文件", | |||||
| "ariaExportHolidayTemplate": "导出假期模板", | "ariaExportHolidayTemplate": "导出假期模板", | ||||
| "ariaUploadExcelFile": "上传 Excel 文件 (.xlsx)", | "ariaUploadExcelFile": "上传 Excel 文件 (.xlsx)", | ||||
| "ariaBackToHome": "返回主页", | "ariaBackToHome": "返回主页", | ||||
| @@ -649,6 +649,7 @@ | |||||
| "ariaApplicationGroup": "申請組別", | "ariaApplicationGroup": "申請組別", | ||||
| "ariaProfileTabs": "個人檔案分頁", | "ariaProfileTabs": "個人檔案分頁", | ||||
| "ariaUploadPdfFile": "上載 PDF 檔案", | "ariaUploadPdfFile": "上載 PDF 檔案", | ||||
| "ariaDeleteFile": "刪除檔案", | |||||
| "ariaExportHolidayTemplate": "匯出假期範本", | "ariaExportHolidayTemplate": "匯出假期範本", | ||||
| "ariaUploadExcelFile": "上載 Excel 檔案 (.xlsx)", | "ariaUploadExcelFile": "上載 Excel 檔案 (.xlsx)", | ||||
| "ariaBackToHome": "返回主頁", | "ariaBackToHome": "返回主頁", | ||||
| @@ -11,6 +11,13 @@ export const clickableLink=(link, label)=> { | |||||
| return <a href={link}>{label}</a>; | return <a href={link}>{label}</a>; | ||||
| } | } | ||||
| export const handleActionKeyDown = (event, action) => { | |||||
| if (event.key === 'Enter' || event.key === ' ') { | |||||
| event.preventDefault(); | |||||
| action(event); | |||||
| } | |||||
| }; | |||||
| export function getDeletedRecordWithRefList(referenceList, updatedList) { | export function getDeletedRecordWithRefList(referenceList, updatedList) { | ||||
| return referenceList.filter(x => !updatedList.includes(x)); | return referenceList.filter(x => !updatedList.includes(x)); | ||||
| } | } | ||||