|
@@ -936,5 +936,31 @@ ORDER BY m.ts DESC
|
|
|
return $this->hasOne(Status::class, 'id', 'client_engagement_status_id');
|
|
|
}
|
|
|
|
|
|
+ public function getDeviceDeliveryStatus($productId){
|
|
|
+ $result = DB::select("SELECT sh.status FROM shipment sh LEFT JOIN supply_order so ON so.shipment_id = sh.id WHERE so.product_id = ".$productId." AND so.client_id = ".$this->id." ORDER BY sh.created_at DESC LIMIT 1");
|
|
|
+ if (count($result)){
|
|
|
+ return $result[0]->status;
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 4 Infra-red Temperature gun
|
|
|
+ public function temparatureGunDeliveryStatus(){
|
|
|
+ return $this->getDeviceDeliveryStatus(4);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3 Pulse Oximeter (
|
|
|
+ public function pulseOximeterDeliveryStatus(){
|
|
|
+ return $this->getDeviceDeliveryStatus(3);
|
|
|
+ }
|
|
|
+ // 1 Cellular BP - Standard Arm Cuff (if delivered, then it should show its status as Delivered, Dispatched, In-transit, Returned)
|
|
|
+ public function cellularBPDeliveryStatus(){
|
|
|
+ return $this->getDeviceDeliveryStatus(1);
|
|
|
+ }
|
|
|
+ // 2 Weight scale
|
|
|
+ public function weightScaleDeliveryStatus(){
|
|
|
+ return $this->getDeviceDeliveryStatus(2);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|