|
@@ -0,0 +1,143 @@
|
|
|
+@foreach($note->sections as $section)
|
|
|
+ <?php
|
|
|
+ $sectionTS = strtotime($section->created_at);
|
|
|
+ if($latestSectionTS === 0 || $latestSectionTS < $sectionTS) {
|
|
|
+ $latestSectionTS = $sectionTS;
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ <div data-ts="{{$sectionTS}}"
|
|
|
+ class="p-3 border-bottom note-section {{ $note->is_signed_by_hcp ? 'signed-note' : '' }} {{ $section->is_initialized ? '' : 'pending-initialization' }}"
|
|
|
+ {!! $note->is_signed_by_hcp ? 'title="Signed note. Cannot be edited further."' : '' !!}
|
|
|
+ data-section-uid="{{ $section->uid }}"
|
|
|
+ data-section-template-uid="{{ $section->sectionTemplate->uid }}"
|
|
|
+ data-section-template-name="{{ $section->sectionTemplate->internal_name }}">
|
|
|
+
|
|
|
+ <div class="d-flex align-items-start">
|
|
|
+ @if(!$note->is_signed_by_hcp)
|
|
|
+ <a class="font-weight-bold mb-2 d-flex align-items-center c-pointer">
|
|
|
+ {{$section->sectionTemplate->title}}
|
|
|
+ <span class="d-none if-not-edit"><i class="fa fa-edit ml-2"></i></span>
|
|
|
+ <span class="edit-trigger"></span>
|
|
|
+ </a>
|
|
|
+ @else
|
|
|
+ <span class="font-weight-bold mb-2 d-flex align-items-center">
|
|
|
+ {{$section->sectionTemplate->title}}
|
|
|
+ </span>
|
|
|
+ @endif
|
|
|
+ <?php $sectionInternalName = $section->sectionTemplate->internal_name; ?>
|
|
|
+ @if($sectionInternalName === "exam" || $sectionInternalName === "objective")
|
|
|
+ @include('app/patient/note/_templates-exam-index')
|
|
|
+ @else
|
|
|
+ @include('app/patient/note/_templates-index')
|
|
|
+ @endif
|
|
|
+
|
|
|
+ <?php
|
|
|
+ if(file_exists(storage_path('sections/' . $sectionInternalName . '/actions.php'))) {
|
|
|
+ include(storage_path('sections/' . $sectionInternalName . '/actions.php'));
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ <?php
|
|
|
+ if(file_exists(storage_path('sections/' . $sectionInternalName . '/actions.blade.php'))) {
|
|
|
+ ?> @include('sections/' . $sectionInternalName . '/actions') <?php
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+
|
|
|
+ <a href="#" class="d-none text-danger if-edit ml-auto remove-section-trigger mr-1"
|
|
|
+ data-uid="{{$section->uid}}"
|
|
|
+ title="Remove {{$section->sectionTemplate->title}}">
|
|
|
+ Remove {{$section->sectionTemplate->title}}
|
|
|
+ </a>
|
|
|
+
|
|
|
+ <a href="#" class="d-none if-edit ml-2 move-up-trigger" data-uid="{{$section->uid}}" title="Move Up">
|
|
|
+ <i class="fa fa-arrow-up"></i>
|
|
|
+ </a>
|
|
|
+
|
|
|
+ <a href="#" class="d-none if-edit ml-2 move-down-trigger" data-uid="{{$section->uid}}" title="Move Down">
|
|
|
+ <i class="fa fa-arrow-down"></i>
|
|
|
+ </a>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div class="d-none if-not-edit inset-comment">{!! !empty($section->summary_html) ? $section->summary_html : '-' !!}</div>
|
|
|
+
|
|
|
+ <div class="d-none if-edit">
|
|
|
+ <?php
|
|
|
+ $contentData = false;
|
|
|
+ if($section){
|
|
|
+ $contentData = json_decode($section->content_data, true);
|
|
|
+ }
|
|
|
+ if(!$contentData || !isset($contentData['value'])) {
|
|
|
+ $contentData = [
|
|
|
+ 'value'=>''
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $formID = rand(0, 100000);
|
|
|
+ ?>
|
|
|
+ <form ajax-form method="POST" action="/process_form_submit">
|
|
|
+
|
|
|
+ <input type="hidden" name="section_uid" value="<?= $section->uid?>">
|
|
|
+
|
|
|
+ <input type="hidden" name="data" value="">
|
|
|
+
|
|
|
+ <?php
|
|
|
+ if(file_exists(storage_path('sections/' . $sectionInternalName . '/form.blade.php'))) {
|
|
|
+ include(storage_path('sections/' . $sectionInternalName . '/form.blade.php'));
|
|
|
+ }else{
|
|
|
+ ?>
|
|
|
+ <div note-rte data-content="{{$contentData['value']}}" class="form-group mb-2 border-left border-right rte-holder"></div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+
|
|
|
+ <div class="form-group m-0 d-flex">
|
|
|
+ <button class="btn btn-sm btn-primary mr-2">Submit</button>
|
|
|
+ <button class="btn btn-sm btn-default border" onclick="return cancelFormNoteSection(this)">Cancel</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ @endforeach
|
|
|
+ <script>
|
|
|
+ $(document).ready(function(){
|
|
|
+ $('[note-rte]').each(function(){
|
|
|
+ var el = this;
|
|
|
+ var existingContent = $(el).attr('data-content');
|
|
|
+ var quill = new Quill(el, {
|
|
|
+ theme: 'snow',
|
|
|
+ modules: {
|
|
|
+ keyboard: {
|
|
|
+ bindings: {
|
|
|
+ handleEnter: {
|
|
|
+ key: 13,
|
|
|
+ handler: function() {
|
|
|
+ if(!$('.stag-shortcuts:visible').length) return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ quill.root.innerHTML = existingContent;
|
|
|
+
|
|
|
+ quill.on('text-change', function(delta, oldDelta, source){
|
|
|
+ var content = quill.root.innerHTML;
|
|
|
+ var dataValue = JSON.stringify({value: content});
|
|
|
+ var dataField = $(el).closest('form').find('input[name=data]').val(dataValue);
|
|
|
+ });
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ $('[ajax-form]').each(function(){
|
|
|
+ showMask();
|
|
|
+ $(this).ajaxForm(function(result){
|
|
|
+ console.log("DONE: "+result);
|
|
|
+ fastReload();
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+ function cancelFormNoteSection(el) {
|
|
|
+ $(el).closest('.note-section').toggleClass('edit');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ </script>
|