ProvidenceXz/Trinity-Health

View on GitHub
app/views/notes/index.html.erb

Summary

Maintainability
Test Coverage
<h2 class="text-center">Patient Name: <strong><%= @case.name %></strong></h2>
<%= tabs(:case_nav) %>
<p></p>
<p></p>
<% if @allowed %>
  <p style="text-align:center;"> <a href="#" id="show_form" class="btn btn-xs btn-primary">Add Note</a> </p>

<div style="text-align:center;" id="add_note_form">
  <%= form_for( [@note], url: {action: "create"},  html:{class: "note_form"}) do |f| %>
    <%= f.label :subject%>
    <%= f.text_field :subject %>
  
    <div>
      <%= f.label :note_text%>
    </div>
  
    <div>
      <%= f.text_area :note_text, size: "60x12" %>
    </div>
    <%flash[:form] = true%>
    <%= f.submit "Create" %>
  <% end %>
</div>
<% end %>
<p></p>
<% @notes.each do |c| %>
  <%if c.id%>
  <div class="row">
    <div class="col-xs-8 col-xs-offset-2">
      <div class="well well-lg">
        
        <div class="note-subject">
          <h3> <%= c.subject %> </h3>
        </div>

        <div class="note-text">
          <h4> <%= c.note_text%></h4> 
        </div>
        
        <div class="note-author">
          <b> Author: <%= @clinician.name %></b>
        </div>
        
        <div class="note-posting-date">
          <h6> Date: <%= c.posting_date %>i </h6>
        </div>

        <p></p>
        <% if @allowed %>
          <div class="case-actions">
            <%= link_to "Edit", edit_clinician_case_note_path(@clinician, @case, c), class: "btn btn-xs btn-primary"%>
            <%= link_to "Delete", clinician_case_note_path(@clinician, @case, c), method: :delete,  
                                    data: { confirm: "Are you sure you want to delete this note?" }, 
                                    class: "btn btn-xs btn-danger" %>
          </div>
        <% end %>

      </div>
    </div>
  </div>
  <% end %>
<% end %>