Added display of dialogs if the limit on the number of added users has been reached.
This commit is contained in:
parent
9995d9f374
commit
f435cb71a7
@ -180,6 +180,7 @@ const ArticleMainButtonContent = (props) => {
|
||||
|
||||
parentRoomType,
|
||||
isFolder,
|
||||
showWarningDialog,
|
||||
} = props;
|
||||
|
||||
const navigate = useNavigate();
|
||||
@ -283,7 +284,7 @@ const ArticleMainButtonContent = (props) => {
|
||||
const onInvite = React.useCallback((e) => {
|
||||
const type = e.action;
|
||||
|
||||
if (isGracePeriod) {
|
||||
if (showWarningDialog(type)) {
|
||||
setInviteUsersWarningDialogVisible(true);
|
||||
return;
|
||||
}
|
||||
@ -901,6 +902,7 @@ export default inject(
|
||||
versionHistoryStore,
|
||||
userStore,
|
||||
currentTariffStatusStore,
|
||||
currentQuotaStore,
|
||||
}) => {
|
||||
const { showArticleLoader } = clientLoadingStore;
|
||||
const { mainButtonMobileVisible } = filesStore;
|
||||
@ -939,6 +941,7 @@ export default inject(
|
||||
|
||||
const { isAdmin, isOwner, isRoomAdmin } = userStore.user;
|
||||
const { isGracePeriod } = currentTariffStatusStore;
|
||||
const { showWarningDialog } = currentQuotaStore;
|
||||
|
||||
const { setOformFromFolderId, oformsFilter } = oformsStore;
|
||||
const { mainButtonItemsList } = pluginStore;
|
||||
@ -997,6 +1000,8 @@ export default inject(
|
||||
isFolder,
|
||||
selectFileFormRoomDialogVisible,
|
||||
setSelectFileFormRoomDialogVisible,
|
||||
|
||||
showWarningDialog,
|
||||
};
|
||||
},
|
||||
)(
|
||||
|
@ -139,6 +139,7 @@ class ContextOptionsStore {
|
||||
pluginStore;
|
||||
infoPanelStore;
|
||||
currentTariffStatusStore;
|
||||
currentQuotaStore;
|
||||
userStore;
|
||||
clientLoadingStore;
|
||||
|
||||
@ -160,6 +161,7 @@ class ContextOptionsStore {
|
||||
pluginStore,
|
||||
infoPanelStore,
|
||||
currentTariffStatusStore,
|
||||
currentQuotaStore,
|
||||
userStore,
|
||||
clientLoadingStore,
|
||||
) {
|
||||
@ -179,6 +181,7 @@ class ContextOptionsStore {
|
||||
this.pluginStore = pluginStore;
|
||||
this.infoPanelStore = infoPanelStore;
|
||||
this.currentTariffStatusStore = currentTariffStatusStore;
|
||||
this.currentQuotaStore = currentQuotaStore;
|
||||
this.userStore = userStore;
|
||||
this.clientLoadingStore = clientLoadingStore;
|
||||
}
|
||||
@ -2104,7 +2107,7 @@ class ContextOptionsStore {
|
||||
|
||||
const type = e.item["data-type"];
|
||||
|
||||
if (this.currentTariffStatusStore.isGracePeriod) {
|
||||
if (this.currentQuotaStore.showWarningDialog(type)) {
|
||||
setInviteUsersWarningDialogVisible(true);
|
||||
return;
|
||||
}
|
||||
|
@ -234,6 +234,7 @@ const contextOptionsStore = new ContextOptionsStore(
|
||||
pluginStore,
|
||||
infoPanelStore,
|
||||
currentTariffStatusStore,
|
||||
currentQuotaStore,
|
||||
userStore,
|
||||
clientLoadingStore,
|
||||
);
|
||||
|
@ -34,7 +34,7 @@ import {
|
||||
|
||||
import { toastr } from "../components/toast";
|
||||
import { TData } from "../components/toast/Toast.type";
|
||||
import { PortalFeaturesLimitations } from "../enums";
|
||||
import { EmployeeType, PortalFeaturesLimitations } from "../enums";
|
||||
import api from "../api";
|
||||
import { TPaymentFeature, TPaymentQuota } from "../api/portal/types";
|
||||
import {
|
||||
@ -49,19 +49,25 @@ import {
|
||||
} from "../constants";
|
||||
import { Nullable } from "../types";
|
||||
import { UserStore } from "./UserStore";
|
||||
|
||||
import { CurrentTariffStatusStore } from "./CurrentTariffStatusStore";
|
||||
class CurrentQuotasStore {
|
||||
currentPortalQuota: Nullable<TPaymentQuota> = null;
|
||||
|
||||
userStore: UserStore | null = null;
|
||||
|
||||
currentTariffStatusStore: CurrentTariffStatusStore | null = null;
|
||||
|
||||
currentPortalQuotaFeatures: TPaymentFeature[] = [];
|
||||
|
||||
isLoaded = false;
|
||||
|
||||
constructor(userStoreConst: UserStore) {
|
||||
constructor(
|
||||
userStoreConst: UserStore,
|
||||
currentTariffStatusStore: CurrentTariffStatusStore,
|
||||
) {
|
||||
makeAutoObservable(this);
|
||||
this.userStore = userStoreConst;
|
||||
this.currentTariffStatusStore = currentTariffStatusStore;
|
||||
}
|
||||
|
||||
setIsLoaded = (isLoaded: boolean) => {
|
||||
@ -274,6 +280,17 @@ class CurrentQuotasStore {
|
||||
);
|
||||
}
|
||||
|
||||
get isPaidUserLimit() {
|
||||
return this.addedManagersCount >= this.maxCountManagersByQuota;
|
||||
}
|
||||
|
||||
showWarningDialog = (type: number) => {
|
||||
if (type && this.isPaidUserLimit && type !== EmployeeType.Guest)
|
||||
return true;
|
||||
|
||||
return this.currentTariffStatusStore?.isGracePeriod;
|
||||
};
|
||||
|
||||
get showUserPersonalQuotaBar() {
|
||||
const personalQuotaLimitReached = this.userStore?.personalQuotaLimitReached;
|
||||
|
||||
|
@ -36,9 +36,12 @@ import { SettingsStore } from "./SettingsStore";
|
||||
export const userStore = new UserStore();
|
||||
export const tfaStore = new TfaStore();
|
||||
export const bannerStore = new BannerStore();
|
||||
export const currentQuotaStore = new CurrentQuotasStore(userStore);
|
||||
export const paymentQuotasStore = new PaymentQuotasStore();
|
||||
export const currentTariffStatusStore = new CurrentTariffStatusStore();
|
||||
export const currentQuotaStore = new CurrentQuotasStore(
|
||||
userStore,
|
||||
currentTariffStatusStore,
|
||||
);
|
||||
export const settingsStore = new SettingsStore();
|
||||
export const authStore = new AuthStore(
|
||||
userStore,
|
||||
|
Loading…
Reference in New Issue
Block a user