Эх сурвалжийг харах

Merge branch 'sleep-apnea-intake-sam' into sleep-apnea-intake

Samson Mutunga 2 жил өмнө
parent
commit
57a3f1d45a

+ 25 - 1
resources/views/app/patient/modules/sleep_health_intake/edit.blade.php

@@ -52,7 +52,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 			<input type="hidden" name="data" value="{{json_encode($contentData)}}">
 
 			<div id="edit-sleep_health_intake-container" class="customized-form">
-
+				@include('app.patient.modules.sleep_health_intake.partials.cc')
 				@include('app.patient.modules.sleep_health_intake.partials.epworth_sleepiness_study')
 
 				@include('app.patient.modules.sleep_health_intake.partials.obstructive_sleep_apnea')
@@ -183,6 +183,29 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 							self.calculateScore();
 						});
 					},
+					initOmegaCC: function(){
+						var self = this;
+						const options = { theme: "snow" };
+						var quill = new Quill('#omegaCCEditor', options);
+						quill.on('text-change', function(delta, oldDelta, source) {
+							var html = quill.root.innerHTML;
+							// auto-save omega_cc
+							var quillTarget = $('#omegaCCEditor');
+							var segmentUid = quillTarget.data('segment-uid');
+							var segmentCategory = quillTarget.data('segment-category');
+							var noteUid = quillTarget.data('note-uid');
+							var uid = quillTarget.data('uid');
+							var data = {free_text:html};
+							var formData = {
+								// uid: uid,
+								segmentUid: segmentUid,
+								category: segmentCategory,
+								data: JSON.stringify(data)
+							};
+							var url = '/api/visitPoint/upsertNoteSingleton';
+							$.post(url, formData, function(response) {}, 'json');
+						});
+					},
 				},
 				mounted: function() {
 					if (!this.data.dropdownOptions) {
@@ -191,6 +214,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 					}
 					this.initSelect2();
 					this.initOnSelectChange();
+					this.initOmegaCC();
 				}
 			});
 

+ 15 - 0
resources/views/app/patient/modules/sleep_health_intake/partials/cc.blade.php

@@ -0,0 +1,15 @@
+<?php
+
+use App\Models\Point;
+
+$ccSegment = $note->getSegmentByInternalName('omega_cc');
+$ccSegmentPoint = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'CHIEF_COMPLAINT', $sessionKey);
+?>
+<div id="" class="row">
+    <div class="col-md-12">
+    <div class="bg-light p-2 border mb-3">
+        <h6 class="font-weight-bold">Chief Complaint:</h6>
+        <div id="omegaCCEditor" data-uid="{{ $ccSegmentPoint->uid }}" data-note-uid="{{ $note->uid }}" data-segment-uid="{{ $ccSegment->uid }}" data-segment-category="CHIEF_COMPLAINT"><?= $ccSegment->summary_html ?></div>
+    </div>
+    </div>
+</div>