omnipay-savings-sdk
Version:
Omnipay Savings SDK
70 lines (69 loc) • 6.83 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_native_1 = require("react-native");
const utils_1 = require("../../utils");
const SmartImage_1 = require("../Images/SmartImage");
const Text_1 = require("../Text");
const currency_1 = __importDefault(require("../Input/currency"));
const poweredBy_1 = require("../Common/poweredBy");
const useHandleChangeNotrim_1 = __importDefault(require("../../hooks/useHandleChangeNotrim"));
const InterestCalculation = (props) => {
const { closeModal, onPressContinue } = props;
const [errors, setErrors] = (0, useHandleChangeNotrim_1.default)({
amount: '',
interestPerAnnum: '',
});
const [details, setDetails] = (0, useHandleChangeNotrim_1.default)({
amount: '',
interestPerAnnum: '',
daily: '1000',
weekly: '7000',
monthly: '30000',
});
const { amount, interestPerAnnum, daily, weekly, monthly } = details;
function updateAmount(value) {
setDetails('amount', value);
setErrors('amount', '');
}
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, Object.assign({ style: {
paddingHorizontal: (0, utils_1.wp)(15),
// alignItems: 'center',
} }, { children: [(0, jsx_runtime_1.jsx)(SmartImage_1.SmartImage, { source: utils_1.Images.completeTransaction, style: {
width: (0, utils_1.ms)(48),
height: (0, utils_1.ms)(48),
alignSelf: 'center',
} }), (0, jsx_runtime_1.jsx)(Text_1.Text, { fontSize: (0, utils_1.fontSz)(14), lineHeight: (0, utils_1.fontSz)(15.11), fontWeight: "400", text: 'How much do you want to start with?', color: utils_1.Colors.completeTransactionTitle, textAlign: 'center', style: {
paddingTop: (0, utils_1.ms)(20),
paddingBottom: (0, utils_1.ms)(25),
} }), (0, jsx_runtime_1.jsxs)(react_native_1.View, Object.assign({ style: [
utils_1.globalStyles.rowBetween,
{
flex: 1,
paddingHorizontal: (0, utils_1.ms)(10),
paddingVertical: (0, utils_1.ms)(10),
marginVertical: (0, utils_1.ms)(5),
marginBottom: (0, utils_1.ms)(20),
borderRadius: (0, utils_1.ms)(8),
borderWidth: (0, utils_1.ms)(1),
borderColor: utils_1.Colors.paymentMethodBorderColor,
},
] }, { children: [(0, jsx_runtime_1.jsx)(currency_1.default, { value: amount, onChangeValue: (value) => {
updateAmount(value);
}, ignoreNegative: false, delimiter: ",", separator: ".", precision: 2, returnKeyType: "done", topComponent: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), walletAmount: 0, paymentAmount: Number(amount), onPressUseAllBalance: () => { }, onEndEditing: () => { }, onFocus: () => { }, label: 'Amount', showAsterisk: false, placeholder: '', balance: 0 || 0, errorMsg: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), showUseAllBalance: false, containerStyle: { width: '44%' } }), (0, jsx_runtime_1.jsx)(SmartImage_1.SmartImage, { style: {
width: (0, utils_1.ms)(14),
height: (0, utils_1.ms)(14),
tintColor: utils_1.Colors.black,
alignSelf: 'center',
marginTop: (0, utils_1.ms)(20),
}, source: utils_1.Images.forward }), (0, jsx_runtime_1.jsx)(currency_1.default, { editable: false, value: `${Number((Number(amount) * 20) / 365).toFixed(2)}`, onChangeValue: (value) => { }, ignoreNegative: false, delimiter: ",", separator: ".", precision: 2, returnKeyType: "done", topComponent: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), walletAmount: 0, paymentAmount: Number(amount), onPressUseAllBalance: () => { }, onEndEditing: () => { }, onFocus: () => { }, label: 'Interest per annum', showAsterisk: false, placeholder: '', balance: 0 || 0, errorMsg: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), showUseAllBalance: false, containerStyle: { width: '44%' } })] })), (0, jsx_runtime_1.jsxs)(react_native_1.View, Object.assign({ style: [utils_1.globalStyles.rowBetween, { flex: 1, marginVertical: (0, utils_1.ms)(5) }] }, { children: [(0, jsx_runtime_1.jsx)(currency_1.default, { editable: false, value: daily, onChangeValue: (value) => { }, ignoreNegative: false, delimiter: ",", separator: ".", precision: 2, returnKeyType: "done", topComponent: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), walletAmount: 0, paymentAmount: Number(daily), onPressUseAllBalance: () => { }, onEndEditing: () => { }, onFocus: () => { }, label: 'Daily', showAsterisk: false, placeholder: '', balance: 0 || 0, errorMsg: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), showUseAllBalance: false, containerStyle: { width: '31%' } }), (0, jsx_runtime_1.jsx)(currency_1.default, { editable: false, value: weekly, onChangeValue: (value) => { }, ignoreNegative: false, delimiter: ",", separator: ".", precision: 2, returnKeyType: "done", topComponent: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), walletAmount: 0, paymentAmount: Number(weekly), onPressUseAllBalance: () => { }, onEndEditing: () => { }, onFocus: () => { }, label: 'Weekly', showAsterisk: false, placeholder: '', balance: 0 || 0, errorMsg: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), showUseAllBalance: false, containerStyle: { width: '31%' } }), (0, jsx_runtime_1.jsx)(currency_1.default, { editable: false, value: monthly, onChangeValue: (value) => { }, ignoreNegative: false, delimiter: ",", separator: ".", precision: 2, returnKeyType: "done", topComponent: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), walletAmount: 0, paymentAmount: Number(monthly), onPressUseAllBalance: () => { }, onEndEditing: () => { }, onFocus: () => { }, label: 'Monthly', showAsterisk: false, placeholder: '', balance: 0 || 0, errorMsg: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), showUseAllBalance: false, containerStyle: { width: '31%' } })] })), (0, jsx_runtime_1.jsx)(react_native_1.View, Object.assign({ style: {
alignSelf: 'center',
marginTop: (0, utils_1.ms)(30),
marginBottom: (0, utils_1.ms)(20),
} }, { children: (0, jsx_runtime_1.jsx)(poweredBy_1.PoweredBy, {}) }))] })));
};
exports.default = InterestCalculation;
const styles = react_native_1.StyleSheet.create({});