Remove add transaction form from member page
This commit is contained in:
		| @@ -180,57 +180,18 @@ export function AdminTransactions(props) { | ||||
| export function AdminMemberTransactions(props) { | ||||
| 	const { token, result, refreshResult } = props; | ||||
| 	const transactions = result.transactions; | ||||
| 	const [open, setOpen] = useState(false); | ||||
| 	const [input, setInput] = useState({ date: moment().format('YYYY-MM-DD'), info_source: 'Web' }); | ||||
| 	const [error, setError] = useState(false); | ||||
| 	const [loading, setLoading] = useState(false); | ||||
| 	const [success, setSuccess] = useState(false); | ||||
| 	const { id } = useParams(); | ||||
|  | ||||
| 	const handleSubmit = (e) => { | ||||
| 		if (loading) return; | ||||
| 		setLoading(true); | ||||
| 		setSuccess(false); | ||||
| 		const data = { ...input, member_id: id }; | ||||
| 		requester('/transactions/', 'POST', token, data) | ||||
| 		.then(res => { | ||||
| 			setSuccess(res.id); | ||||
| 			setInput({}); | ||||
| 			setLoading(false); | ||||
| 			setError(false); | ||||
| 			refreshResult(); | ||||
| 		}) | ||||
| 		.catch(err => { | ||||
| 			setLoading(false); | ||||
| 			console.log(err); | ||||
| 			setError(err.data); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	return ( | ||||
| 		<div> | ||||
| 			<Header size='medium'>Edit Member Transactions</Header> | ||||
| 			<Header size='medium'>Member Transactions</Header> | ||||
|  | ||||
| 			<Form onSubmit={handleSubmit}> | ||||
| 				<Header size='small'>Add a Transaction</Header> | ||||
|  | ||||
| 				<TransactionEditor noMemberSearch input={input} setInput={setInput} error={error} /> | ||||
|  | ||||
| 				<Form.Button loading={loading} error={error.non_field_errors}> | ||||
| 					Submit | ||||
| 				</Form.Button> | ||||
| 				{success && <p>Added! <Link to={'/transactions/'+success}>View the transaction.</Link></p>} | ||||
| 			</Form> | ||||
| 			<Link to='/admintrans'>Add a transaction</Link> | ||||
|  | ||||
| 			<Header size='small'>Current Transactions</Header> | ||||
|  | ||||
| 			{transactions.length ? | ||||
| 				open ? | ||||
| 				<TransactionList noMember transactions={transactions} /> | ||||
| 				: | ||||
| 					<Button onClick={() => setOpen(true)}> | ||||
| 						View / Edit Transactions | ||||
| 					</Button> | ||||
| 			: | ||||
| 				<p>None</p> | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user