Просмотр исходного кода

Merge branch 'dev' into dev-vj

Vijayakrishnan 3 лет назад
Родитель
Сommit
5be15f9ea6

+ 6 - 0
app/Http/Controllers/HomeController.php

@@ -29,6 +29,7 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Cookie;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Http;
+use App\Models\OutgoingEmailTemplate;
 
 class HomeController extends Controller
 {
@@ -2066,4 +2067,9 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
         }
         return view('app.generic-bills.inline', ['class' => 'p-3 border-top mt-3', 'entityType' => $entityType, 'entityUid' => $entityUid, 'patient' => $patient]);
     }
+
+    public function outgoingEmailTemplates(Request $request){
+        $templates = OutgoingEmailTemplate::where('is_active', true)->orderBy('default_subject_tpl', 'ASC')->get();
+        return $this->pass($templates);
+    }
 }

+ 11 - 0
app/Models/OutgoingEmailTemplate.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class OutgoingEmailTemplate extends Model
+{
+    protected $table = 'outgoing_email_template';
+
+}

+ 2 - 2
resources/views/app/patient/note/_create-bill-only.blade.php

@@ -41,10 +41,10 @@
                         }
                         else if($note->new_or_fu_or_na === 'FU') {
                             if($note->method === 'VIDEO') {
-                                $maxMinutes = 75;
+                                $maxMinutes = 90;
                             }
                             else if($note->method === 'AUDIO') {
-                                $maxMinutes = 60;
+                                $maxMinutes = 90;
                             }
                         }
                     ?>

+ 2 - 2
resources/views/app/patient/note/_create-bill.blade.php

@@ -36,10 +36,10 @@
                     }
                     else if($note->new_or_fu_or_na === 'FU') {
                         if($note->method === 'VIDEO') {
-                            $maxMinutes = 75;
+                            $maxMinutes = 90;
                         }
                         else if($note->method === 'AUDIO') {
-                            $maxMinutes = 60;
+                            $maxMinutes = 90;
                         }
                     }
                 ?>

+ 11 - 11
resources/views/app/patient/segment-templates/covid_follow-up/summary.blade.php

