|
@@ -1,12 +1,11 @@
|
|
|
<?php
|
|
|
+
|
|
|
use App\Models\Client;
|
|
|
-use App\Models\Note;
|
|
|
use App\Models\Point;
|
|
|
-use App\Models\Pro;
|
|
|
+use App\Models\Note;
|
|
|
/** @var Client $patient */
|
|
|
/** @var Note $note */
|
|
|
-/** @var Point $point */
|
|
|
-/** @var Pro $pro */
|
|
|
+/** @var Segment $segment */
|
|
|
|
|
|
$fields = [
|
|
|
[
|
|
@@ -40,17 +39,11 @@ $customFields = array_map(function($_item) {
|
|
|
return $_item['label'];
|
|
|
}, $customFields->toArray());
|
|
|
|
|
|
-if(!$customFields) {
|
|
|
- $customFields = [];
|
|
|
-}
|
|
|
+if(!$customFields) $customFields = [];
|
|
|
|
|
|
$point = Point::getGlobalSingletonOfCategory($patient, 'PAST_MEDICAL_HISTORY', true);
|
|
|
|
|
|
-$contentData = $parsed = false;
|
|
|
-
|
|
|
-if ($point && @$point->data) {
|
|
|
- $contentData = $parsed = $point->data;
|
|
|
-}
|
|
|
+$contentData = $parsed = @$point && @$point->data ? $point->data : false;
|
|
|
|
|
|
if(!$contentData) {
|
|
|
$contentData = [
|
|
@@ -62,16 +55,8 @@ if(!$contentData) {
|
|
|
];
|
|
|
}
|
|
|
|
|
|
-for ($i = 0; $i < count($fields); $i++) {
|
|
|
- foreach($fields[$i] as $head => $values) {
|
|
|
- for($k = 0; $k < count($values); $k++) {
|
|
|
- $fName = $head . '_' . sanitize_field_name($values[$k]);
|
|
|
- if(!isset($contentData["common"][$fName])) $contentData["common"][$fName] = null;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
?>
|
|
|
+
|
|
|
<div class="p-3 border-top mt-3 mcp-theme-1">
|
|
|
<div visit-moe close-on-save close-on-cancel class="d-block">
|
|
|
<form show url="/api/visitPoint/upsertGlobalSingleton" class="mcp-theme-1">
|
|
@@ -80,11 +65,10 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
<input type="hidden" name="data">
|
|
|
|
|
|
<div id="edit-univ_history_past_medical-container">
|
|
|
-
|
|
|
- <div class="mb-3 d-flex align-items-start">
|
|
|
+ <div class="d-flex align-items-center mb-2">
|
|
|
<div class="width-100px mr-3">
|
|
|
<label class="text-secondary mb-1">Blood Type</label>
|
|
|
- <select class="form-control form-control-sm width-100px" v-model="data.bloodType">
|
|
|
+ <select class="form-control form-control-sm width-100px" v-model="bloodType">
|
|
|
<option value=""> -- select -- </option>
|
|
|
<option value="A">A</option>
|
|
|
<option value="AB">AB</option>
|
|
@@ -94,35 +78,35 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
</div>
|
|
|
<div class="width-100px mr-3">
|
|
|
<label class="text-secondary mb-1">RH</label>
|
|
|
- <select class="form-control form-control-sm width-100px" v-model="data.bloodRH">
|
|
|
+ <select class="form-control form-control-sm width-100px" v-model="bloodRH">
|
|
|
<option value=""> -- select -- </option>
|
|
|
<option value="+ve">+ve</option>
|
|
|
<option value="-ve">-ve</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="row">
|
|
|
+ <div class="d-flex align-items-start flex-wrap custom-items-container">
|
|
|
@for ($i = 0; $i < count($fields); $i++)
|
|
|
- <div class="col-md-3">
|
|
|
+ <div class="w-25">
|
|
|
@foreach($fields[$i] as $head => $values)
|
|
|
<div class="font-weight-bold mb-2">{{ $head }}</div>
|
|
|
<div class="mb-3">
|
|
|
@for($k = 0; $k < count($values); $k++)
|
|
|
<?php $fName = $head . '_' . sanitize_field_name($values[$k]); ?>
|
|
|
<label class="d-flex align-items-start mb-1">
|
|
|
- <input type="checkbox" name="{{ $fName }}" class="m-0"
|
|
|
- v-model="data.common['{{$fName}}']">
|
|
|
+ <input type="checkbox" name="{{ $fName }}" class="mx-0 mt-1"
|
|
|
+ v-model="common['{{$fName}}']">
|
|
|
<div class="ml-2">
|
|
|
<div>
|
|
|
<span class="mr-2">{{ $values[$k] }}</span>
|
|
|
- <div moe no-mask>
|
|
|
+ <div moe relative no-mask v-show="common['{{$fName}}']" >
|
|
|
<a href="#" start show>
|
|
|
- <i v-show="data.common['{{$fName}}']" class="fa-comment" :class="data.common['{{$fName}}__comments'] ? 'fas' : 'far'"></i>
|
|
|
+ <i class="fa-comment" :class="common['{{$fName}}__comments'] ? 'fas' : 'far'"></i>
|
|
|
</a>
|
|
|
- <div url="/nop">
|
|
|
+ <div url="/nop" right>
|
|
|
<div class="mb-2">
|
|
|
- <textarea class="form-control form-control-sm ns-custom-comment min-width-200px"
|
|
|
- v-model="data.common['{{$fName}}__comments']"></textarea>
|
|
|
+ <textarea class="form-control form-control-sm ns-custom-comment min-width-200px"
|
|
|
+ v-model="common['{{$fName}}__comments']"></textarea>
|
|
|
</div>
|
|
|
<div class="">
|
|
|
<button type="button" class="btn btn-sm btn-primary" cancel>Close
|
|
@@ -131,8 +115,8 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <span v-show="data.common['{{$fName}}'] && data.common['{{$fName}}__comments']"
|
|
|
- v-html="data.common['{{$fName}}__comments']"
|
|
|
+ <span v-show="common['{{$fName}}'] && common['{{$fName}}__comments']"
|
|
|
+ v-html="common['{{$fName}}__comments']"
|
|
|
class="text-sm text-secondary">
|
|
|
</span>
|
|
|
</div>
|
|
@@ -153,12 +137,12 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
<div custom-item-form url="/api/sectionTemplateCustomItem/create">
|
|
|
<div class="mb-2">
|
|
|
<input type="text" placeholder="Label"
|
|
|
- v-model="data.newCustomItemLabel"
|
|
|
+ v-model="newCustomItemLabel"
|
|
|
class="form-control form-control-sm label_new_custom_item">
|
|
|
</div>
|
|
|
<div>
|
|
|
<button type="button" class="btn btn-sm btn-primary mr-1"
|
|
|
- v-on:click.prevent="saveCustomItem(data.newCustomItemLabel)">Submit</button>
|
|
|
+ v-on:click.prevent="saveCustomItem(newCustomItemLabel)">Submit</button>
|
|
|
<button type="button" class="btn btn-sm btn-default border"
|
|
|
v-on:click.prevent="cancelCustomItem()">Cancel</button>
|
|
|
</div>
|
|
@@ -168,19 +152,18 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
|
|
|
{{-- custom items --}}
|
|
|
<div class="d-flex align-items-start flex-wrap custom-items-container">
|
|
|
- <div class="w-25" v-for="item in data.customFields">
|
|
|
-
|
|
|
+ <div class="w-25" v-for="item in customFields">
|
|
|
<label class="d-flex align-items-start mb-1">
|
|
|
- <input type="checkbox" class="m-0"
|
|
|
+ <input type="checkbox" class="mx-0 mt-1"
|
|
|
v-model="item.value">
|
|
|
- <div class="ml-2">
|
|
|
+ <div class="ml-2 pr-3">
|
|
|
<div>
|
|
|
<span class="mr-2">@{{ item.label }}</span>
|
|
|
- <div moe no-mask>
|
|
|
+ <div moe relative no-mask v-show="item.value" >
|
|
|
<a href="#" start show>
|
|
|
- <i v-show="item.value" class="fa-comment" :class="item.comments ? 'fas' : 'far'"></i>
|
|
|
+ <i class="fa-comment" :class="item.comments ? 'fas' : 'far'"></i>
|
|
|
</a>
|
|
|
- <div url="/nop">
|
|
|
+ <div url="/nop" right>
|
|
|
<div class="mb-2">
|
|
|
<textarea class="form-control form-control-sm ns-custom-comment min-width-200px" v-model="item.comments"></textarea>
|
|
|
</div>
|
|
@@ -193,7 +176,7 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
<span v-show="item.value && item.comments"
|
|
|
v-html="item.comments"
|
|
|
class="text-sm text-secondary">
|
|
|
- </span>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</label>
|
|
|
</div>
|
|
@@ -203,32 +186,29 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
</div>
|
|
|
<hr class="m-neg-4">
|
|
|
<div class="mb-2">
|
|
|
- <textarea class="form-control form-control-sm" v-model="data.comments">{!! $parsed && @$parsed->content ? @$parsed->content : '' !!}</textarea>
|
|
|
+ <textarea class="form-control form-control-sm" v-model="comments">{!! $parsed && @$parsed->content ? @$parsed->content : '' !!}</textarea>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
|
|
|
-
|
|
|
<div>
|
|
|
<button submit class="btn btn-sm btn-primary mr-2">Submit</button>
|
|
|
<button cancel class="btn btn-sm btn-default border">Cancel</button>
|
|
|
</div>
|
|
|
+
|
|
|
</form>
|
|
|
</div>
|
|
|
</div>
|
|
|
<script>
|
|
|
(function() {
|
|
|
+
|
|
|
window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function() {
|
|
|
- // any JS can come here
|
|
|
- // will be run on page-load as well as whenever this segment is refreshed
|
|
|
|
|
|
let model = <?= $contentData ? json_encode($contentData) : '{}' ?>;
|
|
|
model.newCustomItemLabel = '';
|
|
|
let customFields = <?= json_encode($customFields) ?>;
|
|
|
- if(!customFields) {
|
|
|
- customFields = [];
|
|
|
+ if(!model.customFields) {
|
|
|
+ model.customFields = [];
|
|
|
}
|
|
|
- model.customFields = [];
|
|
|
for (let i = 0; i < customFields.length; i++) {
|
|
|
let found = model.customFields.filter(function(_item) {
|
|
|
return _item.label === customFields[i];
|
|
@@ -242,14 +222,10 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- console.log(model);
|
|
|
-
|
|
|
new Vue({
|
|
|
el: '#edit-univ_history_past_medical-container',
|
|
|
delimiters: ["@{{","}}"],
|
|
|
- data: {
|
|
|
- data: model,
|
|
|
- },
|
|
|
+ data: model,
|
|
|
mounted: function() {
|
|
|
$('#edit-univ_history_past_medical-container [moe][initialized]').removeAttr('initialized');
|
|
|
initMoes();
|
|
@@ -258,7 +234,7 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
$data: {
|
|
|
handler: function(val, oldVal) {
|
|
|
let parent = $('#edit-univ_history_past_medical-container').closest('form');
|
|
|
- parent.find('[name="data"]').val(JSON.stringify(this.data));
|
|
|
+ parent.find('[name="data"]').val(JSON.stringify(this.$data));
|
|
|
},
|
|
|
deep: true
|
|
|
}
|
|
@@ -275,9 +251,9 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
}, function(_data) {
|
|
|
hideMask();
|
|
|
if(_data && _data.success) {
|
|
|
- self.appendCustomItem(_label);
|
|
|
hideMoeFormMask();
|
|
|
$('[custom-item-form]').hide();
|
|
|
+ $('.custom-items-container').closest('.visit-segment').find('.refresh-segment').trigger('click');
|
|
|
}
|
|
|
else {
|
|
|
toastr.error(_data.message);
|
|
@@ -289,20 +265,11 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
hideMoeFormMask();
|
|
|
$('div[moe]').hide();
|
|
|
return false;
|
|
|
- },
|
|
|
- appendCustomItem: function(_name) {
|
|
|
- this.customFields.push({
|
|
|
- label: _name,
|
|
|
- value: '',
|
|
|
- comments: '',
|
|
|
- });
|
|
|
- Vue.nextTick(function() {
|
|
|
- $('.custom-items-container [moe][initialized]').removeAttr('initialized');
|
|
|
- initMoes();
|
|
|
- });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
};
|
|
|
- })();
|
|
|
-</script>
|
|
|
+
|
|
|
+ }).call(window);
|
|
|
+</script>
|