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.513 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.512 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.511 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.510 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.509 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.508 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.507 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.506 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.505 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.504 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.503 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.500 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.499 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.498 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.497 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.496 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.495 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.494 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.493 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.492 app/assets/javascripts/ish_manager/invoices.js