mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +08:00
Add InvoicePayment() API.
This commit is contained in:
@ -62,6 +62,20 @@ class PaymentEditPage extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
issueInvoice() {
|
||||
const errorText = this.checkError();
|
||||
if (errorText !== "") {
|
||||
Setting.showMessage("error", errorText);
|
||||
return;
|
||||
}
|
||||
|
||||
alert("111")
|
||||
}
|
||||
|
||||
downloadInvoice() {
|
||||
Setting.openLinkSafe(this.state.payment.invoiceUrl);
|
||||
}
|
||||
|
||||
renderPayment() {
|
||||
return (
|
||||
<Card size="small" title={
|
||||
@ -177,7 +191,7 @@ class PaymentEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("payment:Person name"), i18next.t("payment:Person name - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input value={this.state.payment.personName} onChange={e => {
|
||||
<Input disabled={this.state.payment.invoiceUrl !== ""} value={this.state.payment.personName} onChange={e => {
|
||||
this.updatePaymentField('personName', e.target.value);
|
||||
if (this.state.payment.invoiceType === "Individual") {
|
||||
this.updatePaymentField('invoiceTitle', e.target.value);
|
||||
@ -191,7 +205,7 @@ class PaymentEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("payment:Person ID card"), i18next.t("payment:Person ID card - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input value={this.state.payment.personIdCard} onChange={e => {
|
||||
<Input disabled={this.state.payment.invoiceUrl !== ""} value={this.state.payment.personIdCard} onChange={e => {
|
||||
this.updatePaymentField('personIdCard', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
@ -201,7 +215,7 @@ class PaymentEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("payment:Person Email"), i18next.t("payment:Person Email - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input value={this.state.payment.personEmail} onChange={e => {
|
||||
<Input disabled={this.state.payment.invoiceUrl !== ""} value={this.state.payment.personEmail} onChange={e => {
|
||||
this.updatePaymentField('personEmail', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
@ -211,7 +225,7 @@ class PaymentEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("payment:Person phone"), i18next.t("payment:Person phone - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input value={this.state.payment.personPhone} onChange={e => {
|
||||
<Input disabled={this.state.payment.invoiceUrl !== ""} value={this.state.payment.personPhone} onChange={e => {
|
||||
this.updatePaymentField('personPhone', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
@ -221,7 +235,7 @@ class PaymentEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("payment:Invoice type"), i18next.t("payment:Invoice type - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Select virtual={false} style={{width: '100%'}} value={this.state.payment.invoiceType} onChange={(value => {
|
||||
<Select disabled={this.state.payment.invoiceUrl !== ""} virtual={false} style={{width: '100%'}} value={this.state.payment.invoiceType} onChange={(value => {
|
||||
this.updatePaymentField('invoiceType', value);
|
||||
if (value === "Individual") {
|
||||
this.updatePaymentField('invoiceTitle', this.state.payment.personName);
|
||||
@ -242,7 +256,7 @@ class PaymentEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("payment:Invoice title"), i18next.t("payment:Invoice title - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input disabled={this.state.payment.invoiceType === "Individual"} value={this.state.payment.invoiceTitle} onChange={e => {
|
||||
<Input disabled={this.state.payment.invoiceUrl !== "" || this.state.payment.invoiceType === "Individual"} value={this.state.payment.invoiceTitle} onChange={e => {
|
||||
this.updatePaymentField('invoiceTitle', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
@ -252,7 +266,7 @@ class PaymentEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("payment:Invoice Tax ID"), i18next.t("payment:Invoice Tax ID - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input disabled={this.state.payment.invoiceType === "Individual"} value={this.state.payment.invoiceTaxId} onChange={e => {
|
||||
<Input disabled={this.state.payment.invoiceUrl !== "" || this.state.payment.invoiceType === "Individual"} value={this.state.payment.invoiceTaxId} onChange={e => {
|
||||
this.updatePaymentField('invoiceTaxId', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
@ -262,11 +276,35 @@ class PaymentEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("payment:Invoice remark"), i18next.t("payment:Invoice remark - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input value={this.state.payment.invoiceRemark} onChange={e => {
|
||||
<Input disabled={this.state.payment.invoiceUrl !== ""} value={this.state.payment.invoiceRemark} onChange={e => {
|
||||
this.updatePaymentField('invoiceRemark', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
{Setting.getLabel(i18next.t("payment:Invoice URL"), i18next.t("payment:Invoice URL - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input disabled={true} value={this.state.payment.invoiceUrl} onChange={e => {
|
||||
this.updatePaymentField('invoiceUrl', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
{Setting.getLabel(i18next.t("payment:Invoice actions"), i18next.t("payment:Invoice actions - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
{
|
||||
this.state.payment.invoiceUrl === "" ? (
|
||||
<Button type={"primary"} onClick={() => this.issueInvoice()}>{i18next.t("payment:Issue Invoice")}</Button>
|
||||
) : (
|
||||
<Button type={"primary"} onClick={() => this.downloadInvoice(false)}>{i18next.t("payment:Download Invoice")}</Button>
|
||||
)
|
||||
}
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
@ -293,7 +331,7 @@ class PaymentEditPage extends React.Component {
|
||||
}
|
||||
|
||||
if (this.state.payment.invoiceType === "Individual") {
|
||||
if (this.state.payment.invoiceTitle !== "") {
|
||||
if (this.state.payment.invoiceTitle !== this.state.payment.personName) {
|
||||
return i18next.t("signup:The input is not invoice title!");
|
||||
}
|
||||
|
||||
@ -301,7 +339,7 @@ class PaymentEditPage extends React.Component {
|
||||
return i18next.t("signup:The input is not invoice Tax ID!");
|
||||
}
|
||||
} else {
|
||||
if (!Setting.isValidInvoiceTitle(this.state.payment.invoiceTitle)) {
|
||||
if (this.state.payment.invoiceTitle === "" || !Setting.isValidInvoiceTitle(this.state.payment.invoiceTitle)) {
|
||||
return i18next.t("signup:The input is not invoice title!");
|
||||
}
|
||||
|
||||
|
@ -300,6 +300,15 @@ export function openLink(link) {
|
||||
w.location.href = link;
|
||||
}
|
||||
|
||||
export function openLinkSafe(link) {
|
||||
// Javascript window.open issue in safari
|
||||
// https://stackoverflow.com/questions/45569893/javascript-window-open-issue-in-safari
|
||||
let a = document.createElement('a');
|
||||
a.href = link;
|
||||
a.setAttribute('target', '_blank');
|
||||
a.click();
|
||||
}
|
||||
|
||||
export function goToLink(link) {
|
||||
window.location.href = link;
|
||||
}
|
||||
|
@ -260,16 +260,22 @@
|
||||
"payment": {
|
||||
"Currency": "Currency",
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Download Invoice": "Download Invoice",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"Individual": "Individual",
|
||||
"Invoice Tax ID": "Invoice Tax ID",
|
||||
"Invoice Tax ID - Tooltip": "Invoice Tax ID - Tooltip",
|
||||
"Invoice URL": "Invoice URL",
|
||||
"Invoice URL - Tooltip": "Invoice URL - Tooltip",
|
||||
"Invoice actions": "Invoice actions",
|
||||
"Invoice actions - Tooltip": "Invoice actions - Tooltip",
|
||||
"Invoice remark": "Invoice remark",
|
||||
"Invoice remark - Tooltip": "Invoice remark - Tooltip",
|
||||
"Invoice title": "Invoice title",
|
||||
"Invoice title - Tooltip": "Invoice title - Tooltip",
|
||||
"Invoice type": "Invoice type",
|
||||
"Invoice type - Tooltip": "Invoice type - Tooltip",
|
||||
"Issue Invoice": "Issue Invoice",
|
||||
"Message": "Message",
|
||||
"Message - Tooltip": "Message - Tooltip",
|
||||
"New Payment": "New Payment",
|
||||
|
@ -260,16 +260,22 @@
|
||||
"payment": {
|
||||
"Currency": "Currency",
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Download Invoice": "Download Invoice",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"Individual": "Individual",
|
||||
"Invoice Tax ID": "Invoice Tax ID",
|
||||
"Invoice Tax ID - Tooltip": "Invoice Tax ID - Tooltip",
|
||||
"Invoice URL": "Invoice URL",
|
||||
"Invoice URL - Tooltip": "Invoice URL - Tooltip",
|
||||
"Invoice actions": "Invoice actions",
|
||||
"Invoice actions - Tooltip": "Invoice actions - Tooltip",
|
||||
"Invoice remark": "Invoice remark",
|
||||
"Invoice remark - Tooltip": "Invoice remark - Tooltip",
|
||||
"Invoice title": "Invoice title",
|
||||
"Invoice title - Tooltip": "Invoice title - Tooltip",
|
||||
"Invoice type": "Invoice type",
|
||||
"Invoice type - Tooltip": "Invoice type - Tooltip",
|
||||
"Issue Invoice": "Issue Invoice",
|
||||
"Message": "Message",
|
||||
"Message - Tooltip": "Message - Tooltip",
|
||||
"New Payment": "New Payment",
|
||||
|
@ -260,16 +260,22 @@
|
||||
"payment": {
|
||||
"Currency": "Currency",
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Download Invoice": "Download Invoice",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"Individual": "Individual",
|
||||
"Invoice Tax ID": "Invoice Tax ID",
|
||||
"Invoice Tax ID - Tooltip": "Invoice Tax ID - Tooltip",
|
||||
"Invoice URL": "Invoice URL",
|
||||
"Invoice URL - Tooltip": "Invoice URL - Tooltip",
|
||||
"Invoice actions": "Invoice actions",
|
||||
"Invoice actions - Tooltip": "Invoice actions - Tooltip",
|
||||
"Invoice remark": "Invoice remark",
|
||||
"Invoice remark - Tooltip": "Invoice remark - Tooltip",
|
||||
"Invoice title": "Invoice title",
|
||||
"Invoice title - Tooltip": "Invoice title - Tooltip",
|
||||
"Invoice type": "Invoice type",
|
||||
"Invoice type - Tooltip": "Invoice type - Tooltip",
|
||||
"Issue Invoice": "Issue Invoice",
|
||||
"Message": "Message",
|
||||
"Message - Tooltip": "Message - Tooltip",
|
||||
"New Payment": "New Payment",
|
||||
|
@ -260,16 +260,22 @@
|
||||
"payment": {
|
||||
"Currency": "Currency",
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Download Invoice": "Download Invoice",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"Individual": "Individual",
|
||||
"Invoice Tax ID": "Invoice Tax ID",
|
||||
"Invoice Tax ID - Tooltip": "Invoice Tax ID - Tooltip",
|
||||
"Invoice URL": "Invoice URL",
|
||||
"Invoice URL - Tooltip": "Invoice URL - Tooltip",
|
||||
"Invoice actions": "Invoice actions",
|
||||
"Invoice actions - Tooltip": "Invoice actions - Tooltip",
|
||||
"Invoice remark": "Invoice remark",
|
||||
"Invoice remark - Tooltip": "Invoice remark - Tooltip",
|
||||
"Invoice title": "Invoice title",
|
||||
"Invoice title - Tooltip": "Invoice title - Tooltip",
|
||||
"Invoice type": "Invoice type",
|
||||
"Invoice type - Tooltip": "Invoice type - Tooltip",
|
||||
"Issue Invoice": "Issue Invoice",
|
||||
"Message": "Message",
|
||||
"Message - Tooltip": "Message - Tooltip",
|
||||
"New Payment": "New Payment",
|
||||
|
@ -260,16 +260,22 @@
|
||||
"payment": {
|
||||
"Currency": "Currency",
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Download Invoice": "Download Invoice",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"Individual": "Individual",
|
||||
"Invoice Tax ID": "Invoice Tax ID",
|
||||
"Invoice Tax ID - Tooltip": "Invoice Tax ID - Tooltip",
|
||||
"Invoice URL": "Invoice URL",
|
||||
"Invoice URL - Tooltip": "Invoice URL - Tooltip",
|
||||
"Invoice actions": "Invoice actions",
|
||||
"Invoice actions - Tooltip": "Invoice actions - Tooltip",
|
||||
"Invoice remark": "Invoice remark",
|
||||
"Invoice remark - Tooltip": "Invoice remark - Tooltip",
|
||||
"Invoice title": "Invoice title",
|
||||
"Invoice title - Tooltip": "Invoice title - Tooltip",
|
||||
"Invoice type": "Invoice type",
|
||||
"Invoice type - Tooltip": "Invoice type - Tooltip",
|
||||
"Issue Invoice": "Issue Invoice",
|
||||
"Message": "Message",
|
||||
"Message - Tooltip": "Message - Tooltip",
|
||||
"New Payment": "New Payment",
|
||||
|
@ -260,16 +260,22 @@
|
||||
"payment": {
|
||||
"Currency": "Currency",
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Download Invoice": "Download Invoice",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"Individual": "Individual",
|
||||
"Invoice Tax ID": "Invoice Tax ID",
|
||||
"Invoice Tax ID - Tooltip": "Invoice Tax ID - Tooltip",
|
||||
"Invoice URL": "Invoice URL",
|
||||
"Invoice URL - Tooltip": "Invoice URL - Tooltip",
|
||||
"Invoice actions": "Invoice actions",
|
||||
"Invoice actions - Tooltip": "Invoice actions - Tooltip",
|
||||
"Invoice remark": "Invoice remark",
|
||||
"Invoice remark - Tooltip": "Invoice remark - Tooltip",
|
||||
"Invoice title": "Invoice title",
|
||||
"Invoice title - Tooltip": "Invoice title - Tooltip",
|
||||
"Invoice type": "Invoice type",
|
||||
"Invoice type - Tooltip": "Invoice type - Tooltip",
|
||||
"Issue Invoice": "Issue Invoice",
|
||||
"Message": "Message",
|
||||
"Message - Tooltip": "Message - Tooltip",
|
||||
"New Payment": "New Payment",
|
||||
|
@ -260,16 +260,22 @@
|
||||
"payment": {
|
||||
"Currency": "币种",
|
||||
"Currency - Tooltip": "如USD(美元),CNY(人民币)等",
|
||||
"Download Invoice": "下载发票",
|
||||
"Edit Payment": "编辑付款",
|
||||
"Individual": "个人",
|
||||
"Invoice Tax ID": "纳税人识别号",
|
||||
"Invoice Tax ID - Tooltip": "开票类型为单位时,必须输入单位纳税人识别号;开票类型为个人时,不需要填写",
|
||||
"Invoice URL": "发票URL",
|
||||
"Invoice URL - Tooltip": "发票的下载地址URL",
|
||||
"Invoice actions": "发票操作",
|
||||
"Invoice actions - Tooltip": "操作包含开具发票和下载发票两种",
|
||||
"Invoice remark": "发票备注",
|
||||
"Invoice remark - Tooltip": "备注不超过50个字",
|
||||
"Invoice title": "发票抬头",
|
||||
"Invoice title - Tooltip": "开票类型为单位时,发票抬头可输入单位名称;开票类型为个人时,系统自动填写为缴费人姓名",
|
||||
"Invoice type": "开票类型",
|
||||
"Invoice type - Tooltip": "开票类型可以为个人或者单位",
|
||||
"Issue Invoice": "开具发票",
|
||||
"Message": "消息",
|
||||
"Message - Tooltip": "付款处理结果消息",
|
||||
"New Payment": "添加付款",
|
||||
|
Reference in New Issue
Block a user