JuanVqz/doctors

View on GitHub
app/views/patients/appointments/index.html.haml

Summary

Maintainability
Test Coverage
= render 'shared/section' do
  .flex.flex-row.justify-center.md:justify-start.space-x-4
    = link_to :patients, class: secondary_button do
      %span.fa.fa-arrow-left
      = t('.back')
    = link_to new_appointment_path(patient_id: @patient.id), 'data-tooltip': t('tooltips.appointments.new'), class: "#{secondary_button} tooltip tooltip-top" do
      %span.fa.fa-book
      = t('tooltips.appointments.new')

= render 'shared/section' do
  = render 'shared/table' do
    = render 'shared/title', title: t('tooltips.appointments.previous')
    %thead.border-b.border-gray-300.dark:border-gray-700.text-gray-400
      %tr
        %th.py-2{scope: :col}= t('.reason')
        %th.py-2{scope: :col}= t('.created_at')
        %th.py-2.text-center{scope: :col}= t('.actions')
    %tbody
      - @appointments.each do |appointment|
        %tr.hover:bg-gray-200.dark:hover:bg-gray-700{ data: { appointment_id: appointment.id } }
          %td.py-2.whitespace-nowrap= truncate(appointment.reason, lenght: 50)
          %td.py-2.whitespace-nowrap= appointment.created_at.to_date
          %td.py-2.whitespace-nowrap
            .flex.flex-row.justify-center.gap-2
              = link_to appointment_path(appointment, format: :pdf), 'data-tooltip': t('tooltips.defaults.print'), class: "#{secondary_button} tooltip tooltip-top", target: :_blank do
                %span.fa.fa-print.text-red-600
              = link_to edit_appointment_path(appointment), 'data-tooltip': t('tooltips.defaults.edit'), class: "#{secondary_button} tooltip tooltip-top" do
                %span.fa.fa-edit.text-yellow-600
              = link_to appointment, 'data-tooltip': t('tooltips.defaults.details'), class: "#{secondary_button} tooltip tooltip-top" do
                %span.fa.fa-eye.text-sky-600
  = render 'shared/pagination', pagy: @pagy