@@ -70,13 +70,13 @@ if (!!@$point->data) {
     <div class="mb-2">
         <label>Asked patient if they have already signed up for government supplied COVID-19 home diagnostic kits? Patient replied:</label>
         @if(@$contentData['ans_has_signed_up_for_gvt_covid_kit'] == 'yes')
-        {{segment_template_summary_value_display('Yes') }}
+        <?= segment_template_summary_value_display('Yes') ?>
         @elseif(@$contentData['ans_has_signed_up_for_gvt_covid_kit'] == 'no')
-        {{segment_template_summary_value_display('No') }}
+        <?= segment_template_summary_value_display('No') ?>
         @elseif(@$contentData['ans_has_signed_up_for_gvt_covid_kit'] == 'not_sure')
-        {{segment_template_summary_value_display('Not Sure') }}
+        <?= segment_template_summary_value_display('Not Sure') ?>
         @else
-        {{segment_template_summary_value_display('') }}
+        <?= segment_template_summary_value_display('') ?>
         @endif
     </div>
 
@@ -84,13 +84,13 @@ if (!!@$point->data) {
     <div class="mb-2">
         <label>Asked patient if we can apply on CovidTests.gov for them? Patient replied:</label>
         @if(@$contentData['ans_apply_gvt_covid_kit_for_patient'] == 'yes')
-        {{segment_template_summary_value_display('Yes') }}
+        <?= segment_template_summary_value_display('Yes') ?>
         @elseif(@$contentData['ans_apply_gvt_covid_kit_for_patient'] == 'no')
-        {{segment_template_summary_value_display('No') }}
+        <?= segment_template_summary_value_display('No') ?>
         @elseif(@$contentData['ans_apply_gvt_covid_kit_for_patient'] == 'not_sure')
-        {{segment_template_summary_value_display('Not Sure') }}
+        <?= segment_template_summary_value_display('Not Sure') ?>
         @else
-        {{segment_template_summary_value_display('') }}
+        <?= segment_template_summary_value_display('') ?>
         @endif
     </div>
     @endif
@@ -149,7 +149,7 @@ if (!!@$point->data) {
     <div class="mb-2">
         @if(@$contentData['ans_has_answered_all_covid_19_questions'] == 'yes')
             <label>Answered all questions relating to COVID-19.</label>
-            {{segment_template_summary_value_display('Patient verbalizes understanding.')}}
+            <?= segment_template_summary_value_display('Patient verbalizes understanding.') ?>
         @elseif(@$contentData['ans_has_answered_all_covid_19_questions'] == 'no')
 
         @endif
@@ -182,12 +182,12 @@ if (!!@$point->data) {
 
     <div class="mb-2">
         <label>Asked patient, how are you doing regarding stress? Patient replied:</label>
-        {{segment_template_summary_value_display(@$contentData['ans_how_patient_is_doing_regarding_stress'])}}
+        <?= segment_template_summary_value_display(@$contentData['ans_how_patient_is_doing_regarding_stress']) ?>
     </div>
 
     <div class="mb-2">
         <label>Conducted PHQ-2 with patient. Patient score is:</label>
-        {{segment_template_summary_value_display(@$contentData['total_phq2'])}}
+        <?= segment_template_summary_value_display(@$contentData['total_phq2']) ?>
     </div>
 
     @if((int) @$contentData['total_phq2'] > 3)

+ 128 - 0
resources/views/app/patient/send_email.blade.php

@@ -0,0 +1,128 @@
+<style>
+#outgoingEmailTemplate .ql-editor {
+    padding: 0 15px 15px 15px;
+}
+#outgoingEmailTemplate .ql-snow.ql-toolbar button, 
+#outgoingEmailTemplate .ql-snow .ql-toolbar button {
+    min-width: initial;
+    border: none;
+    background-color: #f7f7f7;
+}
+#outgoingEmailTemplate .ql-toolbar.ql-snow {
+    background-color: #f7f7f7;
+}
+</style>
+<div class="d-inline" id="outgoingEmailTemplate">
+    <div moe wide center class="ml-auto">
+        <a show href="" start>Send Email</a>
+        <form url="/api/imail/create">
+            <div id="outgoingEmailTemplateComponent" v-cloak>
+                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+
+                <div class="form-group">
+                    <label for="" class="control-label">Ougoing Email Template</label>
+                    <select name="outgoingEmailTemplate" class="form-control input-sm" @change="setTemplate">
+                        <option value=""></option>
+                        <option v-for="(template,i) in templates" v-bind:value="i">@{{ template.default_subject_tpl }}</option>
+                    </select>
+                </div>
+
+                <div class="form-group">
+                    <label for="" class="control-label">From Email</label>
+                    <input type="email" name="fromEmailAddress" class="form-control input-sm" v-model="template.default_from_email" />
+                </div>
+                <div class="form-group">
+                    <label for="" class="control-label">From Name</label>
+                    <input class="form-control input-sm" type="text" name="fromName" v-model="template.default_from_name">
+                </div>
+                <div class="form-group">
+                    <label for="" class="control-label">To Email</label>
+                    <input class="form-control input-sm" type="email" name="toEmailAddress" value="{{$patient->email_address}}">
+                </div>
+                <div class="form-group">
+                    <label for="" class="control-label">Subject</label>
+                    <input class="form-control input-sm" type="text" name="subject" v-model="template.default_subject_tpl">
+                </div>
+                <div class="form-group">
+                    <label for="" class="control-label">Body</label>
+                    <div id="htmlBody"></div>
+                    <input type="hidden" name="htmlBody" v-model="template.default_message_body_tpl" />
+                </div>
+            </div>
+            <div class="form-group">
+                <button class="btn btn-primary btn-sm" submit>Submit</button>
+                <button class="btn btn-primary btn-sm" cancel>Cancel</button>
+            </div>
+        </form>
+    </div>
+</div>
+
+
+<script>
+    (function() {
+        function init() {
+            var outgoingEmailTemplate = new Vue({
+                el: '#outgoingEmailTemplateComponent',
+                data: {
+                    templates: [],
+                    template: {
+                        default_from_email: 'carelink@leadershiphealth.org'
+                    },
+                    fromEmailAddresses: [
+                        'carelink@leadershiphealth.org'
+                    ]
+                },
+                methods: {
+                    setTemplate: function(evt) {
+                        var self = this;
+                        var input = evt.target;
+                        var value = parseInt(evt.target.value);
+                        if (isNaN(value)) {
+                            self.template = {};
+                            return;
+                        }
+                        self.template = self.templates[value];
+                        self.quill.root.innerHTML = self.template.default_message_body_tpl;
+                    },
+                    loadOugoingEmailTemplates: function() {
+                        var self = this;
+                        $.get("{{ route('outgoingEmailTemplates') }}", {}, function(response) {
+                            self.templates = response.data;
+                        }, 'json');
+                    },
+                    initQuillEditor: function() {
+                        var self = this;
+                        self.quill = new Quill('#htmlBody', {
+                            theme: 'snow',
+                            modules:{
+                                'syntax': true,
+                                'toolbar': [
+                                [{ 'font': [] }, { 'size': [] }],
+                                [ 'bold', 'italic', 'underline', 'strike' ],
+                                [{ 'color': [] }, { 'background': [] }],
+                                [{ 'script': 'super' }, { 'script': 'sub' }],
+                                [{ 'header': '1' }, { 'header': '2' }],
+                                [{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
+                                [ 'direction', { 'align': [] }],
+                                [ 'link', 'image', 'video'],
+                                [ 'clean' ]
+                            ]
+                            }
+                        });
+                        self.quill.on('text-change', function (delta, oldDelta, source) {
+                            $('[name="htmlBody"]').val(self.quill.root.innerHTML);
+                        });
+                    },
+                    init: function() {
+                        this.loadOugoingEmailTemplates();
+                        this.initQuillEditor();
+                    }
+                },
+                mounted: function() {
+                    this.init();
+                }
+            });
+        }
+        addMCInitializer('outgoingEmailTemplate', init);
+    })();
+</script>

+ 10 - 1
resources/views/layouts/patient.blade.php

@@ -660,7 +660,7 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 													<input type="hidden" name="uid" value="{{$patient->uid}}">
 													<div class="mb-2">
 														<label class="text-secondary text-sm">Sticky Note</label>
-														<textarea name="stickyNote" class="form-control" rows="8" cols="80"></textarea>
+														<textarea name="stickyNote" class="form-control" rows="8" cols="80">{{$patient->sticky_note}}</textarea>
 													</div>
 													<div>
 														<button submit class="btn btn-sm btn-primary mr-1">Submit
@@ -745,8 +745,17 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 												</a>
 											</div>
 										</li>
+
+										<li class="d-flex align-items-baseline">
+											
+											<div class="d-inline-flex screen-only">
+												@include('app.patient.send_email')
+											</div>
+										</li>
 									</ul>
+									
 								</div>
+								
 							</div>
 						</div> <!-- z -->
 					</div>

+ 1 - 1
routes/web.php

@@ -643,5 +643,5 @@ Route::post("/process_form_submit", 'NoteController@processFormSubmit')->name('p
 Route::get("/get-default-section-data/{patientID}/{sectionTemplateID}", 'NoteController@getDefaultValueForSection')->name('get_default_section_data');
 
 Route::get("/get-segment-html/{segmentUid}/{sessionKey}", 'NoteController@getHtmlForSegment')->name('get_segment_html');
-
+Route::get("/ougoing-email-templates", 'HomeController@outgoingEmailTemplates')->name('outgoingEmailTemplates');
 Route::any("/nop", 'HomeController@nop')->name('nop');