Browse Source

SO - allow cellular create if rmCompany != null

Vijayakrishnan Krishnan 2 năm trước cách đây
mục cha
commit
78d99bf30c
2 tập tin đã thay đổi với 23 bổ sung12 xóa
  1. 4 0
      app/Models/Pro.php
  2. 19 12
      resources/views/app/patient/supply-orders.blade.php

+ 4 - 0
app/Models/Pro.php

@@ -73,6 +73,10 @@ class Pro extends Model
        return $this->is_considered_for_dna && !$this->is_hcp;
     }
 
+    public function rmCompany() {
+        return $this->hasOne(Company::class, 'id', 'rm_company_id');
+    }
+
     public function lastPayment() {
         return ProTransaction
             ::where('pro_id', $this->id)

+ 19 - 12
resources/views/app/patient/supply-orders.blade.php

@@ -9,20 +9,27 @@
                     <a start show href="#">Add</a>
                     <form url="/api/supplyOrder/createAndSignAsPro" redir="/patients/view/{{ $patient->uid }}/supply-orders/[data]?{{request()->input('popupmode') ? 'popupmode=1' : ''}}&note-uid={{request()->input('note-uid')}}">
 
-                        @if(!$patient->has_cm_setup_been_performed)
-                            <p class="font-weight-bold alert alert-warning border-warning mb-2">You need to complete the patient's comprehensive care plan before ordering cellular devices.</p>
-                        @endif
+                        <?php
+                        $showWarnings = true;
+                        if($patient->mcp && $patient->mcp->rmCompany) $showWarnings = false;
+                        ?>
 
-                        @if(!$patient->is_bp_and_pulse_updated)
-                            <p class="font-weight-bold alert alert-warning border-warning mb-2">
-                                You need to complete the patient's BP settings before ordering cellular BP device.
-                            </p>
-                        @endif
+                        @if($showWarnings)
+                            @if(!$patient->has_cm_setup_been_performed)
+                                <p class="font-weight-bold alert alert-warning border-warning mb-2">You need to complete the patient's comprehensive care plan before ordering cellular devices.</p>
+                            @endif
 
-                        @if(!$patient->is_weight_and_bmi_settings_updated)
-                            <p class="font-weight-bold alert alert-warning border-warning mb-2">
-                                You need to complete the patient's Weight/BMI settings before ordering cellular weight scale.
-                            </p>
+                            @if(!$patient->is_bp_and_pulse_updated)
+                                <p class="font-weight-bold alert alert-warning border-warning mb-2">
+                                    You need to complete the patient's BP settings before ordering cellular BP device.
+                                </p>
+                            @endif
+
+                            @if(!$patient->is_weight_and_bmi_settings_updated)
+                                <p class="font-weight-bold alert alert-warning border-warning mb-2">
+                                    You need to complete the patient's Weight/BMI settings before ordering cellular weight scale.
+                                </p>
+                            @endif
                         @endif
 
                         <input type="hidden" name="clientUid" value="{{ $patient->uid }}">