Selaa lähdekoodia

Visit moe - templates support

Vijayakrishnan 3 vuotta sitten
vanhempi
commit
e29a4ada7f

+ 42 - 0
resources/views/app/patient/note/_templates-v2-index.blade.php

@@ -0,0 +1,42 @@
+<?php
+$templateIndex = json_decode(file_get_contents(storage_path('templates/index.json')));
+$hasTemplates = false;
+if(isset($templateIndex->{$sectionInternalName})) {
+    $hasTemplates = true;
+    $templateName = '';
+    $defaultTemplateName = '';
+    foreach($templateIndex->{$sectionInternalName} as $k => $templateSet) {
+        if($templateName === '') $templateName = $k;
+        if($templateSet->default) $defaultTemplateName = $k;
+    }
+    if($defaultTemplateName !== '') $templateName = $defaultTemplateName;
+?>
+    <span class="mx-2 text-secondary text-sm d-none if-edit">|</span>
+    <span class="position-relative d-none if-edit">
+        <a href="#" class="note-templates-trigger">Templates</a>
+        <div class="note-template-container">
+            <div class="position-relative w-100">
+                <div class="note-template-output">
+                    <div class="font-weight-bold text-secondary">Result:</div>
+                    <div class="note-template-output-text"></div>
+                </div>
+                <div class="note-template-buttons d-flex align-items-center">
+                    <button class="btn btn-sm btn-default bg-white border text-primary border-primary note-template-apply-trigger">Apply</button>
+                    <button class="btn btn-sm btn-default bg-light border text-secondary border-secondary note-template-close-trigger">Close</button>
+                </div>
+            </div>
+            <div class="p-1 border border-bottom">
+                <select class="form-control form-control-sm note-template-set-chooser" data-section="{{$sectionInternalName}}">
+                    @foreach($templateIndex->{$sectionInternalName} as $k => $templateSet)
+                        <option value="{{$k}}" {{$k === $templateName ? 'selected' : ''}}>{{$templateSet->name}}</option>
+                    @endforeach
+                </select>
+            </div>
+            {{--@include('app/patient/note/_template')--}}
+        </div>
+    </span>
+<?php
+}
+?>
+
+

+ 2 - 0
resources/views/app/patient/note/segment.blade.php

@@ -17,6 +17,8 @@
 			Refresh
 		</a>
 
+		@include('app/patient/note/_templates-v2-index', ['sectionInternalName' => $segment->segmentTemplate->internal_name])
+
 		<span class="mx-2 text-secondary text-sm d-none if-edit">|</span>
 
 		<!-- toggle to read mode -->