From 943cc434274c8e587798f9eece8c72b364353c52 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Mon, 28 Aug 2023 21:01:23 +0800 Subject: [PATCH] Fix payment list and product edit actions --- web/src/PaymentListPage.js | 32 +++++++++++++++---------------- web/src/ProductEditPage.js | 26 ++++++++++++------------- web/src/backend/PaymentBackend.js | 4 ++-- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/web/src/PaymentListPage.js b/web/src/PaymentListPage.js index 6cd14f43..712e930b 100644 --- a/web/src/PaymentListPage.js +++ b/web/src/PaymentListPage.js @@ -101,6 +101,21 @@ class PaymentListPage extends BaseListPage { ); }, }, + { + title: i18next.t("general:Organization"), + dataIndex: "owner", + key: "owner", + width: "120px", + sorter: true, + ...this.getColumnSearchProps("owner"), + render: (text, record, index) => { + return ( + + {text} + + ); + }, + }, { title: i18next.t("general:Provider"), dataIndex: "provider", @@ -117,21 +132,6 @@ class PaymentListPage extends BaseListPage { ); }, }, - { - title: i18next.t("general:Organization"), - dataIndex: "owner", - key: "owner", - width: "120px", - sorter: true, - ...this.getColumnSearchProps("owner"), - render: (text, record, index) => { - return ( - - {text} - - ); - }, - }, { title: i18next.t("general:User"), dataIndex: "user", @@ -264,7 +264,7 @@ class PaymentListPage extends BaseListPage { value = params.type; } this.setState({loading: true}); - PaymentBackend.getPayments(Setting.getRequestOrganization(this.props.account), Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder) + PaymentBackend.getPayments(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder) .then((res) => { this.setState({ loading: false, diff --git a/web/src/ProductEditPage.js b/web/src/ProductEditPage.js index 792c7d8c..c5c6f14e 100644 --- a/web/src/ProductEditPage.js +++ b/web/src/ProductEditPage.js @@ -107,6 +107,18 @@ class ProductEditPage extends React.Component { {this.state.mode === "add" ? : null} } style={(Setting.isMobile()) ? {margin: "5px"} : {}} type="inner"> + + + {Setting.getLabel(i18next.t("general:Organization"), i18next.t("general:Organization - Tooltip"))} : + + + + + {Setting.getLabel(i18next.t("general:Name"), i18next.t("general:Name - Tooltip"))} : @@ -127,18 +139,6 @@ class ProductEditPage extends React.Component { }} /> - - - {Setting.getLabel(i18next.t("general:Organization"), i18next.t("general:Organization - Tooltip"))} : - - - - - {Setting.getLabel(i18next.t("product:Image"), i18next.t("product:Image - Tooltip"))} : @@ -312,7 +312,7 @@ class ProductEditPage extends React.Component { submitProductEdit(willExist) { const product = Setting.deepCopy(this.state.product); - ProductBackend.updateProduct(this.state.product.owner, this.state.productName, product) + ProductBackend.updateProduct(this.state.organizationName, this.state.productName, product) .then((res) => { if (res.status === "ok") { Setting.showMessage("success", i18next.t("general:Successfully saved")); diff --git a/web/src/backend/PaymentBackend.js b/web/src/backend/PaymentBackend.js index 063d4349..08078f9d 100644 --- a/web/src/backend/PaymentBackend.js +++ b/web/src/backend/PaymentBackend.js @@ -14,8 +14,8 @@ import * as Setting from "../Setting"; -export function getPayments(owner, organization, page = "", pageSize = "", field = "", value = "", sortField = "", sortOrder = "") { - return fetch(`${Setting.ServerUrl}/api/get-payments?owner=${owner}&organization=${organization}&p=${page}&pageSize=${pageSize}&field=${field}&value=${value}&sortField=${sortField}&sortOrder=${sortOrder}`, { +export function getPayments(owner, page = "", pageSize = "", field = "", value = "", sortField = "", sortOrder = "") { + return fetch(`${Setting.ServerUrl}/api/get-payments?owner=${owner}&p=${page}&pageSize=${pageSize}&field=${field}&value=${value}&sortField=${sortField}&sortOrder=${sortOrder}`, { method: "GET", credentials: "include", headers: {