


<template name="hipaaAuditLog">
  <ul id="hipaaAuditLog" class="list-group">
    {{#each hipaaAudit}}
      {{> hipaaEntry}}
    {{/each}}
  </ul>
</template>

<template name="hipaaEntry">
  {{#if logMessageType 'init'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-gears fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> initialized HIPAA Audit Log.
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'access'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-database fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> accessed record(s) <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'create'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-plus-circle fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          {{#if hasPatientInfo}}
            <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> created record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName" style="{{getHighlightColor}}">{{getPatientName}}</span>.
          {{else}}
            <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> created record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
          {{/if}}
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'modify'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-pencil fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          {{#if hasPatientInfo}}
            <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> modified record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName" style="{{getHighlightColor}}">{{getPatientName}}</span>.
          {{else}}
            <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> modified record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
          {{/if}}

        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'clone'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-code-fork fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> cloned record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'delete'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-minus-circle fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> deleted record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'denied'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-warning fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> was denied access to record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'viewed'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-eye fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          {{#if hasPatientInfo}}
            <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> viewed record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName" style="{{getHighlightColor}}">{{getPatientName}}</span>.
          {{else}}
            <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> viewed record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
          {{/if}}
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'publish'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-rss fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> published record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'unpublish'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-circle-o fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> unpublished record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
        </div>
      </div>
    </li>
  {{/if}}


  {{#if logMessageType 'error'}}
    <li class="hipaaAuditItem list-group-item">
      <div class="media">
        <i class="pull-left fa fa-bomb fa-2x lightgray"></i>
        <div class="media-body">
          <span class="small gray">{{entryTimestamp}}</span><br>
          <span class="userName" style="{{getHighlightColor}}">{{userName}}</span> received a data access error while performing an action!<br>
          <span class="error">{{getErrorMessage}}</span>

        </div>
      </div>
    </li>
  {{/if}}


</template>
