Browse Source

fixed visit clone

Josh 3 năm trước cách đây
mục cha
commit
f559d8fa61
2 tập tin đã thay đổi với 46 bổ sung6 xóa
  1. 8 4
      app/Models/Client.php
  2. 38 2
      resources/views/app/patient/notes.blade.php

+ 8 - 4
app/Models/Client.php

@@ -94,7 +94,8 @@ class Client extends Model
     {
         return $this->hasMany(Note::class, 'client_id', 'id')
            // ->where('is_core_note', false)
-            ->orderBy('effective_dateest', 'desc');
+            ->orderBy('effective_dateest', 'desc')
+            ->orderBy('created_at', 'desc');
     }
 
     public function prescriptions()
@@ -123,7 +124,8 @@ class Client extends Model
     public function notesAscending()
     {
         return $this->hasMany(Note::class, 'client_id', 'id')
-            ->orderBy('effective_dateest', 'asc');
+            ->orderBy('effective_dateest', 'asc')
+            ->orderBy('created_at', 'desc');;
     }
 
     public function mcCodeChecks(){
@@ -143,7 +145,8 @@ class Client extends Model
         return $this->hasMany(Note::class, 'client_id', 'id')
             ->where('is_cancelled', false)
             ->where('id', '<>', $this->core_note_id)
-            ->orderBy('effective_dateest', 'desc');
+            ->orderBy('effective_dateest', 'desc')
+            ->orderBy('created_at', 'desc');;
     }
 
     public function cancelledNotes()
@@ -151,7 +154,8 @@ class Client extends Model
         return $this->hasMany(Note::class, 'client_id', 'id')
             ->where('is_cancelled', true)
             ->where('id', '<>', $this->core_note_id)
-            ->orderBy('effective_dateest', 'desc');
+            ->orderBy('effective_dateest', 'desc')
+            ->orderBy('created_at', 'desc');;
     }
 
     public function sections()

+ 38 - 2
resources/views/app/patient/notes.blade.php

@@ -222,7 +222,43 @@
                         <a href="/patients/view/{{ $patient->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">Open</a>
                         @if($note->new_or_fu_or_na !== 'NEW')
                         <span class="px-2 text-secondary">|</span>
-                        <a href="#" class="text-primary trigger-clone" data-uid="{{$note->uid}}">Clone</a>
+                        <div moe>
+                            <a start show>Clone</a>
+                            <form url="/api/visit/clone" class="mcp-theme-1">
+                                <input type="hidden" name="visitToCloneUid" value="{{$note->uid}}">
+                                <div class="form-group">
+                                    <label for="" class="control-label">Effective Date</label>
+                                    <input type="date" name="effectiveDate" class="form-control input-sm">
+                                </div>
+                                <div class="form-group">
+                                    <label for="" class="control-label">New/Fu</label>
+                                    <select name="newOrFuOrNa" id="" class="form-control input-sm">
+                                        <option value="">--select--</option>
+                                        <option value="NEW">New</option>
+                                        <option value="FU">Fu</option>
+                                        <option value="NA">Na</option>
+                                    </select>
+                                </div>
+
+                                <div class="form-group">
+                                    <label for="" class="control-label">Method</label>
+                                    <select name="noteContactMethod" id="" class="form-control input-sm">
+                                        <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">
+                                    <label for="" class="control-label">Title</label>
+                                    <input type="text" name="title" class="form-control input-sm">
+                                </div>
+                                <div class="form-group m-0">
+                                    <button submit class="btn btn-primary btn-sm">submit</button>
+                                </div>
+                            </form>
+                        </div>
                         @endif
                     </div>
                 </td>
@@ -258,7 +294,7 @@
                 $('.trigger-clone')
                     .off('click.clone')
                     .on('click.clone', function() {
-                        $.post('/api/note/clone', {
+                        $.post('/api/visit/clone', {
                             uid: $(this).attr('data-uid')
                         }, function(_data) {
                             if(_data) {