Skip to content

Instantly share code, notes, and snippets.

@ngs
Created February 27, 2019 20:09
Show Gist options
  • Select an option

  • Save ngs/8f1fae3fa7b81ab668852940366c4a4e to your computer and use it in GitHub Desktop.

Select an option

Save ngs/8f1fae3fa7b81ab668852940366c4a4e to your computer and use it in GitHub Desktop.
Auto fill MoneyForward quotes
let unitPrice = ...;
let subjects = `...`.split(/\n/g);
let quantities = `...`.split(/\n/g)
while($('.js-css-item-row').size() < subjects.length + 1) {
$('#js-add-item').click()
$('.js-css-item-row:last #quote_quote_items_attributes__unit_price').val(unitPrice)
}
subjects.forEach((s, i) => $(`.js-css-item-row:eq(${i}) #quote_quote_items_attributes__name`).val(s))
quantities.forEach((s, i) => $(`.js-css-item-row:eq(${i}) #quote_quote_items_attributes__quantity`).val(s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment