get all fields
This commit is contained in:
parent
2f67dc4a1d
commit
54425f8ef9
1 changed files with 41 additions and 11 deletions
|
|
@ -8,6 +8,8 @@ const buyOrSellButtonGroup = document.getElementById(
|
||||||
'button-group-buy-or-sell'
|
'button-group-buy-or-sell'
|
||||||
);
|
);
|
||||||
const buyOrSellButtons = buyOrSellButtonGroup.querySelectorAll('button');
|
const buyOrSellButtons = buyOrSellButtonGroup.querySelectorAll('button');
|
||||||
|
const buyButton = document.getElementById('button-buy-bitcoin');
|
||||||
|
const sellButton = document.getElementById('button-sell-bitcoin');
|
||||||
|
|
||||||
const premiumValue = document.getElementById('premium-value');
|
const premiumValue = document.getElementById('premium-value');
|
||||||
const buttonIncreasePremium = document.getElementById(
|
const buttonIncreasePremium = document.getElementById(
|
||||||
|
|
@ -21,11 +23,24 @@ const buttonDecreasePremium = document.getElementById(
|
||||||
const eurAmountInput = document.getElementById('input-eur-amount');
|
const eurAmountInput = document.getElementById('input-eur-amount');
|
||||||
const btcAmountInput = document.getElementById('input-btc-amount');
|
const btcAmountInput = document.getElementById('input-btc-amount');
|
||||||
|
|
||||||
|
const placeInput = document.getElementById('place-input');
|
||||||
|
const timeInput = document.getElementById('time-input');
|
||||||
|
|
||||||
const onchainCheckbox = document.getElementById('onchain-checkbox');
|
const onchainCheckbox = document.getElementById('onchain-checkbox');
|
||||||
const lightningCheckbox = document.getElementById('lightning-checkbox');
|
const lightningCheckbox = document.getElementById('lightning-checkbox');
|
||||||
|
|
||||||
const btcMethodCheckboxes = [onchainCheckbox, lightningCheckbox];
|
const btcMethodCheckboxes = [onchainCheckbox, lightningCheckbox];
|
||||||
|
|
||||||
|
const mytrustedCheckbox = document.getElementById('my-trusted-checkbox');
|
||||||
|
const mytrustedtrustdCheckbox = document.getElementById(
|
||||||
|
'my-trusted-trusted-checkbox'
|
||||||
|
);
|
||||||
|
const allMembersCheckbox = document.getElementById('all-members-checkbox');
|
||||||
|
|
||||||
|
const bigNotesAcceptedCheckbox = document.getElementById(
|
||||||
|
'large-bills-checkbox'
|
||||||
|
);
|
||||||
|
|
||||||
const publishOfferButton = document.getElementById('button-submit-offer');
|
const publishOfferButton = document.getElementById('button-submit-offer');
|
||||||
|
|
||||||
function toggleCreateOfferControls() {
|
function toggleCreateOfferControls() {
|
||||||
|
|
@ -99,20 +114,35 @@ function validateBitcoinMethodCheckboxes(clickedCheckbox) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function publishOffer() {
|
function publishOffer() {
|
||||||
// read info from all elements
|
let wants;
|
||||||
// compose a json
|
if (buyButton.classList.contains('selected')) {
|
||||||
// hit the endpoint
|
wants = 'BTC';
|
||||||
|
}
|
||||||
|
if (sellButton.classList.contains('selected')) {
|
||||||
|
wants = 'EUR';
|
||||||
|
}
|
||||||
|
|
||||||
|
const premium = parseInt(premiumValue.innerText.match(/\d+/)[0]) / 100;
|
||||||
|
const trade_amount_eur = eurAmountInput.value;
|
||||||
|
const location_details = placeInput.value;
|
||||||
|
const time_availability_details = timeInput.value;
|
||||||
|
const is_onchain_accepted = onchainCheckbox.checked;
|
||||||
|
const is_lightning_accepted = lightningCheckbox.checked;
|
||||||
|
const are_big_notes_accepted = bigNotesAcceptedCheckbox.checked;
|
||||||
|
|
||||||
const offerDetails = {
|
const offerDetails = {
|
||||||
wants: 'BTC',
|
wants,
|
||||||
premium: '0',
|
premium,
|
||||||
trade_amount_eur: '100',
|
trade_amount_eur,
|
||||||
location_details: 'this and there',
|
location_details,
|
||||||
time_availability_details: 'then and then',
|
time_availability_details,
|
||||||
is_onchain_accepted: true,
|
is_onchain_accepted,
|
||||||
is_lightning_accepted: true,
|
is_lightning_accepted,
|
||||||
are_big_notes_accepted: false,
|
|
||||||
|
are_big_notes_accepted,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(offerDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonStartCreateOffer.addEventListener('click', () => {
|
buttonStartCreateOffer.addEventListener('click', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue