JuanVqz/doctors

View on GitHub
app/views/appointments/_form.html.haml

Summary

Maintainability
Test Coverage
-# frozen_string_literal: true

= simple_form_for(appointment, html: { class: 'pt-4' }) do |f|
  = render 'shared/title', title: title

  .grid.gap-2.grid-cols-1.md:grid-cols-2
    .mb-4
      = f.label :patient, class: label_classes
      = f.combobox :patient_id, patients_for_select, default: params[:patient_id], data: { hw_combobox_fetch_information_value: true }
      = combobox_error(f.object, :patient)

    = f.input :reason

  = f.input :note, as: :trix_editor
  = f.input :prescription, as: :trix_editor
  = f.input :recommendations, as: :trix_editor

  .grid.gap-2.grid-cols-1.md:grid-cols-2
    = f.input :cabinet_results, input_html: resize_field_controller
    = f.input :histopathology, input_html: resize_field_controller

  .grid.gap-2.grid-cols-1.md:grid-cols-5{ data: { controller: :imc } }
    = f.input :blood_pressure
    = f.input :heart_rate
    = f.input :breathing_rate
    = f.input :temperature
    = f.input :glycaemia
    = f.input :sat_02
    = f.input :height, hint: t('simple_form.hint.defaults.height'), input_html: { data: { imc_target: :height, action: "input->imc#calculate" } }
    = f.input :weight, hint: t('simple_form.hint.defaults.weight'), input_html: { data: { imc_target: :weight, action: "input->imc#calculate" } }
    = f.input :imc, hint: t('simple_form.hint.defaults.imc'), input_html: { data: { imc_target: :result } }
    = f.input :cost, hint: t('simple_form.hint.defaults.cost')

  .grid.gap-2.grid-cols-1
    - appointment.files.each do |file|
      = f.input :files, as: :hidden, input_html: { multiple: true, value: file.signed_id }
    = f.input :files, input_html: { multiple: true }


  = f.button :submit