ministryofjustice/Claim-for-Crown-Court-Defence

View on GitHub
app/views/external_users/claims/hardship_fee/_fields.html.haml

Summary

Maintainability
Test Coverage
#hardship-fee
  = f.fields_for :hardship_fee do |hf|
    - fee = present(hf.object)
    .fx-fee-group.hardship-fee-group.js-block.fx-do-init{data:{"type": "hardshipFees", autovat: @claim.apply_vat? ? "true" : "false", "block-type": "FeeBlock"}}

      = hf.govuk_text_field :fee_type_id,
        class: 'js-fee-type',
        form_group: { class: 'govuk-visually-hidden' },
        label: { hidden: true },
        type: 'hidden',
        value: fee.fee_type.id

      = hf.govuk_number_field :quantity,
        class:'quantity fee-quantity js-fee-calculator-ppe',
        form_group: { class: 'js-fee-calculator-effector' },
        hint: { text: t('.quantity_hint') },
        label: { text: t('.quantity') },
        min: 0,
        value: fee.quantity,
        width: 'one-quarter'

      = hf.govuk_number_field :amount,
        class: 'fee-amount total',
        form_group: { class: 'calculated-grad-fee js-graduated-price-effectee' },
        label: { text: t('.amount') },
        min: 0,
        prefix_text: '£',
        value: number_with_precision(hf.object.amount, precision: 2),
        width: 'one-quarter'

      = hf.govuk_text_field :price_calculated,
        form_group: { class: 'js-fee-calculator-success govuk-visually-hidden' },
        label: { hidden: true },
        type: 'hidden',
        value: hf.object.price_calculated?

      .fee-calc-help-wrapper.hidden
        = govuk_detail t('.help_how_we_calculate_amount_title') do
          = t('.help_how_we_calculate_amount_body')