Web: Added the ability to change the tariff by access rights.

This commit is contained in:
Tatiana Lopaeva 2022-09-01 20:26:32 +03:00
parent e9cb9a137f
commit c7d83914ac
3 changed files with 17 additions and 21 deletions

View File

@ -39,20 +39,15 @@ const StyledContainer = styled.div`
}
`;
const PayerInformationContainer = ({
style,
theme,
rights,
accountLink,
}) => {
const PayerInformationContainer = ({ style, theme, user, accountLink }) => {
const { t } = useTranslation("Payments");
const payerName = `${"Test Name" + " (" + t("Payer") + ")"}`;
const email = "example email";
const isLinkAvailable = rights === "3" ? false : true;
const payer = false;
const isLinkAvailable = user.isOwner || payer;
const renderTooltip = () => {
return (
@ -109,19 +104,16 @@ const PayerInformationContainer = ({
};
export default inject(({ auth, payments }) => {
const { quota, portalQuota } = auth;
const { quota, portalQuota, userStore } = auth;
const { accountLink } = payments;
//const rights = "2";
//const rights = "3";
const rights = "1";
const { user } = userStore;
return {
quota,
portalQuota,
theme: auth.settingsStore.theme,
rights,
user,
accountLink,
};
})(observer(PayerInformationContainer));

View File

@ -34,7 +34,7 @@ let timeout = null,
const PriceCalculation = ({
t,
rights,
user,
theme,
setPaymentLink,
portalQuota,
@ -115,7 +115,10 @@ const PriceCalculation = ({
}, 1000);
};
const isDisabled = rights === "3" || rights === "2" ? true : false;
const payer = false;
const isDisabled = isFreeTariff
? false
: (!user.isOwner && !user.isAdmin) || !payer;
const color = isDisabled ? { color: theme.text.disableColor } : {};
@ -151,15 +154,13 @@ export default inject(({ auth, payments }) => {
maxAvailableManagersCount,
} = payments;
const { theme } = auth.settingsStore;
const { portalQuota, pricePerManager, isFreeTariff } = auth;
//const rights = "2";
//const rights = "3";
const rights = "1";
const { userStore, portalQuota, pricePerManager, isFreeTariff } = auth;
const { user } = userStore;
return {
isFreeTariff,
setManagersCount,
tariffsInfo,
rights,
theme,
setPaymentLink,
portalQuota,
@ -169,5 +170,6 @@ export default inject(({ auth, payments }) => {
maxManagersCount,
minAvailableManagersCount,
maxAvailableManagersCount,
user,
};
})(observer(PriceCalculation));

View File

@ -174,7 +174,9 @@ const PaymentsPage = ({
)}
{!isFreeTariff && <PayerInformationContainer />}
<CurrentTariffContainer />
{isNotPaid ? (
<Text
noSelect