Переглянути джерело

update gldRemarks for gld user

CR003
Alex Cheung 1 рік тому
джерело
коміт
ec5aa563e4
2 змінених файлів з 118 додано та 3 видалено
  1. +117
    -3
      src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js
  2. +1
    -0
      src/utils/ApiPathConst.js

+ 117
- 3
src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js Переглянути файл

@@ -4,6 +4,7 @@ import {
Button,
Grid,
Typography, FormLabel,
TextField,
OutlinedInput,
Stack,
Dialog, DialogTitle, DialogContent, DialogActions, InputAdornment,
@@ -22,7 +23,7 @@ import Loadable from 'components/Loadable';
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
import * as HttpUtils from "utils/HttpUtils"
import * as DateUtils from "utils/DateUtils"
import {CHECK_CREATE_PROOF} from "utils/ApiPathConst"
import {CHECK_CREATE_PROOF,UPDATE_GLDREMARKS } from "utils/ApiPathConst"
import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils";

import DoneIcon from '@mui/icons-material/Done';
@@ -46,10 +47,12 @@ const ApplicationDetailCard = (
const [fileDetail, setfileDetail] = useState({});
const [onReady, setOnReady] = useState(false);

const { register } = useForm()
const { register,handleSubmit } = useForm()

const [isWarningPopUp, setIsWarningPopUp] = useState(false);
const [warningText, setWarningText] = useState("");
const [remarksPopUp, setRemarksPopUp] = useState(false);

useEffect(() => {
//if user data from parent are not null
@@ -141,7 +144,6 @@ const ApplicationDetailCard = (
}
}
});

} else {
setWarningText("Please generate Gazette Code before Create Proof.");
setIsWarningPopUp(true);
@@ -154,6 +156,28 @@ const ApplicationDetailCard = (
window.removeEventListener("focus", onFocus)
}

const onSubmit = (data) => {
// console.log(data)
const gldRemarks = data.makeRemarks
if (gldRemarks!=null&&gldRemarks!=currentApplicationDetailData.gldRemarks){
HttpUtils.post({
url: UPDATE_GLDREMARKS + "/" + currentApplicationDetailData.id,
params: {
gldRemarks: gldRemarks
},
onSuccess: function () {
location.reload();
},
onError: (error) => {
alert(error)
}
});
}else{
setRemarksPopUp(false)
}

};

return (
!onReady ?
<LoadingComponent />
@@ -619,6 +643,55 @@ const ApplicationDetailCard = (
</Grid>
</Grid>
</Grid>
<Grid container direction="row" justifyContent="space-start" alignItems="center">
<Grid item xs={12} md={12} lg={12} sx={{ mb: 1, }}>
<Grid container alignItems={"center"}>
<Grid item xs={12} md={2} lg={2}
sx={{ display: 'flex', alignItems: 'center' }}>
<FormLabel><Typography variant="h5">Remarks:</Typography></FormLabel>
</Grid>

<Grid item xs={12} md={10} lg={10}>
<Grid container direction="row" >
<Grid item xs={12} md={9} lg={9} >
<FormControl variant="outlined" fullWidth disabled >
<OutlinedInput
fullWidth
size="small"
{...register("gldRemarks",
{
value: currentApplicationDetailData.gldRemarks,
})}
id='appNo'
sx={{
"& .MuiInputBase-input.Mui-disabled": {
WebkitTextFillColor: "#000000",
background: "#f8f8f8",
},
}}
/>
</FormControl>
</Grid>
<Grid item xs={12} ml={1} md={2} lg={2}>
<Button
// size="large"
variant="contained"
onClick={() => setRemarksPopUp(true)}
sx={{
textTransform: 'capitalize',
alignItems: 'end',
}}>
<EditNoteIcon />
<Typography ml={1} variant="h5"> Edit</Typography>
</Button>
</Grid>
</Grid>
</Grid>

</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
</form>
@@ -643,6 +716,47 @@ const ApplicationDetailCard = (
</DialogActions>
</Dialog>
</div>
<div>
<Dialog
open={remarksPopUp}
onClose={() => setRemarksPopUp(false)}
PaperProps={{
sx: {
minWidth: '40vw',
maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' },
maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' }
}
}}
>
<form onSubmit={handleSubmit(onSubmit)}>
<DialogTitle><Typography variant="h3">Remarks</Typography></DialogTitle>
<DialogContent style={{ display: 'flex', }}>
<Grid container direction="column">
<Grid item sx={{ padding: '16px' }}>
<TextField
fullWidth
{...register("makeRemarks")}
id='makeRemarks'
// label="Remarks"
defaultValue={currentApplicationDetailData.gldRemarks!=null?currentApplicationDetailData.gldRemarks:""}
InputLabelProps={{
shrink: true
}}
/>
</Grid>
</Grid>

</DialogContent>
<DialogActions>
<Stack direction="row" justifyContent="space-between">
<Button onClick={() => setRemarksPopUp(false)}><Typography variant="h5">Cancel</Typography></Button>
<Button type="submit"><Typography variant="h5">Save</Typography></Button>
{/* <Button onClick={() => markAsCreditor()}><Typography variant="h5">Confirm</Typography></Button> */}
</Stack>
</DialogActions>
</form>
</Dialog>
</div>
</MainCard>
);
};


+ 1
- 0
src/utils/ApiPathConst.js Переглянути файл

@@ -134,6 +134,7 @@ export const SET_PUBLIC_NOTICE_STATUS_REVOKE = apiPath+'/application/application
export const SET_PUBLIC_NOTICE_STATUS_PUBLISH_BULK = apiPath+'/application/application-detail-status-publish-bulk';
export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save';
export const GET_AUDIT_LOG_LIST = apiPath+'/settings/auditLogList';
export const UPDATE_GLDREMARKS = apiPath+'/application/updateGldRemarks';

//gazette
export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo';//GET


Завантаження…
Відмінити
Зберегти