Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions app/javascript/controllers/transfer_form_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class extends Controller {
ach: String,
check: String,
wire: String,
wise: String,
}

static questions = [
Expand All @@ -28,8 +29,15 @@ export default class extends Controller {
question: 'Does your recipient live within the US?',
yes: 2,
no: {
type: 'International wire',
link: 'https://help.hcb.hackclub.com/article/61-what-are-international-wires',
question: 'Are you transferring under $500 USD?',
yes: {
type: 'Wise transfer',
link: 'https://help.hcb.hackclub.com/article/65-wise',
},
no: {
type: 'International wire',
link: 'https://help.hcb.hackclub.com/article/61-what-are-international-wires',
},
},
},
{
Expand Down Expand Up @@ -71,6 +79,11 @@ export default class extends Controller {

this.yesClickHandler = () => this.renderQuestion(question.yes)
this.noClickHandler = () => this.renderQuestion(question.no)
} else if (payload.question) {
this.questionTarget.innerHTML = payload.question

this.yesClickHandler = () => this.renderQuestion(payload.yes)
this.noClickHandler = () => this.renderQuestion(payload.no)
} else {
this.answerTextTarget.innerHTML = payload.type
this.answerCTATarget.dataset.answer = payload.type
Expand All @@ -87,6 +100,7 @@ export default class extends Controller {
if (answer == 'ACH transfer') value = 'ach'
if (answer == 'Mailed check') value = 'check'
if (answer == 'International wire') value = 'wire'
if (answer == 'Wise transfer') value = 'wise'
window.Turbo.visit(this[`${value}Value`])
}
}
3 changes: 2 additions & 1 deletion app/views/events/_transfer_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
data-controller="transfer-form"
data-transfer-form-ach-value="<%= new_event_ach_transfer_path(@event) %>"
data-transfer-form-check-value="<%= new_event_increase_check_path(@event) %>"
data-transfer-form-wire-value="<%= new_event_wire_path(@event) %>">
data-transfer-form-wire-value="<%= new_event_wire_path(@event) %>"
data-transfer-form-wise-value="<%= new_event_wise_transfer_path(@event) %>">
<div data-transfer-form-target="home">
<fieldset>
<legend class="heading h2 pb2">What type of transfer?</legend>
Expand Down