diff --git a/packages/client/public/locales/en/Payments.json b/packages/client/public/locales/en/Payments.json index ff1ea19570..e1cb700a40 100644 --- a/packages/client/public/locales/en/Payments.json +++ b/packages/client/public/locales/en/Payments.json @@ -16,7 +16,7 @@ "DowngradeNow": "Downgrade now", "FreeStartupPlan": "Free {{planName}} plan", "GracePeriodActivated": "Grace period activated", - "GracePeriodActivatedDescription": "Grace period is effective from <1>{{fromDate}} to <1>{{byDate}} ({{delayDaysCount}}). During the grace period, admins cannot create new rooms and add new users. After the due date of the grace period, DocSpace will become unavailable until the payment is made.", + "GracePeriodActivatedDescription": "Grace period is effective from <1>{{fromDate}} to <2>{{byDate}} ({{delayDaysCount}}). <6>During the grace period, admins cannot create new rooms and add new users. After the due date of the grace period, DocSpace will become unavailable until the payment is made.", "InvalidEmail": "Invalid email", "LatePayment": "Late payment", "ManagerTypesDescription": "Admin account types and their privileges", @@ -38,5 +38,7 @@ "TotalPricePerMonth": "<1>{{currencySymbol}}<2>{{price}}<3>/month", "UpgradeNow": "Upgrade now", "UserNotFound": "User <1>«{{email}}» is not found", - "YourPrice": "Your price" + "YourPrice": "Your price", + "PaymentOverdue": "Cannot add new users. Business plan payment overdue", + "UpgradePlan": "Upgrade plan" } diff --git a/packages/client/public/locales/ru/Payments.json b/packages/client/public/locales/ru/Payments.json index dc53825073..f39777a1e6 100644 --- a/packages/client/public/locales/ru/Payments.json +++ b/packages/client/public/locales/ru/Payments.json @@ -15,7 +15,7 @@ "DowngradeNow": "Понизить прямо сейчас", "FreeStartupPlan": "Бесплатный {{planName}} план", "GracePeriodActivated": "Активирован льготный период", - "GracePeriodActivatedDescription": "Льготный период действует с <1>{{fromDate}} по <1>{{byDate}} ({{delayDaysCount}}). В течение льготного периода администраторы не могут создавать новые комнаты и добавлять новых пользователей. По истечении срока действия льготного периода DocSpace станет недоступным до тех пор, пока не будет произведен платеж.", + "GracePeriodActivatedDescription": "Льготный период действует с <1>{{fromDate}} по <2>{{byDate}} ({{delayDaysCount}}). <6>В течение льготного периода администраторы не могут создавать новые комнаты и добавлять новых пользователей. По истечении срока действия льготного периода DocSpace станет недоступным до тех пор, пока не будет произведен платеж.", "InvalidEmail": "Неверный email", "LatePayment": "Просрочка платежа", "ManagerTypesDescription": "Типы учетных записей администратора и их привилегии", diff --git a/packages/client/src/components/FilesPanels/index.js b/packages/client/src/components/FilesPanels/index.js index aca80e5acd..0b05bececa 100644 --- a/packages/client/src/components/FilesPanels/index.js +++ b/packages/client/src/components/FilesPanels/index.js @@ -23,6 +23,7 @@ import { ConflictResolveDialog, ConvertDialog, CreateRoomDialog, + InviteUsersWarningDialog, } from "../dialogs"; import ConvertPasswordDialog from "../dialogs/ConvertPasswordDialog"; import RestoreAllArchiveDialog from "../dialogs/RestoreAllArchiveDialog"; @@ -54,6 +55,7 @@ const Panels = (props) => { createRoomDialogVisible, restoreAllPanelVisible, restoreAllArchiveDialogVisible, + inviteUsersWarningDialogVisible, } = props; const { t } = useTranslation(["Translations", "SelectFile"]); @@ -122,6 +124,9 @@ const Panels = (props) => { restoreAllArchiveDialogVisible && ( ), + inviteUsersWarningDialogVisible && ( + + ), ]; }; @@ -152,6 +157,7 @@ export default inject( selectFileDialogVisible, setSelectFileDialogVisible, invitePanelOptions, + inviteUsersWarningDialogVisible, } = dialogsStore; const { uploadPanelVisible } = uploadDataStore; @@ -184,6 +190,7 @@ export default inject( restoreAllPanelVisible, invitePanelVisible: invitePanelOptions.visible, restoreAllArchiveDialogVisible, + inviteUsersWarningDialogVisible, }; } )(observer(Panels)); diff --git a/packages/client/src/components/dialogs/InviteUsersWarningDialog/index.js b/packages/client/src/components/dialogs/InviteUsersWarningDialog/index.js new file mode 100644 index 0000000000..4943432888 --- /dev/null +++ b/packages/client/src/components/dialogs/InviteUsersWarningDialog/index.js @@ -0,0 +1,126 @@ +import React, { useState, useEffect } from "react"; +import { inject, observer } from "mobx-react"; +import { withTranslation, Trans } from "react-i18next"; +import { withRouter } from "react-router"; +import moment from "moment"; +import { combineUrl } from "@docspace/common/utils"; +import AppServerConfig from "@docspace/common/constants/AppServerConfig"; +import ModalDialog from "@docspace/components/modal-dialog"; +import Button from "@docspace/components/button"; +import Text from "@docspace/components/text"; + +const PROXY_BASE_URL = combineUrl(AppServerConfig.proxyURL, "/portal-settings"); + +const InviteUsersWarningDialog = (props) => { + const { + t, + tReady, + history, + language, + dueDate, + delayDueDate, + visible, + setInviteUsersWarningDialogVisible, + } = props; + + const [datesData, setDatesData] = useState({}); + + const { fromDate, byDate, delayDaysCount } = datesData; + + useEffect(() => { + moment.locale(language); + + gracePeriodDays(); + }, [language, gracePeriodDays]); + + const gracePeriodDays = () => { + const fromDateMoment = moment(dueDate); + const byDateMoment = moment(delayDueDate); + + setDatesData({ + fromDate: fromDateMoment.format("LL"), + byDate: byDateMoment.format("LL"), + delayDaysCount: fromDateMoment.to(byDateMoment, true), + }); + }; + + const onClose = () => setInviteUsersWarningDialogVisible(false); + + const onUpgradePlan = () => { + onClose(); + + const paymentPageUrl = combineUrl( + PROXY_BASE_URL, + "/payments/portal-payments" + ); + history.push(paymentPageUrl); + }; + + return ( + + {t("Common:Warning")} + + + {t("PaymentOverdue")} + +
+ + + Grace period activated from {{ fromDate }} + {{ byDate }}({{ delayDaysCount }}) +

+ During the grace period, admins cannot create new rooms and add + new users. After the due date of the grace period, DocSpace will + become unavailable until the payment is made. +

+
+
+
+ +