Sha256: 1b763fac4442be6d464fee89e94fd8c61c5a10d113a933f59ceea067bfe66760

Contents?: true

Size: 869 Bytes

Versions: 40

Compression:

Stored size: 869 Bytes

Contents


$(document).ready(function () {

  const jwt_token = $("#Config").data('jwt-token')
  // logg(jwt_token, 'jwt_token')

  if ($(".invoices-new").length) {

    $("select[name='invoice[items][][product_id]']").on('change', function(ev) {
      var productId = ev.target.value
      logg(productId, 'productId')

      $.get(`/api/products/${productId}.json?jwt_token=${jwt_token}`, function(_data) {
        logg(_data, '_data')

        $('select[name="invoice[items][][price_id]"]').empty();
        // $('select[name="invoice[items][][price_id]"]').append($("<option disabled=true selected=true></option>").attr("value", '').text('Choose a price...')
        $.each(_data.prices, function(_, item) {
          $('select[name="invoice[items][][price_id]"]').append($("<option></option>").attr("value", item.id).text(item.name));
        })
      })
    })

  }


})

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ish_manager-0.1.8.491 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.490 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.489 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.488 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.487 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.486 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.485 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.484 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.483 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.482 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.481 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.480 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.479 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.478 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.477 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.476 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.475 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.474 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.473 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.472 app/assets/javascripts/ish_manager/invoices.js