Skip to content

Commit

Permalink
Fix vat rates
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszreszke committed Sep 21, 2024
1 parent 08ff5c7 commit 5e7c9c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rails_application/app/views/products/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<label for="vat_rate" class="block font-bold">
VAT rate
</label>
<%= form.collection_select :vat_rate, Taxes::Configuration.available_vat_rates, :code, :code, {}, class: "mt-1 focus:ring-blue-500 focus:border-blue-500 block shadow-sm sm:text-sm border-gray-300 rounded-md", data: { turbo_permanent: true } %>
<%= form.collection_select :vat_rate, Configuration.available_vat_rates, :code, :code, {}, class: "mt-1 focus:ring-blue-500 focus:border-blue-500 block shadow-sm sm:text-sm border-gray-300 rounded-md", data: { turbo_permanent: true } %>
</div>

<% if defined?(errors) %>
Expand Down
9 changes: 9 additions & 0 deletions rails_application/lib/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
require_relative "../../infra/lib/infra"

VatRate = Struct.new(:code, :rate)

class Configuration
def call(event_store, command_bus)
enable_res_infra_event_linking(event_store)
end

def self.available_vat_rates
[
VatRate.new("23", 23),
VatRate.new("10", 10),
]
end

private

def enable_res_infra_event_linking(event_store)
Expand Down

0 comments on commit 5e7c9c3

Please sign in to comment.