Browse Source

Updated note single edit feature

Vijayakrishnan Krishnan 4 năm trước cách đây
mục cha
commit
c2467724d7

+ 1 - 1
app/Models/Client.php

@@ -27,7 +27,7 @@ class Client extends Model
     }
 
     public function notes(){
-        return $this->hasMany(Note::class, 'client_id', 'id')->orderBy('id', 'desc');
+        return $this->hasMany(Note::class, 'client_id', 'id')->orderBy('created_at', 'desc');
     }
 
     public function duplicateOf(){

+ 9 - 0
public/css/style.css

@@ -188,10 +188,19 @@ body>nav.navbar {
 .cancelled-item {
     opacity: 0.5;
 }
+.cancelled-item * {
+    pointer-events: none;
+}
 .note-content:not([auto-edit]) {
     padding: 1rem;
     padding-bottom: 0;
     cursor: pointer;
+    position: relative;
+}
+.note-content:not(.cancelled):not([auto-edit]):after {
+    content: 'Click to change';
+    display: inline;
+    color: #535353;
 }
 .mcp-theme-1 .ql-container, .mcp-theme-1 .ql-toolbar {
     border-left: 0;

+ 2 - 1
public/js/mc.js

@@ -226,6 +226,7 @@ function onFastLoaded(_data, _href, _history) {
                     target = target.substr(target.indexOf('/') + 1);
                 }
             }
+            if(target[0] === '/') target = target.substr(1);
             window.top.history.pushState(target, null, '/mc/' + target);
         }
 
@@ -317,7 +318,7 @@ function initQuillEdit(_selector = '.note-content[auto-edit]') {
             else {
                 // toastr.success('Note saved');
                 // saveButton.prop('disabled', true);
-                fastLoad(window.location.pathname, false, false);
+                fastLoad(window.top.location.pathname.substr(3), false, false);
             }
         }, 'json');
     });

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

@@ -243,9 +243,9 @@
                 <div class="mb-3">
                     <div>
                         <div class="primary-form">
-                            <div class="note-content"
+                            <div class="note-content {{ $note->is_cancelled ? 'cancelled' : '' }}"
                                  data-note-uid="{{ $note->uid  }}"
-                                 {{ empty($note->free_text_html) ? 'auto-edit' : '' }}>{!! empty($note->free_text_html) ? 'Note Content' : $note->free_text_html !!}</div>
+                                 {{ !$note->is_cancelled && empty($note->free_text_html) ? 'auto-edit' : '' }}>{!! $note->free_text_html !!}</div>
                         </div>
                         {{--<div moe class="d-inline">
                             <a show start><i class="fa fa-edit"></i></a>