Added setLiscense, some translations and changed action for payments
This commit is contained in:
parent
07f9344496
commit
58054d1d91
@ -12,8 +12,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 } from "../../../store/payments/actions";
|
||||
import { resetLicenseUploaded } from "../../../store/wizard/actions";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "PaymentsEnterprise",
|
||||
localesPath: "pages/PaymentsEnterprise",
|
||||
@ -36,7 +38,16 @@ const StyledBody = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const Body = ({ standAloneMode, isLoaded, salesEmail, helpUrl, buyUrl }) => {
|
||||
const Body = ({
|
||||
isLoaded,
|
||||
salesEmail,
|
||||
helpUrl,
|
||||
buyUrl,
|
||||
dateExpires,
|
||||
hasErrorLicense,
|
||||
licenseUpload,
|
||||
wizardToken,
|
||||
}) => {
|
||||
const { t } = useTranslation("translation", { i18n });
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
@ -47,9 +58,13 @@ const Body = ({ standAloneMode, isLoaded, salesEmail, helpUrl, buyUrl }) => {
|
||||
<Loader className="pageLoader" type="rombs" size="40px" />
|
||||
) : (
|
||||
<StyledBody>
|
||||
<HeaderContainer t={t} />
|
||||
<HeaderContainer t={t} dateExpires={dateExpires} />
|
||||
<AdvantagesContainer t={t} />
|
||||
<ButtonContainer t={t} buyUrl={buyUrl} />
|
||||
<ButtonContainer
|
||||
t={t}
|
||||
buyUrl={buyUrl}
|
||||
hasErrorLicense={hasErrorLicense}
|
||||
/>
|
||||
<ContactContainer t={t} salesEmail={salesEmail} helpUrl={helpUrl} />
|
||||
</StyledBody>
|
||||
);
|
||||
@ -70,11 +85,17 @@ PaymentsEnterprise.propTypes = {
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
standAloneMode: state.payments.standAloneMode,
|
||||
isLoaded: state.auth.isLoaded,
|
||||
salesEmail: state.payments.salesEmail,
|
||||
helpUrl: state.payments.helpUrl,
|
||||
buyUrl: state.payments.buyUrl,
|
||||
dateExpires: state.payments.dateExpires,
|
||||
licenseUpload: state.wizard.licenseUpload,
|
||||
wizardToken: state.payments.wizardToken,
|
||||
hasErrorLicense: state.payments.hasErrorLicense,
|
||||
};
|
||||
}
|
||||
export default connect(mapStateToProps)(withRouter(PaymentsEnterprise));
|
||||
export default connect(mapStateToProps, {
|
||||
setLicense,
|
||||
resetLicenseUploaded,
|
||||
})(withRouter(PaymentsEnterprise));
|
||||
|
@ -8,5 +8,7 @@
|
||||
"FunctionalityAndSecurity": "Regular functionality and security updates during 1 year",
|
||||
"ProfessionalTechSupport": "1 year of professional tech support service",
|
||||
"Using": " You are using ONLYOFFICE Enterprise Edition",
|
||||
"SubscriptionGet": "Renew subscription to get:"
|
||||
"SubscriptionGet": "Renew subscription to get:",
|
||||
"Buy": "Buy now",
|
||||
"Upload": "Upload license"
|
||||
}
|
||||
|
@ -8,5 +8,7 @@
|
||||
"FunctionalityAndSecurity": "Регулярные обновления функциональных возможностей и безопасности в течение 1 года",
|
||||
"ProfessionalTechSupport": "1 год услуг профессиональной технической поддержки",
|
||||
"Using": "Вы используете ONLYOFFICE Enterprise Edition",
|
||||
"SubscriptionGet": "Обновите подписку, чтобы получить:"
|
||||
"SubscriptionGet": "Обновите подписку, чтобы получить:",
|
||||
"Buy": "Купить сейчас",
|
||||
"Upload": "Загрузить лицензию"
|
||||
}
|
||||
|
@ -1,15 +1,20 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import styled from "styled-components";
|
||||
|
||||
import { Button, utils } from "asc-web-components";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router";
|
||||
import { Button, utils, FileInput, Link } from "asc-web-components";
|
||||
import { store, history } from "asc-web-common";
|
||||
|
||||
import { setLicense } from "../../../../store/payments/actions";
|
||||
import { resetLicenseUploaded } from "../../../../store/wizard/actions";
|
||||
// const { getPortalSettings, setIsLoaded } = store.auth.actions;
|
||||
const { tablet, mobile } = utils.device;
|
||||
|
||||
const onButtonClickBuy = (e) => {
|
||||
window.open(e.target.value, "_blank");
|
||||
};
|
||||
|
||||
const StyledButtonContainer = styled.div`
|
||||
position: static;
|
||||
background: #edf2f7;
|
||||
@ -35,6 +40,12 @@ const StyledButtonContainer = styled.div`
|
||||
width: 153px;
|
||||
margin: 32px 612px 32px 0px;
|
||||
}
|
||||
|
||||
.input {
|
||||
position: absolute;
|
||||
border: 2px solid red;
|
||||
margin-right: 40px;
|
||||
}
|
||||
@media ${tablet} {
|
||||
width: 600px;
|
||||
height: 168px;
|
||||
@ -69,25 +80,78 @@ const StyledButtonContainer = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const ButtonContainer = ({ t, buyUrl }) => {
|
||||
return (
|
||||
<StyledButtonContainer>
|
||||
<Button
|
||||
className="button-payments-enterprise button-buy"
|
||||
label="Buy now"
|
||||
value={`${buyUrl}`}
|
||||
onClick={onButtonClickBuy}
|
||||
/>
|
||||
<Button
|
||||
className="button-payments-enterprise button-upload"
|
||||
label="Upload license"
|
||||
/>
|
||||
</StyledButtonContainer>
|
||||
);
|
||||
};
|
||||
class ButtonContainer extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
errorMessage: null,
|
||||
errorLoading: false,
|
||||
hasErrorLicense: false,
|
||||
};
|
||||
}
|
||||
onInputFileHandler = (file) => {
|
||||
//const { wizardToken } = this.props;
|
||||
|
||||
ButtonContainer.propTypes = {
|
||||
t: PropTypes.func.isRequired,
|
||||
};
|
||||
const { licenseUpload, setLicense } = this.props;
|
||||
//if (licenseUpload) resetLicenseUploaded();
|
||||
let fd = new FormData();
|
||||
fd.append("files", file);
|
||||
|
||||
export default ButtonContainer;
|
||||
setLicense(null, fd).catch((e) =>
|
||||
this.setState({
|
||||
errorLoading: true,
|
||||
errorMessage: e,
|
||||
hasErrorLicense: true,
|
||||
})
|
||||
);
|
||||
};
|
||||
render() {
|
||||
const { t, buyUrl } = this.props;
|
||||
const { errorLoading, hasErrorLicense } = this.state;
|
||||
|
||||
return (
|
||||
<StyledButtonContainer>
|
||||
<Button
|
||||
className="button-payments-enterprise button-buy"
|
||||
label={t("Buy")}
|
||||
value={`${buyUrl}`}
|
||||
onClick={onButtonClickBuy}
|
||||
/>
|
||||
{/* <Link
|
||||
type="action"
|
||||
color="black"
|
||||
isBold={true}
|
||||
onClick={this.onInputFileHandler}
|
||||
>
|
||||
{t("Upload")}
|
||||
</Link> */}
|
||||
{/* <Button
|
||||
type="submit"
|
||||
className="button-payments-enterprise button-upload"
|
||||
label={t("Upload")}
|
||||
onCLick={this.onInputFileHandler}
|
||||
/> */}
|
||||
|
||||
<FileInput
|
||||
tabIndex={3}
|
||||
className="input"
|
||||
placeholder={"Upload file"}
|
||||
accept=".lic"
|
||||
onInput={this.onInputFileHandler}
|
||||
/>
|
||||
</StyledButtonContainer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
buyUrl: state.payments.buyUrl,
|
||||
wizardToken: state.payments.wizardToken,
|
||||
licenseUpload: state.payments.licenseUpload,
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, { setLicense, resetLicenseUploaded })(
|
||||
withRouter(ButtonContainer)
|
||||
);
|
||||
|
@ -66,13 +66,13 @@ const StyledHeader = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const HeaderContainer = ({ t }) => {
|
||||
const HeaderContainer = ({ t, dateExpires }) => {
|
||||
return (
|
||||
<StyledHeader>
|
||||
<Text className="payments-header">{t("Using")}</Text>
|
||||
<sd>
|
||||
<Text className="payments-header-additional_support">
|
||||
{t("SubscriptionAndUpdatesExpires")} 1 march 2020
|
||||
{t("SubscriptionAndUpdatesExpires")} {dateExpires}
|
||||
{/* Техническая поддержка и обновления недоступны для вашей лицензии с 1
|
||||
марта 2021 года. */}
|
||||
</Text>
|
||||
|
11
web/ASC.Web.Client/src/store/payments/actions.js
Normal file
11
web/ASC.Web.Client/src/store/payments/actions.js
Normal file
@ -0,0 +1,11 @@
|
||||
import { store, api } from "asc-web-common";
|
||||
// const { setLicenseUpload } = store.wizard.actions;
|
||||
// const { setIsConfirmLoaded } = store.confirm.actions;
|
||||
import { setLicenseUpload, resetLicenseUploaded } from "../wizard/actions";
|
||||
export function setLicense(confirmKey, data) {
|
||||
return (dispatch) => {
|
||||
return api.settings
|
||||
.setLicense(confirmKey, data)
|
||||
.then((res) => dispatch(setLicenseUpload(res)));
|
||||
};
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
// import {} from "./actions";
|
||||
|
||||
const initialState = {
|
||||
wizardToken: null,
|
||||
salesEmail: "sales@onlyoffice.com",
|
||||
helpUrl: "https://helpdesk.onlyoffice.com",
|
||||
buyUrl: "http://www.onlyoffice.com/post.ashx?type=buyenterprise",
|
||||
standAloneMode: true,
|
||||
dateExpires: "1 марта 2020",
|
||||
};
|
||||
|
||||
const paymentsReducer = (state = initialState, action) => {
|
||||
|
Loading…
Reference in New Issue
Block a user