|
@@ -33,13 +33,12 @@ $medications = $points;
|
|
|
<tr class="">
|
|
|
<th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
|
|
|
<th class="border-bottom-0 text-secondary">Name</th>
|
|
|
- <th class="border-bottom-0 text-secondary">Frequency</th>
|
|
|
+ <th class="border-bottom-0 text-secondary w-25">Directions</th>
|
|
|
<th class="border-bottom-0 text-secondary">Active?</th>
|
|
|
<th class="border-bottom-0 text-secondary">Edit</th>
|
|
|
<th class="border-bottom-0 text-secondary">Started</th>
|
|
|
<th class="border-bottom-0 text-secondary">Ended</th>
|
|
|
<th class="border-bottom-0 text-secondary w-25">Last Review</th>
|
|
|
- <th class="border-bottom-0 text-secondary w-25">Last Plan</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<?php $prevRowRemoved = -1; ?>
|
|
@@ -91,7 +90,29 @@ $medications = $points;
|
|
|
</div>
|
|
|
</td>
|
|
|
<td>
|
|
|
- <?= !!@($medication->data->frequency) ? @($medication->data->frequency) : '-' ?>
|
|
|
+ <div class="d-flex align-items-start">
|
|
|
+ <div class="flex-grow-1">
|
|
|
+ <?php
|
|
|
+ include resource_path('views/app/patient/segment-templates/_child_plan/last-plan.php');
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <div class="d-inline-flex flex-nowrap">
|
|
|
+ <a class="px-2 view-review-log"
|
|
|
+ native target="_blank"
|
|
|
+ open-in-stag-popup
|
|
|
+ popup-style="stag-popup-md"
|
|
|
+ title="Plan log<?= !!@($medication->data->name) ? ' for ' . @($medication->data->name) : '' ?>"
|
|
|
+ href="/point/plan-log/<?= $medication->uid ?>?popupmode=1">
|
|
|
+ <i class="fa fa-history"></i>
|
|
|
+ </a>
|
|
|
+ <?php
|
|
|
+ $segment = $note->getSegmentByInternalName('plan_medications');
|
|
|
+ if($segment) {
|
|
|
+ include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</td>
|
|
|
<td>
|
|
|
@if($medication->is_removed)
|
|
@@ -127,25 +148,14 @@ $medications = $points;
|
|
|
</div>
|
|
|
|
|
|
<div class="row mb-2">
|
|
|
- <div class="col-4 pr-0">
|
|
|
- <label class="text-sm mb-1">Frequency</label>
|
|
|
- <input type="text" class="form-control form-control-sm min-width-unset"
|
|
|
- data-option-list="frequency-options" data-field="frequency"
|
|
|
- value="{{@$medication->data->frequency}}"
|
|
|
- data-name="frequency">
|
|
|
- <div id="frequency-options" class="data-option-list">
|
|
|
- <div>Once a day</div>
|
|
|
- <div>Twice a day</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="col-4 pr-0">
|
|
|
+ <div class="col-6 pr-0">
|
|
|
<label class="text-sm mb-0">Start Date</label>
|
|
|
<input type="date"
|
|
|
data-name="start_date"
|
|
|
value="{{@$medication->data->start_date}}"
|
|
|
class="form-control form-control-sm min-width-unset">
|
|
|
</div>
|
|
|
- <div class="col-4">
|
|
|
+ <div class="col-6">
|
|
|
<label class="text-sm mb-0">Prescribed By</label>
|
|
|
<input type="text"
|
|
|
data-name="prescriber"
|
|
@@ -154,16 +164,16 @@ $medications = $points;
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="mb-2">
|
|
|
+ <!--<div class="mb-2">
|
|
|
<label class="text-sm mb-1">Description</label>
|
|
|
<textarea rows="1" data-name="description" class="form-control form-control-sm">{{@$medication->data->description}}</textarea>
|
|
|
- </div>
|
|
|
+ </div>-->
|
|
|
|
|
|
@else
|
|
|
|
|
|
<div class="mb-2 bg-light p-2 border">
|
|
|
<p class="mb-1 font-weight-bold">
|
|
|
- {{ @$medication->data->name }} / {{ @$medication->data->frequency }}
|
|
|
+ {{ @$medication->data->name }}
|
|
|
</p>
|
|
|
<div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added prior to this visit.</div>
|
|
|
</div>
|
|
@@ -281,31 +291,6 @@ $medications = $points;
|
|
|
</div>
|
|
|
</div>
|
|
|
</td>
|
|
|
- <td>
|
|
|
- <div class="d-flex align-items-start">
|
|
|
- <div class="flex-grow-1">
|
|
|
- <?php
|
|
|
- include resource_path('views/app/patient/segment-templates/_child_plan/last-plan.php');
|
|
|
- ?>
|
|
|
- </div>
|
|
|
- <div class="d-inline-flex flex-nowrap">
|
|
|
- <a class="px-2 view-review-log"
|
|
|
- native target="_blank"
|
|
|
- open-in-stag-popup
|
|
|
- popup-style="stag-popup-md"
|
|
|
- title="Plan log<?= !!@($medication->data->name) ? ' for ' . @($medication->data->name) : '' ?>"
|
|
|
- href="/point/plan-log/<?= $medication->uid ?>?popupmode=1">
|
|
|
- <i class="fa fa-history"></i>
|
|
|
- </a>
|
|
|
- <?php
|
|
|
- $segment = $note->getSegmentByInternalName('plan_medications');
|
|
|
- if($segment) {
|
|
|
- include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
|
|
|
- }
|
|
|
- ?>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </td>
|
|
|
</tr>
|
|
|
<?php endforeach; ?>
|
|
|
</table>
|
|
@@ -328,7 +313,7 @@ $medications = $points;
|
|
|
<div class="row">
|
|
|
<div class="col-7">
|
|
|
<div class="mb-2">
|
|
|
- <label class="text-sm text-secondary mb-0">Name</label>
|
|
|
+ <label class="text-sm mb-0">Name</label>
|
|
|
<input type="text"
|
|
|
data-name="name"
|
|
|
class="form-control form-control-sm"
|
|
@@ -338,32 +323,29 @@ $medications = $points;
|
|
|
required>
|
|
|
</div>
|
|
|
<div class="row mb-2">
|
|
|
- <div class="col-4 pr-0">
|
|
|
- <label class="text-sm mb-1">Frequency</label>
|
|
|
- <input type="text" class="form-control form-control-sm min-width-unset"
|
|
|
- data-option-list="frequency-options" data-field="frequency"
|
|
|
- data-name="frequency">
|
|
|
- <div id="frequency-options" class="data-option-list">
|
|
|
- <div>Once a day</div>
|
|
|
- <div>Twice a day</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="col-4 pr-0">
|
|
|
+ <div class="col-6 pr-0">
|
|
|
<label class="text-sm mb-0">Start Date</label>
|
|
|
<input type="date"
|
|
|
data-name="start_date"
|
|
|
class="form-control form-control-sm min-width-unset">
|
|
|
</div>
|
|
|
- <div class="col-4">
|
|
|
+ <div class="col-6">
|
|
|
<label class="text-sm mb-0">Prescribed By</label>
|
|
|
<input type="text"
|
|
|
data-name="prescriber"
|
|
|
class="form-control form-control-sm min-width-unset">
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="mb-2">
|
|
|
+ <!--<div class="mb-2">
|
|
|
<label class="text-sm mb-1">Description</label>
|
|
|
<textarea rows="1" data-name="description" class="form-control form-control-sm"></textarea>
|
|
|
+ </div>-->
|
|
|
+
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="text-sm mb-1">Directions</label>
|
|
|
+ <div note-rte
|
|
|
+ class="form-group mb-2 border-left border-right rte-holder bg-white"
|
|
|
+ data-field-name="value"><?= $currentValue ?></div>
|
|
|
</div>
|
|
|
|
|
|
<hr class="my-3">
|
|
@@ -437,8 +419,8 @@ $medications = $points;
|
|
|
|
|
|
<script>
|
|
|
(function() {
|
|
|
- function initVisitMoeRTEs() {
|
|
|
- $('.stag-popup [visit-moe]').find('[note-rte]:not(.ql-container)').each(function() {
|
|
|
+ function initRTEs(_collection) {
|
|
|
+ _collection.each(function() {
|
|
|
|
|
|
let noteRTE = $(this);
|
|
|
|
|
@@ -474,7 +456,11 @@ $medications = $points;
|
|
|
let dataObject = {};
|
|
|
dataObject[fieldName] = content;
|
|
|
var dataValue = JSON.stringify(dataObject);
|
|
|
- $(el).closest('[visit-moe]').find('input[name=data]').val(dataValue);
|
|
|
+ let pElem = $(el).closest('[visit-moe]');
|
|
|
+ if(!pElem.length) {
|
|
|
+ pElem = $(el).closest('form');
|
|
|
+ }
|
|
|
+ pElem.find('input[name=data]').val(dataValue);
|
|
|
};
|
|
|
|
|
|
quill.on('text-change', onTextChange);
|
|
@@ -594,6 +580,15 @@ $medications = $points;
|
|
|
if(dataField.val()) {
|
|
|
parsed = JSON.parse(dataField.val());
|
|
|
}
|
|
|
+
|
|
|
+ // store plan content
|
|
|
+ let planContent = parsed.value ? parsed.value : '';
|
|
|
+ if(!$.trim($('<div/>').html(planContent).text())) {
|
|
|
+ toastr.error('Directions cannot be empty');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(parsed.value) delete parsed.value;
|
|
|
+
|
|
|
form.find('[data-name]').each(function() {
|
|
|
if(!parsed) parsed = {};
|
|
|
|
|
@@ -623,8 +618,19 @@ $medications = $points;
|
|
|
|
|
|
$.post(form.attr('action'), form.serialize(), _data => {
|
|
|
if(!hasResponseError(_data)) {
|
|
|
- hideMask();
|
|
|
- refreshDynamicStagPopup();
|
|
|
+
|
|
|
+ // save child plan
|
|
|
+ $.post('/api/visitPoint/upsertChildPlan', {
|
|
|
+ uid: _data.data,
|
|
|
+ segmentUid: '{{$note->getSegmentByInternalName('plan_medications')->uid}}',
|
|
|
+ data: JSON.stringify({value: planContent})
|
|
|
+ }, _data => {
|
|
|
+ if(!hasResponseError(_data)) {
|
|
|
+ hideMask();
|
|
|
+ refreshDynamicStagPopup();
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+
|
|
|
$('.visit-segment[data-segment-template-name="intake_medications"]').find('.refresh-segment').trigger('click');
|
|
|
}
|
|
|
}, 'json');
|
|
@@ -755,8 +761,8 @@ $medications = $points;
|
|
|
|
|
|
buttonContainer.insertAfter(titleElem);
|
|
|
|
|
|
- initSegmentMoes($('#medications-center-{{$note->id}}'));
|
|
|
- initVisitMoeRTEs();
|
|
|
+ initSegmentMoes(parentSegment);
|
|
|
+ initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
|
|
|
}
|
|
|
addMCInitializer('medications-center-{{$note->id}}', init, '#medications-center-{{$note->id}}');
|
|
|
}).call(window);
|