Ver código fonte

Add method & location to note-creation & note-put-method

Vijayakrishnan 4 anos atrás
pai
commit
f31149ee85

+ 12 - 0
app/Models/CompanyLocation.php

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

+ 13 - 0
app/Models/Pro.php

@@ -426,4 +426,17 @@ class Pro extends Model
         return $foundNonMC;
     }
 
+    public function companyLocations() {
+        $companyProPayers = $this->companyProPayers;
+        $companyIDs = [];
+        foreach ($companyProPayers as $companyProPayer) {
+            $companyIDs[] = $companyProPayer->company_id;
+        }
+        $locations = [];
+        if(count($companyIDs)) {
+            $locations = CompanyLocation::whereIn('id', $companyIDs)->get();
+        }
+        return $locations;
+    }
+
 }

+ 4 - 0
public/css/style.css

@@ -1603,4 +1603,8 @@ th.only-screen, td.only-screen {
 .fill-bar {
     height: 20px !important;
     border: 1px solid #ddd;
+}
+
+.if-in-clinic {
+    display: none;
 }

+ 10 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -240,13 +240,22 @@
                             <form url="/api/note/updateMethod">
                                 <input type="hidden" name="uid" value="{{$note->uid}}">
                                 <div class="mb-2">
-                                    <select name="method" class="form-control form-control-sm" required>
+                                    <select name="method" class="form-control form-control-sm note-method-select" required>
                                         <option value="AUDIO" {{ $note->method === "AUDIO" ? "selected" : "" }}>Audio</option>
                                         <option value="VIDEO" {{ $note->method === "VIDEO" ? "selected" : "" }}>Video</option>
                                         <option value="IN_CLINIC" {{ $note->method === "IN_CLINIC" ? "selected" : "" }}>In-Clinic</option>
                                         <option value="HOUSE_CALL" {{ $note->method === "HOUSE_CALL" ? "selected" : "" }}>House Call</option>
                                     </select>
                                 </div>
+                                <div class="form-group if-in-clinic">
+                                    <label for="" class="text-secondary text-sm mb-1">Location</label>
+                                    <select name="hcpCompanyLocationUid" class="form-control">
+                                        <option value="-- select --"></option>
+                                        @foreach($pro->companyLocations() as $location)
+                                            <option value="{{$location->uid}}" {{$location->id === $note->hcp_company_location_id ? 'selected' : ''}}>{{$location->line1}} {{$location->city}}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
                                 <div class="mb-0">
                                     <button class="btn btn-primary btn-sm" submit>Submit</button>
                                     <button class="btn btn-default border btn-sm" cancel>Cancel</button>

+ 21 - 0
resources/views/app/patient/note/dashboard_script.blade.php

@@ -4,6 +4,27 @@
             let numSectionsPendingInitialization = 0;
 
             function init() {
+
+                $('.note-method-select').change(function() {
+                    let form = $(this).closest('form');
+                    if(this.value === 'IN_CLINIC') {
+                        form.find('.if-in-clinic').show();
+                    }
+                    else {
+                        form.find('.if-in-clinic').hide();
+                    }
+                });
+
+                $('.note-method-select').each(function() {
+                    let form = $(this).closest('form');
+                    if(this.value === 'IN_CLINIC') {
+                        form.find('.if-in-clinic').show();
+                    }
+                    else {
+                        form.find('.if-in-clinic').hide();
+                    }
+                });
+
                 $('textarea[rte]').each(function() {
 
                     $(this).wrap(

+ 31 - 1
resources/views/app/patient/notes.blade.php

@@ -8,18 +8,38 @@
             <span class="mx-2 text-secondary">|</span>
             <div moe>
                 <a start show class="py-0 mb-3">Add</a>
-                <form url="/api/note/createUsingFreeTextHtml" class="mcp-theme-1"
+                <form url="/api/note/create" class="mcp-theme-1"
                       redir="patients/view/{{ $patient->uid }}/notes/view/[data]">
                     <input type="hidden" name="clientUid" value="{{$patient->uid}}">
                     <input type="hidden" name="hcpProUid" value="{{$pro->uid}}">
                     <input type="hidden" name="effectiveDateEST" value="{{ date('Y-m-d') }}">
                     <div class="form-group">
+                        <label for="" class="text-secondary text-sm mb-1">Type *</label>
                         <select name="newOrFuOrNa" class="form-control">
                             <option value="NEW">New Patient</option>
                             <option value="FU">Follow Up</option>
                             <option value="NA">N/A</option>
                         </select>
                     </div>
+                    <div class="form-group">
+                        <label for="" class="text-secondary text-sm mb-1">Method *</label>
+                        <select name="method" class="form-control note-method-select" required>
+                            <option value="">-- select --</option>
+                            <option value="VIDEO">Video</option>
+                            <option value="AUDIO">Audio</option>
+                            <option value="IN_CLINIC">In Clinic</option>
+                            <option value="HOUSE_CALL">House Call</option>
+                        </select>
+                    </div>
+                    <div class="form-group if-in-clinic">
+                        <label for="" class="text-secondary text-sm mb-1">Location</label>
+                        <select name="hcpCompanyLocationUid" class="form-control">
+                            <option value="-- select --"></option>
+                            @foreach($pro->companyLocations() as $location)
+                                <option value="{{$location->uid}}">{{$location->line1}} {{$location->city}}</option>
+                            @endforeach
+                        </select>
+                    </div>
                     <div>
                         <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
                         <button cancel class="btn btn-sm btn-default border">Cancel</button>
@@ -159,6 +179,16 @@
                             }
                         }, 'json');
                     });
+
+                $('.note-method-select').change(function() {
+                    let form = $(this).closest('form');
+                    if(this.value === 'IN_CLINIC') {
+                        form.find('.if-in-clinic').show();
+                    }
+                    else {
+                        form.find('.if-in-clinic').hide();
+                    }
+                });
             }
             addMCInitializer('notes-list', initNotesList);
         })();