浏览代码

create DN

master
Anna Ho 1年前
父节点
当前提交
9051d224ea
共有 4 个文件被更改,包括 88 次插入8 次删除
  1. +1
    -1
      src/pages/DemandNote/Create/DataGrid.js
  2. +77
    -6
      src/pages/DemandNote/Create/SearchForm.js
  3. +8
    -1
      src/pages/DemandNote/Create/index.js
  4. +2
    -0
      src/pages/DemandNote/Search/index.js

+ 1
- 1
src/pages/DemandNote/Create/DataGrid.js 查看文件

@@ -50,7 +50,7 @@ export default function SearchPublicNoticeTable({ recordList }) {
headerName: 'Status',
flex: 1,
renderCell: (params) => {
return PublicNoteStatusUtils.getStatusByTextEng(params.row.status);
return PublicNoteStatusUtils.getStatusByTextEng(params.row.status, params.row.creditor);
}
},
{


+ 77
- 6
src/pages/DemandNote/Create/SearchForm.js 查看文件

@@ -14,15 +14,23 @@ import * as DateUtils from "utils/DateUtils";
import * as UrlUtils from "utils/ApiPathConst";
import * as HttpUtils from "utils/HttpUtils";
import { useNavigate } from "react-router-dom";
import { notifyDownloadSuccess } from 'utils/CommonFunction';


// ==============================|| DASHBOARD - DEFAULT ||============================== //


const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => {
const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _publishCount }) => {

const [isFailPopUp, setIsFailPopUp] = React.useState(false);
const [failText, setFailText] = React.useState("");

const [isSuccessPopUp, setIsSuccessPopUp] = React.useState(false);
const [resultCount, setResultCount] = React.useState(0);

const [issueSelected, setIssueSelected] = React.useState({});
const [paymentCount, setPaymentCount] = React.useState(0);
const [publishCount, setPublishCount] = React.useState(0);
const [issueCombo, setIssueCombo] = React.useState([]);
const navigate = useNavigate()

@@ -48,7 +56,14 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => {
}
}, [issueComboData]);

React.useEffect(() => {
setPaymentCount(_paymentCount);
}, [_paymentCount]);

React.useEffect(() => {
setPublishCount(_publishCount);
}, [_publishCount]);

React.useEffect(() => {
onPreView();
}, [issueSelected]);
@@ -69,14 +84,33 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => {
} else {
HttpUtils.post({
url: UrlUtils.DEMAND_NOTE_CREATE + "/" + issueSelected.id,
onSuccess: function () {
navigate('/paymentPage/demandNote');
onSuccess: function (responseData) {
setResultCount(responseData.count);
setIsSuccessPopUp(true);
}
});
}

};

const fileDownload = () => {
HttpUtils.fileDownload({
url: UrlUtils.DEMAND_NOTE_EXPORT,
params: {
"issueId": issueSelected.id
},
onSuccess: function () {
notifyDownloadSuccess();
}
});
}

const onNavigate = () => {
setIsSuccessPopUp(false);
if(resultCount > 0)
navigate('/paymentPage/demandNote');
};

const onPreView = () => {
if (!issueSelected?.id) {
return;
@@ -104,7 +138,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => {

{/*row 2*/}
<Grid container alignItems={"center"}>
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb:1 }}>
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 1 }}>
<Autocomplete
disablePortal
id="issueId"
@@ -139,7 +173,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => {
<Typography variant="h5">Preview</Typography>
</Button>
</Grid> */}
<Grid item sx={{ ml: 3, mr: 3}} >
<Grid item sx={{ ml: 3, mr: 3 }} >
<Button
size="large"
variant="contained"
@@ -152,6 +186,14 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => {
<Typography variant="h5">Create</Typography>
</Button>
</Grid>

<Grid item sx={{ ml: 3, mr: 3 }} >
<Typography variant="h5">Pending Payment: {paymentCount}</Typography>
</Grid>

<Grid item sx={{ ml: 3, mr: 3 }} >
<Typography variant="h5">Pending Publish: {publishCount}</Typography>
</Grid>
</Grid>
</form>
<div>
@@ -165,6 +207,35 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => {
</DialogActions>
</Dialog>
</div>
<div>
<Dialog open={isSuccessPopUp} onClose={() => setIsSuccessPopUp(false)} >
<DialogTitle><Typography variant="h3">Create Result</Typography></DialogTitle>
<DialogContent style={{ display: 'flex', }}>
<Grid container alignItems={"center"}>
<Grid item md={12}>
<Typography variant="h4" style={{ padding: '16px' }}>Created DN record: {resultCount}</Typography>
</Grid>
{resultCount == 0 ? <></> :
<Grid item md={12}>
<Button
size="large"
onClick={fileDownload}
sx={{
textTransform: 'capitalize',
alignItems: 'end'
}}>
<Typography variant="h5">Click here to download GDNS xml file.</Typography>
</Button>
</Grid>
}

</Grid>
</DialogContent>
<DialogActions>
<Button onClick={() => onNavigate()}><Typography variant="h5">OK</Typography></Button>
</DialogActions>
</Dialog>
</div>
</MainCard>
);
};


+ 8
- 1
src/pages/DemandNote/Create/index.js 查看文件

@@ -35,6 +35,9 @@ const Index = () => {
const [searchCriteria, setSearchCriteria] = React.useState({});
const [onReady, setOnReady] = React.useState(false);

const [paymentCount, setPaymentCount] = React.useState(0);
const [publishCount, setPublishCount] = React.useState(0);

React.useEffect(()=>{
getIssueCombo();
},[]);
@@ -51,7 +54,9 @@ const Index = () => {
HttpUtils.get({
url: UrlUtils.DEMAND_NOTE_PREVIEW+"/"+searchCriteria.issueId,
onSuccess: function(responseData){
setRecord(responseData);
setRecord(responseData.records);
setPaymentCount(responseData.paymentCount);
setPublishCount(responseData.publishCount);
}
});
}
@@ -88,6 +93,8 @@ const Index = () => {
<SearchForm
applySearch={applySearch}
issueComboData={issueCombo}
_paymentCount={paymentCount}
_publishCount={publishCount}
/>
</Grid>
{/*row 2*/}


+ 2
- 0
src/pages/DemandNote/Search/index.js 查看文件

@@ -18,6 +18,7 @@ const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/Loa
const SearchForm = Loadable(React.lazy(() => import('./SearchForm')));
const EventTable = Loadable(React.lazy(() => import('./DataGrid')));
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
import { notifyDownloadSuccess } from 'utils/CommonFunction';

const BackgroundHead = {
backgroundImage: `url(${titleBackgroundImg})`,
@@ -77,6 +78,7 @@ const UserSearchPage_Individual = () => {
url: UrlUtils.DEMAND_NOTE_EXPORT,
params: searchCriteria,
onSuccess: function () {
notifyDownloadSuccess();
}
});
}


正在加载...
取消
保存