podemos-info/census

View on GitHub
app/views/orders_batches/review_orders.arb

Summary

Maintainability
Test Coverage
# frozen_string_literal: true

h3 "BICs pendientes"
form class: "formtastic", action: review_orders_orders_batch_path, method: :post do
  input name: "authenticity_token", type: "hidden", value: form_authenticity_token.to_s
  fieldset class: "inputs" do
    ol do
      pending_bics.each do |key, info|
        classes = info[:errors]&.any? ? { li: "error", div: "field_with_errors", para: "inline-errors" } : {}
        li class: "string input required #{classes[:li]}" do
          div class: classes[:div] do
            label for: "pending_bics[#{key}]", class: "label" do
              span "#{info[:country]} - #{info[:bank_code]}"
              br
              small info[:iban]
            end
          end
          div class: classes[:div] do
            input name: "pending_bics[#{key}]", type: :text, value: info[:value]
          end
          info[:errors]&.messages&.each_value do |message|
            para class: classes[:para] do
              message.to_sentence
            end
          end
        end
      end
    end
  end
  fieldset class: "actions" do
    ol do
      li class: "action input_action" do
        input type: :submit, value: t("formtastic.update", model: t("activerecord.models.bic", count: pending_bics.count))
      end
      li class: "cancel" do
        a href: orders_batch_path do
          t("active_admin.cancel")
        end
      end
    end
  end
end