Skip to content

Commit

Permalink
feat(expenses): Allow to donate in kind with expenses
Browse files Browse the repository at this point in the history
  • Loading branch information
clarete committed May 9, 2018
1 parent c14144c commit 90eb94c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/components/CreateExpenseForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CreateExpenseForm extends React.Component {
'paypal': { id: 'expense.payoutMethod.paypal', defaultMessage: 'PayPal ({paypalEmail, select, missing {missing} other {{paypalEmail}}})' },
'newExpense.paypal.label': { id: 'newExpense.paypal.label', defaultMessage: 'Please provide address' },
'other': { id: 'expense.payoutMethod.manual', defaultMessage: 'Other (see instructions)' },
'donation': { id: 'expense.payoutMethod.donation', defaultMessage: 'Donation' },
'error.descriptionMissing': { id: 'expense.error.descriptionMissing', defaultMessage: 'Missing description' },
'error.amountMissing': { id: 'expense.error.amountMissing', defaultMessage: 'Amount must be greater than 0' },
'error.privateMessageMissing': { id: 'expense.error.privateMessageMissing', defaultMessage: `Please provide instructions on how you'd like to be reimbursed as a private note` },
Expand Down Expand Up @@ -119,7 +120,9 @@ class CreateExpenseForm extends React.Component {
const { LoggedInUser, intl, collective } = this.props;
const { expense } = this.state;

const payoutMethods = this.getOptions(['paypal', 'other'], { paypalEmail: get(expense, 'user.paypalEmail') || intl.formatMessage(this.messages['newExpense.paypal.label']) });
const payoutMethods = this.getOptions(['paypal', 'other', 'donation'], {
paypalEmail: get(expense, 'user.paypalEmail') || intl.formatMessage(this.messages['newExpense.paypal.label'])
});

return (
<div className={`CreateExpenseForm ${this.props.mode}`}>
Expand Down
5 changes: 3 additions & 2 deletions src/components/ExpenseDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class ExpenseDetails extends React.Component {
this.messages = defineMessages({
'paypal': { id: 'expense.payoutMethod.paypal', defaultMessage: 'PayPal ({paypalEmail, select, missing {missing} hidden {hidden} other {{paypalEmail}}})' },
// 'manual': { id: 'expense.payoutMethod.donation', defaultMessage: 'Consider as donation' },
'other': { id: 'expense.payoutMethod.manual', defaultMessage: 'Other (see instructions)' }
'other': { id: 'expense.payoutMethod.manual', defaultMessage: 'Other (see instructions)' },
'donation': { id: 'expense.payoutMethod.donation', defaultMessage: 'Donation' },
});

this.state = { modified: false, expense: {} };
Expand Down Expand Up @@ -62,7 +63,7 @@ class ExpenseDetails extends React.Component {
const previewAttachmentImage = expense.attachment ? imagePreview(expense.attachment) : '/static/images/receipt.svg';
const payoutMethod = this.state.expense.payoutMethod || expense.payoutMethod;
const paypalEmail = get(expense, 'user.paypalEmail') || get(expense, 'user.email');
const payoutMethods = this.getOptions(['paypal', 'other'], { paypalEmail: paypalEmail || (canEditExpense ? "missing" : "hidden") });
const payoutMethods = this.getOptions(['paypal', 'other', 'donation'], { paypalEmail: paypalEmail || (canEditExpense ? "missing" : "hidden") });
const categoriesOptions = categories(expense.collective.slug).map(category => {
return { [category]: category }
});
Expand Down

0 comments on commit 90eb94c

Please sign in to comment.