update modal error message
This commit is contained in:
parent
6dbfbddeb6
commit
6eeed9b451
@ -109,7 +109,8 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||
details: ConfirmedBillDetail[];
|
||||
errorMessage?: string;
|
||||
errorConfirmMessage?: string;
|
||||
values?: CreateBillRecordModel
|
||||
errorConfirmOk?: boolean;
|
||||
values?: CreateBillRecordModel;
|
||||
}>({
|
||||
details: []
|
||||
})
|
||||
@ -132,7 +133,8 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||
values.paid_date = dayjs(values.paid_date).format("YYYY-MM-DD")
|
||||
values.delivered_date = dayjs(values.delivered_date).format("YYYY-MM-DD")
|
||||
setState({
|
||||
loading: true, errorMessage: undefined,values
|
||||
loading: true, errorMessage: undefined,
|
||||
values,errorConfirmOk:false
|
||||
})
|
||||
addBillRecord(values).then(() => {
|
||||
setState({open: false})
|
||||
@ -141,9 +143,9 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||
}).catch((e: BizError) => {
|
||||
if (e.code == -50415) { // STUDENT_INFO_NOT_FOUND
|
||||
// duplicate
|
||||
setState({errorConfirmMessage: e.message})
|
||||
setState({errorConfirmMessage: e.message,errorConfirmOk:true})
|
||||
} else {
|
||||
setState({errorMessage: e.message})
|
||||
setState({errorConfirmMessage: e.message})
|
||||
}
|
||||
}).finally(() => {
|
||||
setState({
|
||||
@ -360,9 +362,16 @@ export const AddBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||
onCancel={handleCloseConfirm}
|
||||
width={600}
|
||||
maskClosable={false}
|
||||
okText={t('base.confirm_and_add')}
|
||||
onOk={handleConfirmAdd}
|
||||
okButtonProps={{loading: state.confirmLoading}}
|
||||
footer={
|
||||
<div className={'text-center'}>
|
||||
<Space>
|
||||
<Button onClick={handleCloseConfirm} type={'tertiary'}>{t('base.cancel')}</Button>
|
||||
{state.errorConfirmOk && <Button loading={state.confirmLoading} onClick={handleConfirmAdd} theme={'solid'}>
|
||||
{t('base.confirm_and_add')}
|
||||
</Button>}
|
||||
</Space>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Descriptions layout='horizontal' align='plain' data={details} column={2}/>
|
||||
<Divider style={{margin: '10px 0'}}>{t('base.title_error_tip')}</Divider>
|
||||
|
Loading…
x
Reference in New Issue
Block a user