diff --git a/web/ASC.Web.Client/src/components/pages/PaymentsEnterprise/index.js b/web/ASC.Web.Client/src/components/pages/PaymentsEnterprise/index.js index 09e219651f..0d05894166 100644 --- a/web/ASC.Web.Client/src/components/pages/PaymentsEnterprise/index.js +++ b/web/ASC.Web.Client/src/components/pages/PaymentsEnterprise/index.js @@ -10,7 +10,10 @@ import HeaderContainer from "./sub-components/header-container"; import AdvantagesContainer from "./sub-components/advantages-container"; import ButtonContainer from "./sub-components/button-container"; import ContactContainer from "./sub-components/contact-container"; -import { setLicense, getSettings } from "../../../store/payments/actions"; +import { + setLicense, + getSettingsPayment, +} from "../../../store/payments/actions"; import { createI18N } from "../../../helpers/i18n"; const i18n = createI18N({ @@ -51,25 +54,22 @@ class Body extends React.PureComponent { componentDidMount() { const { - getSettings, - + getSettingsPayment, currentProductId, setCurrentProductId, } = this.props; currentProductId !== "payments" && setCurrentProductId("payments"); - // getSettings(); - // getStandalone(); - //getCurrentLicense(); + getSettingsPayment(); } componentDidUpdate(prevProps) { - const { getSettings } = this.props; + const { getSettingsPayment, currentProductId } = this.props; const { isLicenseSet } = this.state; // if (currentProductId !== prevProps.currentProductId) { // this.fetchData(currentProductId); // } if (isLicenseSet) { - getSettings(); + getSettingsPayment(); } } @@ -98,12 +98,6 @@ class Body extends React.PureComponent { window.open(e.target.value, "_blank"); }; - onCloseModalDialog = () => { - this.setState({ - isVisibleModalDialog: false, - }); - }; - render() { const { isLoaded, t } = this.props; @@ -148,5 +142,5 @@ function mapStateToProps(state) { export default connect(mapStateToProps, { setLicense, setCurrentProductId, - getSettings, + getSettingsPayment, })(withRouter(PaymentsEnterprise)); diff --git a/web/ASC.Web.Client/src/components/pages/PaymentsEnterprise/sub-components/header-container.js b/web/ASC.Web.Client/src/components/pages/PaymentsEnterprise/sub-components/header-container.js index 28683520e8..87d21ac83d 100644 --- a/web/ASC.Web.Client/src/components/pages/PaymentsEnterprise/sub-components/header-container.js +++ b/web/ASC.Web.Client/src/components/pages/PaymentsEnterprise/sub-components/header-container.js @@ -59,17 +59,13 @@ const HeaderContainer = ({ require("moment/min/locales.min"); moment.locale(culture); const currentUserDate = moment().utcOffset(utcHoursOffset); - console.log(typeof expiresDate); - return moment( - moment.utc(expiresDate).set("hour", 0).set("minute", 0).set("second", 0) - ).isAfter( - currentUserDate.set("hour", 0).set("minute", 0).set("second", 0) - ) ? ( + + return new Date(currentUserDate).setHours(0, 0, 0, 0) < + expiresDate.setHours(0, 0, 0, 0) ? ( {t("Using")} - {t("SubscriptionAndUpdatesExpires")}{" "} - {moment.utc(expiresDate).format("LL")} + {t("SubscriptionAndUpdatesExpires")} {moment(expiresDate).format("LL")} {"."} @@ -79,7 +75,7 @@ const HeaderContainer = ({ {t("SupportNotAvailable")}{" "} - {moment.utc(expiresDate).startOf("day").format("ddd, D MMMM , YYYY")} + {moment(expiresDate).startOf("day").format("ddd, D MMMM , YYYY")} {". "} {t("LicenseRenewal")} diff --git a/web/ASC.Web.Client/src/store/payments/actions.js b/web/ASC.Web.Client/src/store/payments/actions.js index 6d6ae75505..fc17aa2d29 100644 --- a/web/ASC.Web.Client/src/store/payments/actions.js +++ b/web/ASC.Web.Client/src/store/payments/actions.js @@ -1,19 +1,22 @@ import { api } from "asc-web-common"; -export const SET_SALES_EMAIL = "SET_SALES_EMAIL"; -export const SET_HELP_URL = "SET_HELP_URL"; -export const SET_BUY_URL = "SET_BUY_URL"; -export const SET_CURRENT_LICENSE = "SET_CURRENT_LICENSE"; -export const SET_SETTINGS = "SET_SETTINGS"; -export const SET_STANDALONE = "SET_STANDALONE"; +export const SET_SETTINGS_PAYMENTS_ENTERPRISE = + "SET_SETTINGS_PAYMENTS_ENTERPRISE"; export function setSettings(settings) { return { - type: SET_SETTINGS, + type: SET_SETTINGS_PAYMENTS_ENTERPRISE, settings, }; } +export function getSettingsPayment() { + return (dispatch) => { + return api.settings.getPaymentSettings().then((settings) => { + dispatch(setSettings(settings)); + }); + }; +} export function setLicense(confirmKey, data) { return (dispatch) => { return api.settings @@ -21,11 +24,3 @@ export function setLicense(confirmKey, data) { .then((res) => console.log(res)); }; } - -export function getSettings() { - return (dispatch) => { - return api.settings.getPaymentSettings().then((settings) => { - dispatch(setSettings(settings)); - }); - }; -} diff --git a/web/ASC.Web.Client/src/store/payments/reducer.js b/web/ASC.Web.Client/src/store/payments/reducer.js index f1fa3a6ad3..52e6b950ef 100644 --- a/web/ASC.Web.Client/src/store/payments/reducer.js +++ b/web/ASC.Web.Client/src/store/payments/reducer.js @@ -1,29 +1,31 @@ -import { SET_SETTINGS } from "./actions"; +import { SET_SETTINGS_PAYMENTS_ENTERPRISE } from "./actions"; const initialState = { - salesEmail: "", - helpUrl: "", - buyUrl: "", + salesEmail: "sales@onlyoffice.com", + helpUrl: "https://helpdesk.onlyoffice.com", + buyUrl: + "https://www.onlyoffice.com/enterprise-edition.aspx?type=buyenterprise", standaloneMode: true, currentLicense: { - expiresDate: new Date("2021-10-01T23:59:59.000Z"), + expiresDate: new Date("2021-09-14T01:59:59"), trialMode: false, }, }; const paymentsReducer = (state = initialState, action) => { switch (action.type) { - case SET_SETTINGS: + case SET_SETTINGS_PAYMENTS_ENTERPRISE: return Object.assign({}, state, { salesEmail: action.settings.salesEmail, helpUrl: action.settings.feedbackAndSupportUrl, buyUrl: action.settings.buyUrl, standaloneMode: action.settings.standaloneMode, currentLicense: Object.assign({}, state.currentLicense, { - expiresDate: action.settings.currentLicense.date, + expiresDate: new Date(action.settings.currentLicense.date), trialMode: action.settings.currentLicense.trial, }), }); + default: return state; }