|
@@ -3,14 +3,21 @@
|
|
|
use App\Models\Point;
|
|
|
use App\Models\Client;
|
|
|
use App\Models\Note;
|
|
|
-use App\Models\Segment;
|
|
|
+use App\Models\Pro;
|
|
|
|
|
|
/** @var Client $patient */
|
|
|
/** @var Note $note */
|
|
|
+/** @var Pro $pro */
|
|
|
|
|
|
list($medications, $counts) = Point::getPointsOfCategoryExtended($patient, 'MEDICATION', $note);
|
|
|
$numActiveItems = Point::getNumPointsOfCategory($patient, 'MEDICATION');
|
|
|
-
|
|
|
+$favorites = $pro->favoritesByCategoryDecoded('medication');
|
|
|
+function isFavoriteMedication($_medication, $_favorites) {
|
|
|
+ foreach($_favorites as $favorite) {
|
|
|
+ if($favorite->data->name === $_medication->data->name) return $favorite->uid;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
?>
|
|
|
|
|
|
<div class="mt-3 p-3 border-top" id="medications-center-{{$note->id}}">
|
|
@@ -44,6 +51,7 @@ $numActiveItems = Point::getNumPointsOfCategory($patient, 'MEDICATION');
|
|
|
<?php $prevRowState = -1; ?>
|
|
|
<?php foreach($medications as $medication): ?>
|
|
|
<?php $point = $medication; ?>
|
|
|
+ <?php $favoriteUid = isFavoriteMedication($medication, $favorites); ?>
|
|
|
@if($prevRowState !== $medication->state)
|
|
|
@include('app.patient.wizard-partials.state-row', ['point' => $medication])
|
|
|
@endif
|
|
@@ -64,6 +72,28 @@ $numActiveItems = Point::getNumPointsOfCategory($patient, 'MEDICATION');
|
|
|
<b><?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?></b>
|
|
|
@include('app.patient.wizard-partials.state-badge', ['point' => $medication, 'addedVerb' => 'Prescribed', 'removedVerb' => 'Discontinued'])
|
|
|
</div>
|
|
|
+ <div class="ml-auto mr-1">
|
|
|
+ <div moe>
|
|
|
+ @if(!$favoriteUid)
|
|
|
+ <form show url="/api/proFavorite/create">
|
|
|
+ <input type="hidden" name="proUid" value="{{$pro->uid}}">
|
|
|
+ <input type="hidden" name="category" value="medication">
|
|
|
+ <textarea class="d-none"
|
|
|
+ name="data">{!! json_encode(["name" => @($medication->data->name), "medId" => @($medication->data->medId), "routedMedId" => @($medication->data->routedMedId), "routedDosageFormMedId" => @($medication->data->routedDosageFormMedId), "gcnSeqno" => @($medication->data->gcnSeqno)]) !!}</textarea>
|
|
|
+ <button submit class="outline-0 shadow-none border-0 bg-transparent p-0 text-secondary-light" title="Add to common">
|
|
|
+ <i class="fa fa-bookmark"></i>
|
|
|
+ </button>
|
|
|
+ </form>
|
|
|
+ @else
|
|
|
+ <form show url="/api/proFavorite/remove">
|
|
|
+ <input type="hidden" name="uid" value="{{$favoriteUid}}">
|
|
|
+ <button submit class="outline-0 shadow-none border-0 bg-transparent p-0 text-info" title="Remove from common">
|
|
|
+ <i class="fa fa-bookmark"></i>
|
|
|
+ </button>
|
|
|
+ </form>
|
|
|
+ @endif
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</td>
|
|
|
<td>
|
|
@@ -204,7 +234,29 @@ $numActiveItems = Point::getNumPointsOfCategory($patient, 'MEDICATION');
|
|
|
|
|
|
<div class="row">
|
|
|
<div class="col-8">
|
|
|
- <p class="mb-2"><b>Add Medication</b></p>
|
|
|
+ <div class="d-flex align-items-baseline mb-2">
|
|
|
+ <b>Add Medication</b>
|
|
|
+ @if(count($favorites))
|
|
|
+ <div class="d-inline position-relative on-click-menu ml-4">
|
|
|
+ <span class="text-primary c-pointer">
|
|
|
+ <i class="fa fa-bookmark text-info mr-1"></i> Common Medications <i class="ml-1 fa fa-caret-down"></i>
|
|
|
+ </span>
|
|
|
+ <div menu right class="bg-white border">
|
|
|
+ @foreach($favorites as $favorite)
|
|
|
+ <a native target="_blank" href="#"
|
|
|
+ data-name="{{@($favorite->data->name)}}"
|
|
|
+ data-medId="{{@($favorite->data->medId)}}"
|
|
|
+ data-routedMedId="{{@($favorite->data->routedMedId)}}"
|
|
|
+ data-routedDosageFormMedId="{{@($favorite->data->routedDosageFormMedId)}}"
|
|
|
+ data-gcnSeqno="{{@($favorite->data->gcnSeqno)}}"
|
|
|
+ class="px-2 py-1 d-block text-nowrap text-sm favorite-item">
|
|
|
+ {{$favorite->data->name}}
|
|
|
+ </a>
|
|
|
+ @endforeach
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ @endif
|
|
|
+ </div>
|
|
|
<div class="mb-2">
|
|
|
<label class="mb-0 font-weight-bold">Name</label>
|
|
|
<input type="text"
|
|
@@ -321,6 +373,18 @@ $numActiveItems = Point::getNumPointsOfCategory($patient, 'MEDICATION');
|
|
|
@if($numActiveItems && $tracker && @($tracker->data->no_known_medications))
|
|
|
parentSegment.find('[data-field-name="no_known_medications"]').prop('checked', false).trigger('change');
|
|
|
@endif
|
|
|
+
|
|
|
+ parentSegment.find('.favorite-item')
|
|
|
+ .off('click.add-from-favorite')
|
|
|
+ .on('click.add-from-favorite', function () {
|
|
|
+ $('#frm-add-medication').find('input[data-name="name"]').val($(this).attr('data-name'));
|
|
|
+ $('#frm-add-medication').find('input[data-name="medId"]').val($(this).attr('data-medId'));
|
|
|
+ $('#frm-add-medication').find('input[data-name="routedMedId"]').val($(this).attr('data-routedMedId'));
|
|
|
+ $('#frm-add-medication').find('input[data-name="routedDosageFormMedId"]').val($(this).attr('data-routedDosageFormMedId'));
|
|
|
+ $('#frm-add-medication').find('input[data-name="gcnSeqno"]').val($(this).attr('data-gcnSeqno'));
|
|
|
+ $(this).closest('.on-click-menu').find('[menu]').hide();
|
|
|
+ return false;
|
|
|
+ });
|
|
|
}
|
|
|
addMCInitializer('medications-center-{{$note->id}}', init, '#medications-center-{{$note->id}}');
|
|
|
}).call(window);
|