Ver código fonte

Clone support for old notes

Vijayakrishnan 3 anos atrás
pai
commit
b6ab192068
1 arquivos alterados com 29 adições e 0 exclusões
  1. 29 0
      resources/views/app/patient/note/dashboard.blade.php

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

@@ -202,6 +202,8 @@
                                 </div>
                             </form>
                         </div>
+                    @else
+                        <a href="#" class="text-primary trigger-clone ml-2 pl-2 border-left" data-uid="{{$note->uid}}">Clone</a>
                     @endif
                 @endif
             </div>
@@ -2472,6 +2474,33 @@
     @include('app.patient.note.dashboard_script')
     @if(!$isVisitTemplateBased)
     @include('app.patient.canvas-sections.canvas-editor-modal', ['key' => 'rx', 'class' => 'wide', 'noEditLink' => true])
+    <script>
+        (function() {
+            function init() {
+                $('.trigger-clone')
+                    .off('click.clone')
+                    .on('click.clone', function() {
+                        $.post('/api/note/clone', {
+                            uid: $(this).attr('data-uid')
+                        }, function(_data) {
+                            if(_data) {
+                                if(_data.success) {
+                                    toastr.success('Note cloned successfully');
+                                    fastLoad('/patients/view/{{$patient->uid}}/notes/view/' + _data.data);
+                                }
+                                else {
+                                    toastr.error(_data.message);
+                                }
+                            }
+                            else {
+                                toastr.error('Unable to clone the note!');
+                            }
+                        }, 'json');
+                    });
+            }
+            addMCInitializer('non-visit-template', init, '#note-single-header');
+        })();
+    </script>
     @endif
     @if($isVisitTemplateBased)
     <script>