import React, { useState } from 'react'; import { Link } from 'react-router-dom'; import './light.css'; import { Container, Form, Grid, Header, Input } from 'semantic-ui-react'; import { PayPalPayNow, PayPalSubscribe } from './PayPal.js'; import { MembersDropdown } from './Members.js'; import { requester } from './utils.js'; export function SendProtocoin(props) { const { token, user, refreshUser } = props; const member = user.member; const [input, setInput] = useState({}); const [error, setError] = useState({}); const [loading, setLoading] = useState(false); const [success, setSuccess] = useState(false); const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value }); const handleChange = (e) => handleValues(e, e.currentTarget); const handleSubmit = (e) => { if (loading) return; setSuccess(false); setLoading(true); const data = { ...input, balance: member.protocoin }; requester('/protocoin/send_to_member/', 'POST', token, data) .then(res => { setLoading(false); setSuccess(true); setInput({}); setError({}); refreshUser(); }) .catch(err => { setLoading(false); console.log(err); setError(err.data); }); }; const makeProps = (name) => ({ name: name, onChange: handleChange, value: input[name] || '', error: error[name], }); return (
Use these buttons to send money to Protospace.
Protocoin is used to buy things from Protospace's vending machines. No cash value.
Current balance: ₱ {user.member.protocoin.toFixed(2)}
Total circulation: ₱ {user.member.total_protocoin.toFixed(2)}
See a director to purchase Protocoin with a different payment method.
Send Protocoin:
Pay ${monthly_fees}.00 once:
Subscribe ${monthly_fees}.00 / month:
Pay ${monthly_fees * 11}.00 for a year:
...get one month for free!
Pay for materials you use (ie. welding gas, 3D printing, blades, etc).
Please explain what you bought:
setConsumablesMemo(v.value)}
/>
Optional memo:
setMemo(v.value)}
/>
Confirm location and availability with Scott Young before subscribing.