Skip to content

Commit

Permalink
edited save function and form fields so that only credit seller can i…
Browse files Browse the repository at this point in the history
…nitiate transfer (#369)
  • Loading branch information
emi-hi authored Oct 26, 2020
1 parent 85b5007 commit 5cf8578
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
11 changes: 2 additions & 9 deletions frontend/src/credits/CreditTransfersContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,8 @@ const CreditTransfersContainer = (props) => {
};

const submitOrSave = (status) => {
let creditTo = '';
let debitFrom = '';
if (fields.transferType === 'transfer to') {
creditTo = fields.transferPartner;
debitFrom = user.organization.id;
} else {
creditTo = user.organization.id;
debitFrom = fields.transferPartner;
}
const creditTo = fields.transferPartner;
const debitFrom = user.organization.id;
const data = rows.map((row) => ({
creditValue: row.quantity,
dollarValue: row.value,
Expand Down
10 changes: 3 additions & 7 deletions frontend/src/credits/components/CreditTransfersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,12 @@ const CreditTransfersPage = (props) => {
<fieldset>
<h3>{user.organization.name} submits notice of the following proposed credit transfer:</h3>
<div className="form-group">
<div className="d-inline-block align-middle mr-5">
<input type="radio" id="transfer-to" name="transferType" value="transfer to" onChange={handleInputChange} />
<label htmlFor="transfer-to">transfer to</label>
<br />
<input type="radio" id="transfer-from" name="transferType" value="receive from" onChange={handleInputChange} />
<label htmlFor="transfer-from">receive from</label>
<div className="d-inline-block align-middle mr-2">
<h4>{user.organization.name} will transfer credits to</h4>
</div>
<FormDropdown
accessor={(organization) => organization.id}
dropdownName="select transfer partner"
dropdownName=" (select transfer partner)"
dropdownData={organizations}
fieldName="transferPartner"
handleInputChange={handleInputChange}
Expand Down

0 comments on commit 5cf8578

Please sign in to comment.