Sha256: 71b0844e2f029fa518886ab041ce3f5304c04e2beaecbbf3a179bffbe0c19d8d
Contents?: true
Size: 893 Bytes
Versions: 7
Compression:
Stored size: 893 Bytes
Contents
Spree.Views.EditSubscriptionPayment = Backbone.View.extend({ initialize: function() { this.onSelectMethod() }, events: { 'change [name="subscription[payment_method_id]"]': 'onSelectMethod', }, onSelectMethod: function(e) { this.selectedId = parseInt(this.$('select[name="subscription[payment_method_id]"]').val()) this.render() }, render: function() { let selectedId = this.selectedId this.$('select[name="subscription[payment_source_id]"] option').each(function () { if (!$(this).data('js-payment-method-id') || parseInt($(this).data('js-payment-method-id')) === selectedId) { $(this).prop('disabled', false) } else { $(this).prop('disabled', true) } }) }, }); Spree.ready(function() { $(".js-edit-subscription-payment").each(function() { new Spree.Views.EditSubscriptionPayment({ el: this }) }); });
Version data entries
7 entries across 7 versions & 1 rubygems