Sha256: 15c4994890dff62fd3965529528cf2f7f40517bc4c2a038bd26d77994ae71d93

Contents?: true

Size: 866 Bytes

Versions: 6

Compression:

Stored size: 866 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

6 entries across 6 versions & 1 rubygems

Version Path
ish_manager-0.1.8.471 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.470 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.469 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.468 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.467 app/assets/javascripts/ish_manager/invoices.js
ish_manager-0.1.8.466 app/assets/javascripts/ish_manager/invoices.js