Explorar el Código

MCN - click to view

Vijayakrishnan hace 3 años
padre
commit
acd69fe3fa

+ 16 - 0
public/js/show-on-click.js

@@ -0,0 +1,16 @@
+(function() {
+    function init() {
+        $(document)
+            .off('click.show-on-click', '.show-on-click')
+            .on('click.show-on-click', '.show-on-click', function(_e) {
+                if($(this).text() === $(this).attr('data-value')) {
+                    $(this).text('Click to view');
+                }
+                else {
+                    $(this).text($(this).attr('data-value'));
+                }
+                return false;
+            });
+    }
+    addMCInitializer('show-on-click', init);
+})();

+ 8 - 2
resources/views/app/patient/settings.blade.php

@@ -871,7 +871,8 @@
                     <div class="bg-light border p-2">
                     @php
                     function displayNode($_key, $_node) {
-                        $nodeOutput = '<div class="mb-1">' . ucwords(str_replace("_", " ", $_key)) . ': ';
+                        $keyDisplay = ucwords(str_replace("_", " ", $_key));
+                        $nodeOutput = '<div class="mb-1">' . $keyDisplay . ': ';
                         $nodeType = gettype($_node);
                         if(is_array($_node) && count($_node)) {
                             $nodeOutput .= '<div class="border-left pl-3 my-1">';
@@ -881,7 +882,12 @@
                             $nodeOutput .= '</div>';
                         }
                         else if(!is_array($_node)) {
-                            $nodeOutput .= '<b>' . (!empty($_node) ? $_node : '-') . '</b>';
+                            if($keyDisplay != 'Member Id') {
+                                $nodeOutput .= '<b>' . (!empty($_node) ? $_node : '-') . '</b>';
+                            }
+                            else {
+                                $nodeOutput .= '<b class="c-pointer text-primary show-on-click" data-value="' . (!empty($_node) ? $_node : '-') . '">Click to view</b>';
+                            }
                         }
                         else {
                             $nodeOutput .= '-';

+ 1 - 0
resources/views/layouts/template.blade.php

@@ -329,6 +329,7 @@
     <script src="/js/click-to-copy.js?v={{config('app.asset_version')}}"></script>
     <script src="/js/stag-popup.js?v={{config('app.asset_version')}}"></script>
     <script src="/js/option-list.js?v={{config('app.asset_version')}}"></script>
+    <script src="/js/show-on-click.js?v={{config('app.asset_version')}}"></script>
     @include('app/pdf/viewer')
     @if(config('app.enableSockets'))
     <script>