Web: Added the ability to change the tariff by access rights.
This commit is contained in:
parent
e9cb9a137f
commit
c7d83914ac
@ -39,20 +39,15 @@ const StyledContainer = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const PayerInformationContainer = ({
|
const PayerInformationContainer = ({ style, theme, user, accountLink }) => {
|
||||||
style,
|
|
||||||
theme,
|
|
||||||
rights,
|
|
||||||
|
|
||||||
accountLink,
|
|
||||||
}) => {
|
|
||||||
const { t } = useTranslation("Payments");
|
const { t } = useTranslation("Payments");
|
||||||
|
|
||||||
const payerName = `${"Test Name" + " (" + t("Payer") + ")"}`;
|
const payerName = `${"Test Name" + " (" + t("Payer") + ")"}`;
|
||||||
|
|
||||||
const email = "example email";
|
const email = "example email";
|
||||||
|
|
||||||
const isLinkAvailable = rights === "3" ? false : true;
|
const payer = false;
|
||||||
|
const isLinkAvailable = user.isOwner || payer;
|
||||||
|
|
||||||
const renderTooltip = () => {
|
const renderTooltip = () => {
|
||||||
return (
|
return (
|
||||||
@ -109,19 +104,16 @@ const PayerInformationContainer = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ auth, payments }) => {
|
export default inject(({ auth, payments }) => {
|
||||||
const { quota, portalQuota } = auth;
|
const { quota, portalQuota, userStore } = auth;
|
||||||
const { accountLink } = payments;
|
const { accountLink } = payments;
|
||||||
|
|
||||||
//const rights = "2";
|
const { user } = userStore;
|
||||||
//const rights = "3";
|
|
||||||
const rights = "1";
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
quota,
|
quota,
|
||||||
portalQuota,
|
portalQuota,
|
||||||
theme: auth.settingsStore.theme,
|
theme: auth.settingsStore.theme,
|
||||||
rights,
|
user,
|
||||||
|
|
||||||
accountLink,
|
accountLink,
|
||||||
};
|
};
|
||||||
})(observer(PayerInformationContainer));
|
})(observer(PayerInformationContainer));
|
||||||
|
@ -34,7 +34,7 @@ let timeout = null,
|
|||||||
|
|
||||||
const PriceCalculation = ({
|
const PriceCalculation = ({
|
||||||
t,
|
t,
|
||||||
rights,
|
user,
|
||||||
theme,
|
theme,
|
||||||
setPaymentLink,
|
setPaymentLink,
|
||||||
portalQuota,
|
portalQuota,
|
||||||
@ -115,7 +115,10 @@ const PriceCalculation = ({
|
|||||||
}, 1000);
|
}, 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 } : {};
|
const color = isDisabled ? { color: theme.text.disableColor } : {};
|
||||||
|
|
||||||
@ -151,15 +154,13 @@ export default inject(({ auth, payments }) => {
|
|||||||
maxAvailableManagersCount,
|
maxAvailableManagersCount,
|
||||||
} = payments;
|
} = payments;
|
||||||
const { theme } = auth.settingsStore;
|
const { theme } = auth.settingsStore;
|
||||||
const { portalQuota, pricePerManager, isFreeTariff } = auth;
|
const { userStore, portalQuota, pricePerManager, isFreeTariff } = auth;
|
||||||
//const rights = "2";
|
const { user } = userStore;
|
||||||
//const rights = "3";
|
|
||||||
const rights = "1";
|
|
||||||
return {
|
return {
|
||||||
isFreeTariff,
|
isFreeTariff,
|
||||||
setManagersCount,
|
setManagersCount,
|
||||||
tariffsInfo,
|
tariffsInfo,
|
||||||
rights,
|
|
||||||
theme,
|
theme,
|
||||||
setPaymentLink,
|
setPaymentLink,
|
||||||
portalQuota,
|
portalQuota,
|
||||||
@ -169,5 +170,6 @@ export default inject(({ auth, payments }) => {
|
|||||||
maxManagersCount,
|
maxManagersCount,
|
||||||
minAvailableManagersCount,
|
minAvailableManagersCount,
|
||||||
maxAvailableManagersCount,
|
maxAvailableManagersCount,
|
||||||
|
user,
|
||||||
};
|
};
|
||||||
})(observer(PriceCalculation));
|
})(observer(PriceCalculation));
|
||||||
|
@ -174,7 +174,9 @@ const PaymentsPage = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{!isFreeTariff && <PayerInformationContainer />}
|
{!isFreeTariff && <PayerInformationContainer />}
|
||||||
|
|
||||||
<CurrentTariffContainer />
|
<CurrentTariffContainer />
|
||||||
|
|
||||||
{isNotPaid ? (
|
{isNotPaid ? (
|
||||||
<Text
|
<Text
|
||||||
noSelect
|
noSelect
|
||||||
|
Loading…
Reference in New Issue
Block a user