mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-17 22:43:49 +08:00
Add payment modal.
This commit is contained in:
@ -13,7 +13,8 @@
|
||||
// limitations under the License.
|
||||
|
||||
import React from "react";
|
||||
import {Button, Card, Col, Input, Row, Select} from 'antd';
|
||||
import {Button, Card, Col, Descriptions, Input, Modal, Row, Select} from 'antd';
|
||||
import {InfoCircleTwoTone} from "@ant-design/icons";
|
||||
import * as PaymentBackend from "./backend/PaymentBackend";
|
||||
import * as Setting from "./Setting";
|
||||
import i18next from "i18next";
|
||||
@ -28,6 +29,7 @@ class PaymentEditPage extends React.Component {
|
||||
organizationName: props.organizationName !== undefined ? props.organizationName : props.match.params.organizationName,
|
||||
paymentName: props.match.params.paymentName,
|
||||
payment: null,
|
||||
isModalVisible: false,
|
||||
mode: props.location.mode !== undefined ? props.location.mode : "edit",
|
||||
};
|
||||
}
|
||||
@ -76,6 +78,51 @@ class PaymentEditPage extends React.Component {
|
||||
Setting.openLinkSafe(this.state.payment.invoiceUrl);
|
||||
}
|
||||
|
||||
renderModal() {
|
||||
const ths = this;
|
||||
const handleChangeMyTag = () => {
|
||||
ths.issueInvoice();
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
this.setState({
|
||||
isModalVisible: false,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal title={
|
||||
<div>
|
||||
<InfoCircleTwoTone twoToneColor="rgb(45,120,213)" />
|
||||
{" " + i18next.t("payment:Confirm your invoice information")}
|
||||
</div>
|
||||
}
|
||||
visible={this.state.isModalVisible}
|
||||
onOk={handleChangeMyTag}
|
||||
onCancel={handleCancel}
|
||||
okText={i18next.t("payment:Issue Invoice")}
|
||||
cancelText={i18next.t("general:Cancel")}>
|
||||
<p>
|
||||
{
|
||||
i18next.t("payment:Please carefully check your invoice information. Once the invoice is issued, it cannot be withdrawn or modified.")
|
||||
}
|
||||
<br/>
|
||||
<br/>
|
||||
<Descriptions size={"small"} bordered>
|
||||
<Descriptions.Item label={i18next.t("payment:Person name")} span={3}>{this.state.payment?.personName}</Descriptions.Item>
|
||||
<Descriptions.Item label={i18next.t("payment:Person ID card")} span={3}>{this.state.payment?.personIdCard}</Descriptions.Item>
|
||||
<Descriptions.Item label={i18next.t("payment:Person Email")} span={3}>{this.state.payment?.personEmail}</Descriptions.Item>
|
||||
<Descriptions.Item label={i18next.t("payment:Person phone")} span={3}>{this.state.payment?.personPhone}</Descriptions.Item>
|
||||
<Descriptions.Item label={i18next.t("payment:Invoice type")} span={3}>{this.state.payment?.invoiceType === "Individual" ? i18next.t("payment:Individual") : i18next.t("payment:Organization")}</Descriptions.Item>
|
||||
<Descriptions.Item label={i18next.t("payment:Invoice title")} span={3}>{this.state.payment?.invoiceTitle}</Descriptions.Item>
|
||||
<Descriptions.Item label={i18next.t("payment:Invoice tax ID")} span={3}>{this.state.payment?.invoiceTaxId}</Descriptions.Item>
|
||||
<Descriptions.Item label={i18next.t("payment:Invoice remark")} span={3}>{this.state.payment?.invoiceRemark}</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</p>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
||||
renderPayment() {
|
||||
return (
|
||||
<Card size="small" title={
|
||||
@ -263,7 +310,7 @@ class PaymentEditPage extends React.Component {
|
||||
</Row>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
{Setting.getLabel(i18next.t("payment:Invoice Tax ID"), i18next.t("payment:Invoice Tax ID - Tooltip"))} :
|
||||
{Setting.getLabel(i18next.t("payment:Invoice tax ID"), i18next.t("payment:Invoice tax ID - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input disabled={this.state.payment.invoiceUrl !== "" || this.state.payment.invoiceType === "Individual"} value={this.state.payment.invoiceTaxId} onChange={e => {
|
||||
@ -298,7 +345,11 @@ class PaymentEditPage extends React.Component {
|
||||
<Col span={22} >
|
||||
{
|
||||
this.state.payment.invoiceUrl === "" ? (
|
||||
<Button type={"primary"} onClick={() => this.issueInvoice()}>{i18next.t("payment:Issue Invoice")}</Button>
|
||||
<Button type={"primary"} onClick={() => {
|
||||
this.setState({
|
||||
isModalVisible: true,
|
||||
});
|
||||
}}>{i18next.t("payment:Issue Invoice")}</Button>
|
||||
) : (
|
||||
<Button type={"primary"} onClick={() => this.downloadInvoice(false)}>{i18next.t("payment:Download Invoice")}</Button>
|
||||
)
|
||||
@ -398,6 +449,9 @@ class PaymentEditPage extends React.Component {
|
||||
{
|
||||
this.state.payment !== null ? this.renderPayment() : null
|
||||
}
|
||||
{
|
||||
this.renderModal()
|
||||
}
|
||||
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
||||
<Button size="large" onClick={() => this.submitPaymentEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||
<Button style={{marginLeft: '20px'}} type="primary" size="large" onClick={() => this.submitPaymentEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||
|
Reference in New Issue
Block a user