Vijayakrishnan 3 роки тому
батько
коміт
633233d1ee

+ 32 - 5
resources/views/app/patient/prescriptions/index.blade.php

@@ -84,7 +84,18 @@
                         <div>@{{prescription.hcpProDisplayName}}</div>
                     </div>
                 </td>
-                <td class="px-2"></td>
+                <td class="px-2">
+                    <div v-if="prescription.has_hcp_pro_signed" class="d-flex align-items-baseline">
+                        <i class="text-secondary fa fa-check mr-1"></i>
+                        <span class="text-secondary">Signed</span>
+                    </div>
+                    <div v-else>
+                        <a v-if="prescription.hcp_pro_id === {{$pro->id}}"
+                           href="#"
+                           v-on:click.prevent="signAsHcpPro(prescription)">Sign</a>
+                        <span v-else>-</span>
+                    </div>
+                </td>
                 <td class="px-2">@{{prescription.pro_declared_status}}</td>
                 <td class="px-2">@{{prescription.client_declared_status}}</td>
                 <td class="px-2"></td>
@@ -99,6 +110,7 @@
         @include('app.patient.prescriptions.other-form')
         @include('app.patient.prescriptions.logistics-form')
         @include('app.patient.prescriptions.hcp-pro-form')
+        @include('app.patient.prescriptions.sign-as-hcp-form')
     </div>
     <script>
         (function() {
@@ -419,11 +431,26 @@
                         },
 
                         // edit sign
-                        editHcpProSign: function(_prescription) {
-
+                        signAsHcpPro: function(_prescription) {
+                            this.currentPrescriptionAction = 'SIGN_AS_HCP';
+                            this.currentPrescriptionType = _prescription.erx_category;
+                            this.currentPrescriptionSign = {
+                                uid: _prescription.uid,
+                                declaredVersionNumber: _prescription.version_number
+                            };
+                            Vue.nextTick(() => {
+                                showStagPopup('sign-as-hcp-popup', true);
+                            });
                         },
-                        saveHcpProSign: function() {
-
+                        saveSignAsHcpPro: function() {
+                            let payload = JSON.parse(JSON.stringify(this.currentPrescriptionSign));
+                            $.post('/api/erx/signAsHcp', payload, _data => {
+                                if(!hasResponseError(_data)) {
+                                    toastr.success('Signed');
+                                    closeStagPopup();
+                                    fastReload();
+                                }
+                            }, 'json');
                         },
 
                         // edit pro status

+ 16 - 0
resources/views/app/patient/prescriptions/sign-as-hcp-form.blade.php

@@ -0,0 +1,16 @@
+<div class="stag-popup stag-popup-sm mcp-theme-1 min-height-unset" stag-popup-key="sign-as-hcp-popup">
+    <form method="POST" action="" class="overflow-visible">
+        <h3 class="stag-popup-title mb-2">
+            <span>Sign as HCP Pro</span>
+            <a href="#" class="ml-auto text-secondary"
+               onclick="return closeStagPopup()"><i class="fa fa-times-circle"></i></a>
+        </h3>
+        <p>Sign as HCP Pro?</p>
+        <div class="d-flex align-items-center justify-content-center mt-3">
+            <button type="button" class="btn btn-sm btn-success mr-2" v-on:click.prevent="saveSignAsHcpPro()">Sign
+            </button>
+            <button type="button" class="btn btn-sm btn-default border" onclick="return closeStagPopup()">Cancel
+            </button>
+        </div>
+    </form>
+</div>