/** * The main component that hooks all elements together * * @type {*|Function} * * Hierarchy: * * Order Request Form CartContainer * |-->Products * | |-->Product * |-->Grand Total * |-->Checkout */ window.OrderRequestFormCartContainer = React.createClass({ getInitialState: function () { return { loading: true, currency: false, APIError: false, grandTotal: 0, errorMsg: { ['message']: "There was an error retrieving your cart. Please bear with us while we are fixing this issue.", ['linkText']: "Back to Homepage", ['link']: "/education" } }; }, getCurrency: function () { return this.state.currency; }, setCurrency: function (currency) { let convertedCurrency = currency.replace("£", "£"); this.setState({currency: convertedCurrency}); }, getGrandTotal: function () { return this.state.grandTotal.toLocaleString('en-US', {minimumFractionDigits: 2}); }, setGrandTotal: function (grandTotal) { this.setState({grandTotal: grandTotal}); }, getLoading: function () { return this.state.loading; }, setLoading: function (loading) { this.setState({loading: loading}); }, getAPIError: function () { return this.state.APIError; }, setAPIError: function (APIError) { this.setState({APIError: APIError}); }, getErrorMessage: function () { return this.state.errorMsg; }, setErrorMessage: function (errorMsg) { this.setState({errorMsg: errorMsg}); }, render: function () { return (
Qty Product Information Price
  Total cost: {this.getCurrency()}{this.getGrandTotal()}
); } });