@@ -51,7 +51,7 @@ export default function SearchDemandNote({ recordList }) { | |||||
headerName: '狀態', | headerName: '狀態', | ||||
width: 175, | width: 175, | ||||
renderCell: (params) => { | renderCell: (params) => { | ||||
return [StatusUtils.getStatus_Eng(params)] | |||||
return [StatusUtils.getStatus_Cht(params)] | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
@@ -0,0 +1,53 @@ | |||||
// material-ui | |||||
import * as React from 'react'; | |||||
import { FiDataGrid } from "components/FiDataGrid"; | |||||
import { useEffect } from "react"; | |||||
import * as DateUtils from "utils/DateUtils"; | |||||
// ==============================|| EVENT TABLE ||============================== // | |||||
export default function CreditorHistoryTable({ recordList }) { | |||||
const [rows, setRows] = React.useState(recordList); | |||||
useEffect(() => { | |||||
setRows(recordList); | |||||
}, [recordList]); | |||||
const columns = [ | |||||
{ | |||||
id: 'actionType', | |||||
field: 'actionType', | |||||
headerName: 'Action', | |||||
flex: 2 | |||||
}, | |||||
{ | |||||
id: 'modified', | |||||
field: 'modified', | |||||
headerName: 'Datetime', | |||||
flex: 1, | |||||
renderCell: (params) => { | |||||
return DateUtils.datetimeStr(params.value); | |||||
} | |||||
}, | |||||
{ | |||||
id: 'modifiedByName', | |||||
field: 'modifiedByName', | |||||
headerName: 'Modified By', | |||||
width: 200, | |||||
}, | |||||
]; | |||||
return ( | |||||
<div style={{ height: "fit-content", width: '100%' }}> | |||||
<FiDataGrid | |||||
rows={rows} | |||||
columns={columns} | |||||
initialState={{ | |||||
pagination: { | |||||
paginationModel: { page: 0, pageSize: 100 }, | |||||
}, | |||||
}} | |||||
/> | |||||
</div> | |||||
); | |||||
} |
@@ -1,6 +1,7 @@ | |||||
// material-ui | // material-ui | ||||
import { | import { | ||||
Grid, Button, Checkbox, FormControlLabel, Typography | |||||
Grid, Button, Checkbox, FormControlLabel, Typography, | |||||
Dialog, DialogTitle, DialogContent, DialogActions, | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
// import { FormControlLabel } from '@material-ui/core'; | // import { FormControlLabel } from '@material-ui/core'; | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
@@ -22,6 +23,9 @@ import { notifySaveSuccess } from 'utils/CommonFunction'; | |||||
const OrganizationCard = ({ userData, loadDataFun, id }) => { | const OrganizationCard = ({ userData, loadDataFun, id }) => { | ||||
const [creditorConfirmPopUp, setCreditorConfirmPopUp] = React.useState(false); | |||||
const [nonCreditorConfirmPopUp, setNonCreditorConfirmPopUp] = React.useState(false); | |||||
const [currentUserData, setCurrentUserData] = useState({}); | const [currentUserData, setCurrentUserData] = useState({}); | ||||
const [editMode, setEditMode] = useState(false); | const [editMode, setEditMode] = useState(false); | ||||
const [createMode, setCreateMode] = useState(false); | const [createMode, setCreateMode] = useState(false); | ||||
@@ -93,7 +97,7 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
addressLine2: vaule.addressLine2, | addressLine2: vaule.addressLine2, | ||||
addressLine3: vaule.addressLine3, | addressLine3: vaule.addressLine3, | ||||
}, | }, | ||||
creditor: vaule.creditor, | |||||
//creditor: vaule.creditor, | |||||
}, | }, | ||||
onSuccess: function () { | onSuccess: function () { | ||||
notifySaveSuccess() | notifySaveSuccess() | ||||
@@ -125,6 +129,26 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
setEditMode(true); | setEditMode(true); | ||||
}; | }; | ||||
const markAsCreditor = () => { | |||||
setCreditorConfirmPopUp(false); | |||||
HttpUtils.get({ | |||||
url: UrlUtils.GET_ORG_MARK_AS_CREDITOR + "/" + id, | |||||
onSuccess: () => { | |||||
loadDataFun(); | |||||
} | |||||
}); | |||||
} | |||||
const markAsNonCreditor = () => { | |||||
setNonCreditorConfirmPopUp(false); | |||||
HttpUtils.get({ | |||||
url: UrlUtils.GET_ORG_MARK_AS_NON_CREDITOR + "/" + id, | |||||
onSuccess: () => { | |||||
loadDataFun(); | |||||
} | |||||
}); | |||||
} | |||||
return ( | return ( | ||||
<MainCard elevation={0} | <MainCard elevation={0} | ||||
border={false} | border={false} | ||||
@@ -201,6 +225,34 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
<Typography variant="h5">Edit</Typography> | <Typography variant="h5">Edit</Typography> | ||||
</Button> | </Button> | ||||
</Grid> | </Grid> | ||||
<Grid item sx={{ ml: 3, mr: 3 }}> | |||||
<Button | |||||
size="large" | |||||
variant="contained" | |||||
color="orange" | |||||
onClick={()=>setCreditorConfirmPopUp(true)} | |||||
sx={{ | |||||
textTransform: 'capitalize', | |||||
alignItems: 'end' | |||||
}} | |||||
> | |||||
<Typography variant="h5">Mark as Creditor</Typography> | |||||
</Button> | |||||
</Grid> | |||||
<Grid item sx={{ ml: 3, mr: 3 }}> | |||||
<Button | |||||
size="large" | |||||
variant="contained" | |||||
color="error" | |||||
onClick={()=>setNonCreditorConfirmPopUp(true)} | |||||
sx={{ | |||||
textTransform: 'capitalize', | |||||
alignItems: 'end' | |||||
}} | |||||
> | |||||
<Typography variant="h5">Mark as Non-Creditor</Typography> | |||||
</Button> | |||||
</Grid> | |||||
</> | </> | ||||
} | } | ||||
</Grid> | </Grid> | ||||
@@ -212,7 +264,7 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
: | : | ||||
<Grid container spacing={1}> | <Grid container spacing={1}> | ||||
<Grid item xs={12}> | <Grid item xs={12}> | ||||
<Typography variant="h4" sx={{mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
<Typography variant="h4" sx={{ mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
Organisation Details | Organisation Details | ||||
</Typography> | </Typography> | ||||
</Grid> | </Grid> | ||||
@@ -233,7 +285,8 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
onChange={() => { | onChange={() => { | ||||
formik.setFieldValue("creditor", !formik.values.creditor); | formik.setFieldValue("creditor", !formik.values.creditor); | ||||
}} | }} | ||||
disabled={!editMode && !createMode} | |||||
disabled={true} | |||||
//disabled={!editMode && !createMode} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
@@ -334,6 +387,30 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
</Grid> | </Grid> | ||||
} | } | ||||
</form> | </form> | ||||
<div> | |||||
<Dialog open={creditorConfirmPopUp} onClose={() => setCreditorConfirmPopUp(false)} > | |||||
<DialogTitle><Typography variant="h3">Confirm</Typography></DialogTitle> | |||||
<DialogContent style={{ display: 'flex', }}> | |||||
<Typography variant="h4" style={{ padding: '16px' }}>Are you sure mark as Creditor?</Typography> | |||||
</DialogContent> | |||||
<DialogActions> | |||||
<Button onClick={() => setCreditorConfirmPopUp(false)}><Typography variant="h5">Cencel</Typography></Button> | |||||
<Button onClick={() => markAsCreditor()}><Typography variant="h5">Confirm</Typography></Button> | |||||
</DialogActions> | |||||
</Dialog> | |||||
</div> | |||||
<div> | |||||
<Dialog open={nonCreditorConfirmPopUp} onClose={() => setNonCreditorConfirmPopUp(false)} > | |||||
<DialogTitle><Typography variant="h3">Confirm</Typography></DialogTitle> | |||||
<DialogContent style={{ display: 'flex', }}> | |||||
<Typography variant="h4" style={{ padding: '16px' }}>Are you sure mark as Non-Creditor?</Typography> | |||||
</DialogContent> | |||||
<DialogActions> | |||||
<Button onClick={() => setNonCreditorConfirmPopUp(false)}><Typography variant="h5">Cencel</Typography></Button> | |||||
<Button onClick={() => markAsNonCreditor()}><Typography variant="h5">Confirm</Typography></Button> | |||||
</DialogActions> | |||||
</Dialog> | |||||
</div> | |||||
</MainCard> | </MainCard> | ||||
); | ); | ||||
}; | }; | ||||
@@ -1,18 +1,17 @@ | |||||
// material-ui | // material-ui | ||||
import { Grid, Typography, Stack, Box, Button } from '@mui/material'; | import { Grid, Typography, Stack, Box, Button } from '@mui/material'; | ||||
import { useEffect, useState } from "react"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
import * as HttpUtils from "../../../utils/HttpUtils"; | |||||
import { useParams } from "react-router-dom"; | |||||
import * as UrlUtils from "../../../utils/ApiPathConst"; | |||||
import * as DateUtils from "../../../utils/DateUtils"; | |||||
import * as HttpUtils from "utils/HttpUtils"; | |||||
import * as UrlUtils from "utils/ApiPathConst"; | |||||
import * as DateUtils from "utils/DateUtils"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import { lazy } from 'react'; | |||||
const InfoCard = Loadable(lazy(() => import('./OrganizationCard'))); | |||||
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | |||||
const InfoCard = Loadable(React.lazy(() => import('./OrganizationCard'))); | |||||
const Table = Loadable(React.lazy(() => import('./CreditorHistoryTable'))); | |||||
const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||||
import ForwardIcon from '@mui/icons-material/Forward'; | import ForwardIcon from '@mui/icons-material/Forward'; | ||||
import { useNavigate } from 'react-router-dom'; | |||||
import { useNavigate, useParams } from 'react-router-dom'; | |||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
const BackgroundHead = { | const BackgroundHead = { | ||||
@@ -30,11 +29,12 @@ const BackgroundHead = { | |||||
const OrganizationDetailPage = () => { | const OrganizationDetailPage = () => { | ||||
const params = useParams(); | const params = useParams(); | ||||
const [formData, setFormData] = useState({}) | |||||
const [isLoading, setLoding] = useState(true); | |||||
const [formData, setFormData] = React.useState({}) | |||||
const [list, setList] = React.useState([]) | |||||
const [isLoading, setLoding] = React.useState(true); | |||||
const navigate = useNavigate(); | const navigate = useNavigate(); | ||||
useEffect(() => { | |||||
React.useEffect(() => { | |||||
console.log(formData); | console.log(formData); | ||||
loadData(); | loadData(); | ||||
}, []); | }, []); | ||||
@@ -59,13 +59,14 @@ const OrganizationDetailPage = () => { | |||||
response.data["brExpiryDate"] = response.data.brExpiryDate ? DateUtils.dateStr(response.data.brExpiryDate) : ""; | response.data["brExpiryDate"] = response.data.brExpiryDate ? DateUtils.dateStr(response.data.brExpiryDate) : ""; | ||||
setFormData(response.data) | setFormData(response.data) | ||||
setList(response.historyList) | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
}; | }; | ||||
useEffect(() => { | |||||
React.useEffect(() => { | |||||
setLoding(false); | setLoding(false); | ||||
}, [formData]); | }, [formData]); | ||||
@@ -99,6 +100,19 @@ const OrganizationDetailPage = () => { | |||||
</Box> | </Box> | ||||
<br /> | <br /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12}> | |||||
<Box xs={12} ml={0} mt={-1} mr={0} sx={{ pl:4, pr:4, pb:2 }}> | |||||
<Grid container sx={{ p: 3, backgroundColor: "#FFF", borderRadius: '10px' }}> | |||||
<Grid item xs={12} sx={{ p:1 }}> | |||||
<Table | |||||
sx={{ p: 1 }} | |||||
recordList={list} | |||||
> | |||||
</Table> | |||||
</Grid> | |||||
</Grid> | |||||
</Box> | |||||
</Grid> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
{/*col 2*/} | {/*col 2*/} | ||||
@@ -3,17 +3,18 @@ import { | |||||
Button, | Button, | ||||
CardContent, | CardContent, | ||||
Grid, TextField, | Grid, TextField, | ||||
Typography | |||||
Typography, | |||||
Checkbox, FormControlLabel, | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import {useForm} from "react-hook-form"; | |||||
import { useForm } from "react-hook-form"; | |||||
import { useState} from "react"; | |||||
import { useState } from "react"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const OrganizationSearchForm = ({applySearch}) => { | |||||
const OrganizationSearchForm = ({ applySearch }) => { | |||||
const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
@@ -22,7 +23,7 @@ const OrganizationSearchForm = ({applySearch}) => { | |||||
let typeArray = []; | let typeArray = []; | ||||
for(let i =0; i < type.length; i++){ | |||||
for (let i = 0; i < type.length; i++) { | |||||
typeArray.push(type[i].label); | typeArray.push(type[i].label); | ||||
} | } | ||||
@@ -30,19 +31,20 @@ const OrganizationSearchForm = ({applySearch}) => { | |||||
brNo: data.brNo, | brNo: data.brNo, | ||||
enCompanyName: data.enCompanyName, | enCompanyName: data.enCompanyName, | ||||
chCompanyName: data.chCompanyName, | chCompanyName: data.chCompanyName, | ||||
searchCreditor: data.searchCreditor | |||||
}; | }; | ||||
applySearch(temp); | applySearch(temp); | ||||
}; | }; | ||||
function resetForm(){ | |||||
function resetForm() { | |||||
setType([]); | setType([]); | ||||
reset(); | reset(); | ||||
} | } | ||||
return ( | return ( | ||||
<MainCard xs={12} md={12} lg={12} | <MainCard xs={12} md={12} lg={12} | ||||
border={false} | |||||
content={false}> | |||||
border={false} | |||||
content={false}> | |||||
<form onSubmit={handleSubmit(onSubmit)}> | <form onSubmit={handleSubmit(onSubmit)}> | ||||
{/*row 1*/} | {/*row 1*/} | ||||
@@ -54,7 +56,7 @@ const OrganizationSearchForm = ({applySearch}) => { | |||||
{/*row 2*/} | {/*row 2*/} | ||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<TextField | <TextField | ||||
fullWidth | fullWidth | ||||
{...register("brNo")} | {...register("brNo")} | ||||
@@ -66,7 +68,7 @@ const OrganizationSearchForm = ({applySearch}) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<TextField | <TextField | ||||
fullWidth | fullWidth | ||||
{...register("enCompanyName")} | {...register("enCompanyName")} | ||||
@@ -78,7 +80,7 @@ const OrganizationSearchForm = ({applySearch}) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<TextField | <TextField | ||||
fullWidth | fullWidth | ||||
{...register("chCompanyName")} | {...register("chCompanyName")} | ||||
@@ -90,13 +92,22 @@ const OrganizationSearchForm = ({applySearch}) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3}}> | |||||
<FormControlLabel | |||||
{...register("searchCreditor")} | |||||
control={<Checkbox/>} | |||||
label="Search Creditor Only" | |||||
id=" " | |||||
/> | |||||
</Grid> | |||||
</Grid> | </Grid> | ||||
{/*last row*/} | {/*last row*/} | ||||
<Grid container maxWidth justifyContent="flex-end"> | <Grid container maxWidth justifyContent="flex-end"> | ||||
<Grid item sx={{ml:3, mr:3, mb:3, mt:3}}> | |||||
<Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -109,7 +120,7 @@ const OrganizationSearchForm = ({applySearch}) => { | |||||
</Button> | </Button> | ||||
</Grid> | </Grid> | ||||
<Grid item sx={{ml:3, mr:3, mb:3, mt:3}}> | |||||
<Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -121,6 +132,8 @@ const OrganizationSearchForm = ({applySearch}) => { | |||||
<Typography variant="h5">Submit</Typography> | <Typography variant="h5">Submit</Typography> | ||||
</Button> | </Button> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</form> | </form> | ||||
</MainCard> | </MainCard> | ||||
@@ -76,12 +76,21 @@ export default function OrganizationTable({ recordList }) { | |||||
{ | { | ||||
id: 'brExpiryDate', | id: 'brExpiryDate', | ||||
field: 'brExpiryDate', | field: 'brExpiryDate', | ||||
headerName: 'Expiry Date', | |||||
headerName: 'BR Expiry Date', | |||||
flex: 1, | flex: 1, | ||||
valueGetter: (params) => { | valueGetter: (params) => { | ||||
return DateUtils.dateStr(params?.value); | return DateUtils.dateStr(params?.value); | ||||
} | } | ||||
}, | }, | ||||
{ | |||||
id: 'creditor', | |||||
field: 'creditor', | |||||
headerName: 'Creditor', | |||||
width: 100, | |||||
valueGetter: (params) => { | |||||
return params?.value?"Yes":""; | |||||
} | |||||
}, | |||||
]; | ]; | ||||
function handleRowDoubleClick(params) { | function handleRowDoubleClick(params) { | ||||
@@ -26,6 +26,9 @@ export const GET_ORG_PATH = apiPath+'/org'; | |||||
export const GET_ORG_FROM_USER_PATH = apiPath+'/org/from-user'; | export const GET_ORG_FROM_USER_PATH = apiPath+'/org/from-user'; | ||||
export const POST_ORG_SAVE_PATH = apiPath+'/org/save'; | export const POST_ORG_SAVE_PATH = apiPath+'/org/save'; | ||||
export const GET_ORG_COMBO = apiPath+'/org/combo'; | export const GET_ORG_COMBO = apiPath+'/org/combo'; | ||||
export const GET_ORG_CHECK_CREDITOR = apiPath+'/org/check-creditor'; | |||||
export const GET_ORG_MARK_AS_CREDITOR = apiPath+'/org/mark-as-creditor'; | |||||
export const GET_ORG_MARK_AS_NON_CREDITOR = apiPath+'/org/mark-as-non-creditor'; | |||||