@ -9,7 +9,7 @@ import { isAdmin, BasicTable, requester } from './utils.js';
import { NotFound } from './Misc.js' ;
export function TransactionEditor ( props ) {
const { token , input , setInput , error , noMemberSearch } = props ;
const { token , input , setInput , error } = props ;
const [ prevInput ] = useState ( input ) ;
@ -32,6 +32,7 @@ export function TransactionEditor(props) {
//{ key: '5', text: 'Member Balance / Protocash', value: 'Member' },
{ key : '6' , text : 'Membership Adjustment / Clearing' , value : 'Clearing' } ,
{ key : '7' , text : 'PayPal' , value : 'PayPal' } ,
{ key : '8' , text : 'Protocoin' , value : 'Protocoin' } ,
] ;
const sourceOptions = [
@ -53,76 +54,97 @@ export function TransactionEditor(props) {
{ key : '0' , text : 'Membership Dues' , value : 'Membership' } ,
{ key : '1' , text : 'Course Fee' , value : 'OnAcct' } ,
{ key : '2' , text : 'Snacks / Pop / Coffee' , value : 'Snacks' } ,
{ key : '3' , text : 'Donation' , value : 'Donation' } ,
{ key : '4' , text : 'Consumables (Explain in m emo)' , value : 'Consumables' } ,
{ key : '3' , text : 'Donation (Explain in Memo) ' , value : 'Donation' } ,
{ key : '4' , text : 'Consumables (Explain in M emo)' , value : 'Consumables' } ,
{ key : '5' , text : 'Purchase of Locker / Materials / Stock' , value : 'Purchases' } ,
//{ key: '6', text: 'Auction, Garage Sale, Nearly Free Shelf', value: 'Garage Sale' },
{ key : '7' , text : 'Reimbursement (Enter a negative value )' , value : 'Reimburse' } ,
{ key : '8' , text : 'Other (Explain in m emo)' , value : 'Other' } ,
{ key : '6' , text : 'Purchase of Protocoin' , value : 'Exchange' } ,
{ key : '7' , text : 'Reimbursement (Not for Refunds )' , value : 'Reimburse' } ,
{ key : '8' , text : 'Other (Explain in M emo)' , value : 'Other' } ,
] ;
return (
< div className = 'transaction-editor' >
{ ! noMemberSearch && < Form . Field error = { error . member _id } >
< label > Member ( search ) < / l a b e l >
< MembersDropdown
token = { token }
{ ... makeProps ( 'member_id' ) }
onChange = { handleValues }
initial = { input . member _name }
/ >
< / F o r m . F i e l d > }
< Form . Group widths = 'equal' >
< Form . Field error = { error . member _id } >
< label > Member ( search ) < / l a b e l >
< MembersDropdown
token = { token }
{ ... makeProps ( 'member_id' ) }
onChange = { handleValues }
initial = { input . member _name }
/ >
< / F o r m . F i e l d >
< Form . Input
label = 'Date'
fluid
{ ... makeProps ( 'date' ) }
/ >
< Form . Input
label = 'Amount'
< / F o r m . G r o u p >
< Form . Group widths = 'equal' >
< Form . Select
label = 'Payment Method'
fluid
{ ... makeProps ( 'amount' ) }
options = { accountOptions }
{ ... makeProps ( 'account_type' ) }
onChange = { handleValues }
/ >
< / F o r m . G r o u p >
< Form . Select
label = 'Category'
fluid
options = { categoryOptions }
{ ... makeProps ( 'category' ) }
onChange = { handleValues }
/ >
< Form . Select
label = 'Payment Method / Account'
fluid
options = { accountOptions }
{ ... makeProps ( 'account_type' ) }
onChange = { handleValues }
/ >
{ input . account _type && ( input . account _type === 'Protocoin' ?
< Form . Input
label = 'Protocoin Delta (+/-)'
fluid
{ ... makeProps ( 'protocoin' ) }
/ >
:
< Form . Input
label = 'Amount ($)'
fluid
{ ... makeProps ( 'amount' ) }
/ >
) }
< / F o r m . G r o u p >
{ input ? . account _type !== prevInput ? . account _type && input ? . account _type === 'PayPal' &&
< Message visible warning >
< Message . Header > Are you sure ? < / M e s s a g e . H e a d e r >
< p > PayPal transactions should b e automatic . Double check there ' s no duplicate . They may take 24 h to appear . < / p >
< p > PayPal transactions ar e automatic . Double check there ' s no duplicate . They may take 24 h to appear . < / p >
< / M e s s a g e >
}
{ / * < F o r m . G r o u p w i d t h s = ' e q u a l ' >
< Form . Input
label = 'Payment Method'
fluid
{ ... makeProps ( 'payment_method' ) }
/ >
{ input ? . account _type !== prevInput ? . account _type && input ? . account _type === 'Protocoin' &&
< Message visible warning >
< Message . Header > Are you sure ? < / M e s s a g e . H e a d e r >
< p > Protocoin spending transactions are automatic . Do you want "Purchase of Protocoin" category below ? < / p >
< / M e s s a g e >
}
< Form . Group widths = 'equal' >
< Form . Select
label = 'Info Source'
label = 'Category '
fluid
options = { sour ceOptions}
{ ... makeProps ( 'info_source ' ) }
options = { cat egory Options }
{ ... makeProps ( 'category ' ) }
onChange = { handleValues }
/ >
< /Form.Group> */ }
{ input . category === 'Membership' &&
< Form . Input
label = 'Membership Months (+/-)'
fluid
{ ... makeProps ( 'number_of_membership_months' ) }
/ >
}
{ input . category === 'Exchange' &&
< Form . Input
label = 'Protocoin Purchased'
fluid
{ ... makeProps ( 'amount' ) } // trick the user
/ >
}
< / F o r m . G r o u p >
< Form . Group widths = 'equal' >
< Form . Input
@ -132,18 +154,12 @@ export function TransactionEditor(props) {
/ >
< Form . Input
label = 'Number of Membership Month s'
label = 'Memo / Note s'
fluid
{ ... makeProps ( 'number_of_ membership_m onths ' ) }
{ ... makeProps ( 'memo' ) }
/ >
< / F o r m . G r o u p >
< Form . Input
label = 'Memo / Notes'
fluid
{ ... makeProps ( 'memo' ) }
/ >
< / d i v >
) ;
} ;
@ -435,7 +451,7 @@ export function TransactionDetail(props) {
< Header size = 'large' > Transaction Receipt < / H e a d e r >
< Grid stackable columns = { 2 } >
< Grid . Column >
< Grid . Column width = { 6 } >
< TransactionTable user = { user } transaction = { transaction } / >
< div style = { { display : 'none' } } >
@ -447,7 +463,7 @@ export function TransactionDetail(props) {
/ >
< / G r i d . C o l u m n >
< Grid . Column >
< Grid . Column width = { 10 } >
{ isAdmin ( user ) ?
< Segment padded >
< EditTransaction transaction = { transaction } setTransaction = { setTransaction } { ... props } / >