فهرست منبع

Merge branch 'master' of rav.triplestart.com:jmudaka/stagfe2 into dev

= 4 سال پیش
والد
کامیت
78cd62840e

+ 28 - 0
app/Helpers/helpers.php

@@ -28,6 +28,20 @@ if(!function_exists('friendly_date_time')) {
     }
 }
 
+if(!function_exists('friendlier_date_time')) {
+    function friendlier_date_time($value, $includeTime = true, $default = '-') {
+        if(!$value || empty($value)) return $default;
+        try {
+            $result = strtotime($value);
+            $result = date("j M" . ($includeTime ? ", h:i a" : ""), $result);
+            return $result;
+        }
+        catch (Exception $e) {
+            return $value;
+        }
+    }
+}
+
 if(!function_exists('friendly_date_time_short')) {
     function friendly_date_time_short($value, $includeTime = true, $default = '-') {
         if(!$value || empty($value)) return $default;
@@ -113,6 +127,20 @@ if(!function_exists('friendly_date')) {
     }
 }
 
+if(!function_exists('friendlier_date')) {
+    function friendlier_date($value) {
+        if(!$value || empty($value)) return '';
+        try {
+            $result = strtotime($value);
+            $result = date("j M", $result);
+            return $result;
+        }
+        catch (Exception $e) {
+            return $value;
+        }
+    }
+}
+
 if(!function_exists('unfriendly_date')) {
     function unfriendly_date($value) {
         if(!$value || empty($value)) return '';

+ 14 - 0
app/Http/Controllers/PatientController.php

@@ -13,8 +13,11 @@ use App\Models\Handout;
 use App\Models\MBPayer;
 use App\Models\NoteTemplate;
 use App\Models\Pro;
+use App\Models\Product;
 use App\Models\ProProAccess;
 use App\Models\SectionTemplate;
+use App\Models\Shipment;
+use App\Models\SupplyOrder;
 use App\Models\Ticket;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\File;
@@ -344,6 +347,17 @@ class PatientController extends Controller
         return view('app.patient.tickets', compact('patient', 'pros', 'allPros', 'type'));
     }
 
+    public function supplyOrders(Request $request, Client $patient, SupplyOrder $supplyOrder = null)
+    {
+        $products = Product::where('is_active', true)->orderBy('title')->get();
+        return view('app.patient.supply-orders', compact('patient', 'supplyOrder', 'products'));
+    }
+
+    public function shipments(Request $request, Client $patient, Shipment $shipment = null)
+    {
+        return view('app.patient.shipments', compact('patient', 'shipment'));
+    }
+
     public function appointments(Request $request, Client $patient, $forPro = 'all', $status = 'all') {
         $pros = $this->pros;
         $appointments = $patient->appointmentsForProByStatus('all', 'ALL');

+ 23 - 0
app/Models/Client.php

@@ -410,4 +410,27 @@ class Client extends Model
             ->orderBy('created_at', 'desc');
     }
 
+    public function supplyOrders()
+    {
+        return $this->hasMany(SupplyOrder::class, 'client_id', 'id')
+            ->where('is_cancelled', false)
+            ->orderBy('created_at', 'desc');
+    }
+
+    public function readyToShipSupplyOrders()
+    {
+        return $this->hasMany(SupplyOrder::class, 'client_id', 'id')
+            ->where('is_cancelled', false)
+            ->where('is_cleared_for_shipment', true)
+            ->whereNull('shipment_id')
+            ->orderBy('created_at', 'desc');
+    }
+
+    public function shipments()
+    {
+        return $this->hasMany(Shipment::class, 'client_id', 'id')
+            ->where('is_cancelled', false)
+            ->orderBy('created_at', 'desc');
+    }
+
 }

+ 1 - 1
app/Models/Pro.php

@@ -290,7 +290,7 @@ class Pro extends Model
                     ->orWhere('rme_pro_id', $proID)
                     ->orWhere('physician_pro_id', $proID)
                     ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID])
-                    ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE pro_id = ?)', [$proID])
+                    ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE status NOT IN (\'CANCELLED\', \'ABANDONED\') AND pro_id = ?)', [$proID])
                     ->orWhereRaw('id IN (SELECT mcp_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)')
                     ->orWhereRaw('id IN (SELECT manager_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)');
             });

+ 10 - 0
app/Models/Product.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class Product extends Model
+{
+    protected $table = 'product';
+}

+ 18 - 0
app/Models/Shipment.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class Shipment extends Model
+{
+    protected $table = 'shipment';
+
+    public function supplyOrders() {
+        return $this->hasMany(SupplyOrder::class, 'shipment_id', 'id');
+    }
+
+    public function labelFile() {
+        return $this->hasOne(SystemFile::class, 'id', 'label_system_file_id');
+    }
+}

+ 32 - 0
app/Models/SupplyOrder.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class SupplyOrder extends Model
+{
+    protected $table = 'supply_order';
+
+    public function product()
+    {
+        return $this->hasOne(Product::class, 'id', 'product_id');
+    }
+
+    public function shipment()
+    {
+        return $this->hasOne(Shipment::class, 'id', 'shipment_id');
+    }
+
+    public function signedPro() {
+        return $this->hasOne(Pro::class, 'id', 'signed_by_pro_id');
+    }
+
+    public function waiverPro() {
+        return $this->hasOne(Pro::class, 'id', 'client_signature_waived_by_pro_id');
+    }
+
+    public function clearedForShipmentPro() {
+        return $this->hasOne(Pro::class, 'id', 'cleared_for_shipment_by_pro_id');
+    }
+}

+ 10 - 0
app/Models/SystemFile.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class SystemFile extends Model
+{
+    protected $table = 'system_file';
+}

+ 9 - 0
public/css/style.css

@@ -280,6 +280,9 @@ body>nav.navbar {
 .mcp-theme-1 .width-70px {
     width: 70px !important;
 }
+.mcp-theme-1 .width-90px {
+    width: 90px !important;
+}
 .mcp-theme-1 .min-width-140px {
     min-width: 140px !important;
 }
@@ -289,6 +292,9 @@ body>nav.navbar {
 .mcp-theme-1 .min-width-300px {
     min-width: 300px;
 }
+.mcp-theme-1 .min-width-500px {
+    min-width: 500px !important;
+}
 .mcp-theme-1 .width-100px {
     width: 100px;
     min-width: unset !important;
@@ -1458,3 +1464,6 @@ canvas.pdf-viewer-page.pdf-preview-page {
 .back-to-admin-button:hover {
     text-decoration: underline;
 }
+.bg-aliceblue {
+    background: aliceblue !important;
+}

+ 142 - 26
public/js/yemi.js

@@ -124,6 +124,67 @@ var doAjax = function (url, data, pre, post, onSuccess, onFailure, suppressError
         });
 };
 
+var doAjaxFormData = function (url, data, pre, post, onSuccess, onFailure, suppressErrorMessage, onHttpFailure, shouldHideMask, immediatelyHideMaskOnReply) {
+    console.log(data);
+    if (ajaxGoing) {
+        console.log('ajax stopped!');
+        //return; TODO: fix and re-enable return
+    }
+    ajaxGoing = true;
+    if (!shouldHideMask) {
+        showMask();
+    }
+    jQuery.ajax(url, {
+        dataType: 'json',
+        data: data,
+        processData: false,
+        contentType: false,
+        type: 'POST',
+        beforeSend: function () {
+            if (pre) {
+                pre();
+            }
+        }
+    })
+        .done(function (response, b) {
+            console.log(response);
+            var success = response.success;
+            if (success) {
+                if (onSuccess) {
+                    onSuccess(response.data);
+                }
+            } else {
+                if (onFailure) {
+                    onFailure(response.message);
+                }
+                if (!suppressErrorMessage) {
+                    //toast the error message
+                    //alert(response.message);
+                    toastr.error(response.message); // , toastr.success("message") ... .warning(), .error()
+                }
+                hideMask();
+            }
+            if (immediatelyHideMaskOnReply) {
+                hideMask();
+            }
+            ajaxGoing = false;
+        })
+        .fail(function (jqXHR, textStatus) {
+            hideMask();
+            toastr.error('Unable to process');
+            if (onHttpFailure) {
+                onHttpFailure(textStatus);
+            }
+            ajaxGoing = false;
+        })
+        .always(function () {
+            if (post) {
+                post();
+            }
+            ajaxGoing = false;
+        });
+};
+
 var justLog = false; //THIS IS FOR TEST MODE, FORMS WILL NOT TRIGGER REFRESH/REDIR
 
 var pageReload = function () {
@@ -420,36 +481,91 @@ var initMoes = function() {
                 });
                 console.log(data);
                 //var doAjax = function (url, data, pre, post, onSuccess, onFailure, suppressErrorMessage, onHttpFailure, shouldHideMask, immediatelyHideMaskOnReply)
-                doAjax(url, data, null, function () {
-                    moe.isProcessing = false;
-                }, function (data) {
-                    if (justLog) { // this is to test!
-                        console.log('RETURNED', data);
-                    } else if (redir) {
-                        if (redir == "back") {
-                            window.top.history.back();
+
+                // override with FormData if the form has any files
+                let useFormData = false;
+                if($(form).find('input[type="file"]').length) {
+                    let formData = new FormData();
+                    for(let x in data) {
+                        if(data.hasOwnProperty(x)) {
+                            formData.set(x, data[x]);
+                        }
+                    }
+                    $(form).find('input[type="file"]').each(function() {
+                        let fieldName = this.name;
+                        if(this.files && this.files.length) {
+                            formData.append(fieldName, this.files[0]);
+                        }
+                    });
+                    data = formData;
+                    useFormData = true;
+                }
+
+                if(!useFormData) {
+                    doAjax(url, data, null, function () {
+                        moe.isProcessing = false;
+                    }, function (data) {
+                        if (justLog) { // this is to test!
+                            console.log('RETURNED', data);
+                        } else if (redir) {
+                            if (redir == "back") {
+                                window.top.history.back();
+                            } else {
+                                if (redir.indexOf('[data]') > -1) {
+                                    redir = redir.replace('[data]', data);
+                                }
+                                fastLoad(redir, true, false);
+                            }
+                        } else if (moeParent.length) {
+                            showMask();
+                            $.get(moeParent.attr('url'), function (_data) {
+                                moeParent.html(_data);
+                                hideMask();
+                                hideMoeFormMask();
+                                initMoes();
+                                initFastLoad(moeParent);
+                                initAutoRxAndICDComplete();
+                            });
                         } else {
-                            if (redir.indexOf('[data]') > -1) {
-                                redir = redir.replace('[data]', data);
+                            pageReload();
+                        }
+                    }, function (errorMessage) {
+
+                    }, false);
+                }
+                else {
+                    doAjaxFormData(url, data, null, function () {
+                        moe.isProcessing = false;
+                    }, function (data) {
+                        if (justLog) { // this is to test!
+                            console.log('RETURNED', data);
+                        } else if (redir) {
+                            if (redir == "back") {
+                                window.top.history.back();
+                            } else {
+                                if (redir.indexOf('[data]') > -1) {
+                                    redir = redir.replace('[data]', data);
+                                }
+                                fastLoad(redir, true, false);
                             }
-                            fastLoad(redir, true, false);
+                        } else if (moeParent.length) {
+                            showMask();
+                            $.get(moeParent.attr('url'), function (_data) {
+                                moeParent.html(_data);
+                                hideMask();
+                                hideMoeFormMask();
+                                initMoes();
+                                initFastLoad(moeParent);
+                                initAutoRxAndICDComplete();
+                            });
+                        } else {
+                            pageReload();
                         }
-                    } else if (moeParent.length) {
-                        showMask();
-                        $.get(moeParent.attr('url'), function (_data) {
-                            moeParent.html(_data);
-                            hideMask();
-                            hideMoeFormMask();
-                            initMoes();
-                            initFastLoad(moeParent);
-                            initAutoRxAndICDComplete();
-                        });
-                    } else {
-                        pageReload();
-                    }
-                }, function (errorMessage) {
+                    }, function (errorMessage) {
+
+                    }, false);
+                }
 
-                }, false);
             }
         });
 

+ 405 - 0
resources/views/app/patient/shipments.blade.php

@@ -0,0 +1,405 @@
+@extends ('layouts.patient')
+@section('inner-content')
+    <div class="">
+        <div class="d-flex align-items-center mb-3">
+            <h4 class="font-weight-bold m-0">Shipments</h4>
+            <span class="mx-2 text-secondary">|</span>
+            <div moe>
+                <a start show href="#">Add</a>
+                <form url="/api/shipment/create">
+                    <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                    <label class="text-secondary font-weight-bold">Add Shipment</label>
+<!--                    <div class="mb-2">
+                        <label class="text-secondary text-sm">Requested Ship Date *</label>
+                        <input type="date" class="form-control form-control-sm" name="requestedShipDate" required>
+                    </div>-->
+                    <p>Add a new shipment?</p>
+                    <div class="d-flex align-items-center">
+                        <button class="btn btn-sm btn-primary mr-2" type="button" submit>Submit</button>
+                        <button class="btn btn-sm btn-default border mr-2" type="button" cancel>Cancel</button>
+                    </div>
+                </form>
+            </div>
+        </div>
+
+        <div class="d-flex align-items-start h-100">
+            <div class="flex-grow-1">
+
+            @if($patient->readyToShipSupplyOrders && count($patient->readyToShipSupplyOrders))
+            {{--<div class="mb-3 p-2 border bg-aliceblue">
+                <div class="font-weight-bold mb-2 text-info">Ready to Ship Supply Orders</div>
+                <table class="table table-sm table-bordered mb-0 bg-white">
+                    @if($patient->readyToShipSupplyOrders && count($patient->readyToShipSupplyOrders))
+                        <thead>
+                        <tr class="">
+                            <th class="px-2 text-nowrap text-secondary border-bottom-0">Title</th>
+                            <th class="px-2 text-nowrap text-secondary border-bottom-0">Reason</th>
+                            @if(!$shipment)
+                                <th class="px-2 text-nowrap text-secondary border-bottom-0">Created At</th>
+                                <th class="px-2 text-nowrap text-secondary border-bottom-0">Pro Signed?</th>
+                                <th class="px-2 text-nowrap text-secondary border-bottom-0">Cancelled?</th>
+                                <th class="px-2 text-nowrap text-secondary border-bottom-0">Shipment</th>
+                            @endif
+                        </tr>
+                        </thead>
+                        <tbody>
+                        @foreach($patient->readyToShipSupplyOrders as $iSupplyOrder)
+                            <tr class="">
+                                <td class="px-2">
+                                    <a href="{{route('patients.view.supply-orders', ['patient' => $patient, 'supplyOrder' => $iSupplyOrder])}}">
+                                        {{ $iSupplyOrder->product->title }}
+                                    </a>
+                                </td>
+                                <td class="px-2">{{ $iSupplyOrder->reason }}</td>
+                                @if(!$shipment)
+                                    <td class="px-2">{{ friendlier_date_time($iSupplyOrder->created_at) }}</td>
+                                    <td class="px-2">{{ $iSupplyOrder->is_signed_by_pro ? $iSupplyOrder->signedPro->displayName() : '-' }}</td>
+                                    <td class="px-2">{{ $iSupplyOrder->is_cancelled ? 'Yes' : 'No' }}</td>
+                                    <td class="px-2">{{ $iSupplyOrder->shipment_id ? $iSupplyOrder->shipment->status : '-' }}</td>
+                                @endif
+                            </tr>
+                        @endforeach
+                        </tbody>
+                    @else
+                        <tbody>
+                        <tr>
+                            <td class="text-secondary p-3">No unshipped supply orders for this patient</td>
+                        </tr>
+                        </tbody>
+                    @endif
+                </table>
+            </div>--}}
+                <div class="alert alert-info px-3 rounded-0">
+                    There {{ count($patient->readyToShipSupplyOrders) === 1 ? 'is' : 'are' }}
+                    <b>{{ count($patient->readyToShipSupplyOrders) }}</b>
+                    supply order{{ count($patient->readyToShipSupplyOrders) === 1 ? '' : 's' }}
+                    cleared for shipment
+                </div>
+            @endif
+            <table class="table table-sm table-bordered mb-0">
+                @if($patient->shipments && count($patient->shipments))
+                    <thead>
+                    <tr class="bg-light">
+                        <th class="px-2 text-nowrap text-secondary border-bottom-0">Created At</th>
+                        <th class="px-2 text-nowrap text-secondary border-bottom-0">Supply Orders</th>
+                        @if(!$shipment)
+                            <th class="px-2 text-nowrap text-secondary border-bottom-0">Courier</th>
+                            <th class="px-2 text-nowrap text-secondary border-bottom-0">Tracking #</th>
+                            <th class="px-2 text-nowrap text-secondary border-bottom-0">Status</th>
+                        @endif
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach($patient->shipments as $iShipment)
+                        <tr class="{{@$shipment && @$shipment->uid === $iShipment->uid ? 'bg-aliceblue' : ''}}">
+                            <td class="px-2">
+                                <a href="{{route('patients.view.shipments', ['patient' => $patient, 'shipment' => $iShipment])}}">
+                                    {{ friendlier_date_time($iShipment->created_at) }}
+                                </a>
+                            </td>
+                            <td class="px-2">{{count($iShipment->supplyOrders)}}</td>
+                            @if(!$shipment)
+                                <td class="px-2">{{ $iShipment->courier }}</td>
+                                <td class="px-2">{{ $iShipment->tracking_number }}</td>
+                                <td class="px-2">{{ $iShipment->status }}</td>
+                            @endif
+                        </tr>
+                    @endforeach
+                    </tbody>
+                @else
+                    <tbody>
+                        <tr>
+                            <td class="text-secondary p-3">No shipments have been created for this patient</td>
+                        </tr>
+                    </tbody>
+                @endif
+            </table>
+
+            </div>
+
+            @if($shipment)
+                <div class="min-width-500px ml-2 border align-self-stretch p-3">
+                    <div class="d-flex align-items-center mb-3">
+                        <h3 class="font-size-16 m-0">Shipment (created on {{ friendlier_date_time($shipment->created_at) }})</h3>
+                        <a class="ml-auto" href="{{route('patients.view.shipments', ['patient' => $patient])}}">
+                            <i class="fa fa-times-circle on-hover-opaque"></i>
+                        </a>
+                    </div>
+                    <hr class="my-3">
+
+{{--                    <div class="mb-4 d-flex align-items-baseline">--}}
+{{--                        <label class="text-secondary mb-0 min-width-140px mr-2">Requested Ship Date</label>--}}
+{{--                        <div moe bottom class="d-block">--}}
+{{--                            <a start show>{{friendlier_date($shipment->requested_ship_date)}}</a>--}}
+{{--                            <form url="/api/supplyOrder/setRequestedShipDate">--}}
+{{--                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">--}}
+{{--                                <div class="mb-2">--}}
+{{--                                    <label class="text-secondary mb-1 text-sm">Requested Ship Date *</label>--}}
+{{--                                    <input type="date" class="form-control form-control-sm" required--}}
+{{--                                           name="requestedShipDate" value="{{$shipment->requested_ship_date}}">--}}
+{{--                                </div>--}}
+{{--                                <div class="d-flex align-items-center">--}}
+{{--                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>--}}
+{{--                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>--}}
+{{--                                </div>--}}
+{{--                            </form>--}}
+{{--                        </div>--}}
+{{--                    </div>--}}
+
+                    @if($patient->readyToShipSupplyOrders && count($patient->readyToShipSupplyOrders))
+                        <div class="mb-4">
+                            <label class="mb-2 font-weight-bold text-secondary">Supply orders cleared for shipment</label>
+                            <table class="table table-sm table-striped table-bordered mb-0 bg-white">
+                                <thead>
+                                <tr class="">
+                                    <th class="px-2 text-nowrap text-secondary border-bottom-0">Title</th>
+                                    <th class="px-2 text-nowrap text-secondary border-bottom-0">Requested Ship Date</th>
+                                    <th class="px-2 text-nowrap text-secondary border-bottom-0">&nbsp;</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                @foreach($patient->readyToShipSupplyOrders as $iSupplyOrder)
+                                    <tr class="">
+                                        <td class="px-2">{{ $iSupplyOrder->product->title }}</td>
+                                        <td class="px-2 text-secondary">-todo-</td>
+                                        <td class="px-2">
+                                            <div moe relative>
+                                                <a start show class="py-0 font-weight-bold">Add</a>
+                                                <form url="/api/supplyOrder/putInShipment" right>
+                                                    <input type="hidden" name="uid" value="{{ $iSupplyOrder->uid }}">
+                                                    <input type="hidden" name="shipmentUid" value="{{ $shipment->uid }}">
+                                                    <p class="small">Add this supply order?</p>
+                                                    <div class="d-flex align-items-center">
+                                                        <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                                    </div>
+                                                </form>
+                                            </div>
+                                        </td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+                        </div>
+                    @endif
+
+                    <div class="mb-4">
+<!--                        <label class="mb-2 font-weight-bold text-secondary">Supply Orders in this Shipment</label>-->
+                        <table class="table table-sm table-striped table-bordered mb-0 bg-white">
+                            @if($shipment->supplyOrders && count($shipment->supplyOrders))
+                                <thead>
+                                <tr class="">
+                                    <th class="px-2 text-nowrap text-secondary border-bottom-0">Supply Order</th>
+                                    <th class="px-2 text-nowrap text-secondary border-bottom-0">IMEI</th>
+                                    <th class="px-2 text-nowrap text-secondary border-bottom-0">Lot #</th>
+                                    <th class="px-2 text-nowrap text-secondary border-bottom-0">&nbsp;</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                @foreach($shipment->supplyOrders as $iSupplyOrder)
+                                    <tr class="">
+                                        <td class="px-2">{{ $iSupplyOrder->product->title }}</td>
+                                        <td class="px-2">
+                                            <div moe relative class="d-block">
+                                                <a start show>{{ $iSupplyOrder->imei ? $iSupplyOrder->imei : '(not set)' }}</a>
+                                                <form url="/api/supplyOrder/associateImei" right>
+                                                    <input type="hidden" name="uid" value="{{ $iSupplyOrder->uid }}">
+                                                    <div class="mb-2">
+                                                        <label class="text-secondary mb-1 text-sm">IMEI *</label>
+                                                        <input type="text" class="form-control form-control-sm" required
+                                                               name="imei" value="{{ $iSupplyOrder->imei }}">
+                                                    </div>
+                                                    <div class="d-flex align-items-center">
+                                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                                    </div>
+                                                </form>
+                                            </div>
+                                        </td>
+                                        <td class="px-2">
+                                            <div moe relative class="d-block">
+                                                <a start show>{{ $iSupplyOrder->lot_number ? $iSupplyOrder->lot_number : '(not set)' }}</a>
+                                                <form url="/api/supplyOrder/updateLotNumber" right>
+                                                    <input type="hidden" name="uid" value="{{ $iSupplyOrder->uid }}">
+                                                    <div class="mb-2">
+                                                        <label class="text-secondary mb-1 text-sm">Lot # *</label>
+                                                        <input type="text" class="form-control form-control-sm" required
+                                                               name="lotNumber" value="{{ $iSupplyOrder->lot_number }}">
+                                                    </div>
+                                                    <div class="d-flex align-items-center">
+                                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                                    </div>
+                                                </form>
+                                            </div>
+                                        </td>
+                                        <td class="px-2">
+                                            <div moe relative>
+                                                <a start show class="py-0 text-danger">Remove</a>
+                                                <form url="/api/supplyOrder/removeFromShipment" right>
+                                                    <input type="hidden" name="uid" value="{{ $iSupplyOrder->uid }}">
+                                                    <p class="small">Remove this supply order?</p>
+                                                    <div class="d-flex align-items-center">
+                                                        <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                                    </div>
+                                                </form>
+                                            </div>
+                                        </td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            @else
+                                <tbody>
+                                <tr>
+                                    <td class="text-secondary px-3 py-2">No supply orders in this shipment yet</td>
+                                </tr>
+                                </tbody>
+                            @endif
+                        </table>
+                    </div>
+
+                    <div class="mb-2 d-flex align-items-baseline">
+                        <label class="text-secondary text-sm mb-0 width-90px mr-2">Ship Date</label>
+                        <div moe bottom relative class="d-block">
+                            <a start show>{{$shipment->ship_date ? friendlier_date($shipment->ship_date) : '(not set)'}}</a>
+                            <form url="/api/shipment/setShipDate">
+                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Ship Date *</label>
+                                    <input type="date" class="form-control form-control-sm" required
+                                           name="shipDate" value="{{$shipment->ship_date}}">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+
+                    <div class="mb-2 d-flex align-items-baseline">
+                        <label class="text-secondary text-sm mb-0 width-90px mr-2">Courier</label>
+                        <div moe bottom relative class="d-block">
+                            <a start show>{{$shipment->courier ? $shipment->courier : '(not set)'}}</a>
+                            <form url="/api/shipment/setCourier">
+                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Courier</label>
+                                    <input type="text" class="form-control form-control-sm"
+                                           name="courier" value="{{$shipment->courier}}">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+
+                    <div class="mb-2 d-flex align-items-baseline">
+                        <label class="text-secondary text-sm mb-0 width-90px mr-2">Label File</label>
+                        @if($shipment->label_system_file_id)
+                            <a class="pdf-viewer-trigger" native target="_blank"
+                               href="/api/shipment/downloadLabel/{{ $shipment->uid }}"
+                               title="View">
+                                <i class="fa fa-file-pdf text-danger on-hover-opaque"></i>
+                                View
+                                {{--{{ $shipment->labelFile->file_name }}--}}
+                            </a>
+                            <span class="mx-2 text-secondary">|</span>
+                        @endif
+                        <div moe bottom relative class="d-block">
+                            <a start show>Upload</a>
+                            <form url="/api/shipment/setLabelSystemFile">
+                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Label File</label>
+                                    <input type="file" class="form-control form-control-sm"
+                                           name="labelSystemFile">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Upload</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+
+                    <div class="mb-2 d-flex align-items-baseline">
+                        <label class="text-secondary text-sm mb-0 width-90px mr-2">Tracking #</label>
+                        <div moe bottom relative class="d-block">
+                            <a start show>{{$shipment->tracking_number ? $shipment->tracking_number : '(not set)'}}</a>
+                            <form url="/api/shipment/setTrackingNumber">
+                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Tracking #</label>
+                                    <input type="text" class="form-control form-control-sm"
+                                           name="trackingNumber" value="{{$shipment->tracking_number}}">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+
+                    <div class="mb-2 d-flex align-items-baseline">
+                        <label class="text-secondary text-sm mb-0 width-90px mr-2">Status</label>
+                        <div moe bottom relative class="d-block">
+                            <a start show>{{$shipment->status ? $shipment->status : '(not set)'}}</a>
+                            <form url="/api/shipment/setStatus">
+                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Status *</label>
+                                    <select class="form-control form-control-sm"
+                                           name="status">
+                                        <option value=""> -- select -- </option>
+                                        <option value="CREATED" {{$shipment->status === 'CREATED' ? 'selected' : '' }} >Created</option>
+                                        <option value="SHIPPED" {{$shipment->status === 'SHIPPED' ? 'selected' : '' }} >Shipped</option>
+                                        <option value="DELIVERED" {{$shipment->status === 'DELIVERED' ? 'selected' : '' }} >Delivered</option>
+                                        <option value="RETURNED_TO_SENDER" {{$shipment->status === 'RETURNED_TO_SENDER' ? 'selected' : '' }} >Returned to sender</option>
+                                        <option value="CANCELLED" {{$shipment->status === 'CANCELLED' ? 'selected' : '' }} >Cancelled</option>
+                                    </select>
+                                </div>
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Memo</label>
+                                    <input type="text" class="form-control form-control-sm"
+                                           name="statusMemo" value="{{$shipment->status_memo}}">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+
+                    @if($shipment->status === 'DELIVERED')
+                        <div class="mb-2 d-flex align-items-baseline">
+                            <label class="text-secondary text-sm mb-0 width-90px mr-2">Delivered Date</label>
+                            <div moe bottom relative class="d-block">
+                                <a start show>{{$shipment->delivered_date ? friendlier_date($shipment->delivered_date) : '(not set)'}}</a>
+                                <form url="/api/shipment/setDeliveredDate">
+                                    <input type="hidden" name="uid" value="{{ $shipment->uid }}">
+                                    <div class="mb-2">
+                                        <label class="text-secondary mb-1 text-sm">Delivered Date</label>
+                                        <input type="date" class="form-control form-control-sm"
+                                               name="deliveredDate" value="{{$shipment->delivered_date}}">
+                                    </div>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        </div>
+                    @endif
+
+                </div>
+            @endif
+
+        </div>
+    </div>
+@endsection

+ 322 - 0
resources/views/app/patient/supply-orders.blade.php

@@ -0,0 +1,322 @@
+@extends ('layouts.patient')
+@section('inner-content')
+    <div class="">
+        <div class="d-flex align-items-center pb-2">
+            <h4 class="font-weight-bold m-0">Supply Orders</h4>
+            <span class="mx-2 text-secondary">|</span>
+            <div moe>
+                <a start show href="#">Add</a>
+                <form url="/api/supplyOrder/create">
+                    <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                    <label class="text-secondary font-weight-bold">Add Supply Order</label>
+                    <div class="mb-2">
+                        <label class="text-secondary text-sm">Product</label>
+                        <select name="productUid" class="form-control form-control-sm">
+                            <option value=""> --select--</option>
+                            @foreach($products as $product)
+                                <option
+                                    value="{{$product->uid}}">{{$product->title}}</option>
+                            @endforeach
+                        </select>
+                    </div>
+                    <div class="mb-2">
+                        <label class="text-secondary text-sm">Reason</label>
+                        <input type="text" class="form-control form-control-sm" name="reason">
+                    </div>
+                    <div class="mb-2">
+                        <label class="text-secondary text-sm">Client Understanding Memo</label>
+                        <input type="text" class="form-control form-control-sm" name="clientUnderstandingMemo">
+                    </div>
+                    <div class="d-flex align-items-center">
+                        <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
+                    </div>
+                </form>
+            </div>
+        </div>
+        <div class="d-flex align-items-start h-100">
+            <div class="flex-grow-1">
+                <table class="table table-sm table-bordered mb-0">
+                    @if($patient->supplyOrders && count($patient->supplyOrders))
+                        <thead>
+                        <tr class="bg-light">
+                            <th class="px-2 text-nowrap text-secondary border-bottom-0">Title</th>
+                            <th class="px-2 text-nowrap text-secondary border-bottom-0">Reason</th>
+                            @if(!$supplyOrder)
+                                <th class="px-2 text-nowrap text-secondary border-bottom-0">Created At</th>
+                                <th class="px-2 text-nowrap text-secondary border-bottom-0">Pro Signed?</th>
+                                <th class="px-2 text-nowrap text-secondary border-bottom-0">Cancelled?</th>
+                                <th class="px-2 text-nowrap text-secondary border-bottom-0">Shipment</th>
+                            @endif
+                        </tr>
+                        </thead>
+                        <tbody>
+                        @foreach($patient->supplyOrders as $iSupplyOrder)
+                            <tr class="{{@$supplyOrder && @$supplyOrder->uid === $iSupplyOrder->uid ? 'bg-aliceblue' : ''}}">
+                                <td class="px-2">
+                                    <a href="{{route('patients.view.supply-orders', ['patient' => $patient, 'supplyOrder' => $iSupplyOrder])}}">
+                                        {{ $iSupplyOrder->product->title }}
+                                    </a>
+                                </td>
+                                <td class="px-2">{{ $iSupplyOrder->reason }}</td>
+                                @if(!$supplyOrder)
+                                    <td class="px-2">{{ friendlier_date_time($iSupplyOrder->created_at) }}</td>
+                                    <td class="px-2">{{ $iSupplyOrder->is_signed_by_pro ? $iSupplyOrder->signedPro->displayName() : '-' }}</td>
+                                    <td class="px-2">{{ $iSupplyOrder->is_cancelled ? 'Yes' : 'No' }}</td>
+                                    <td class="px-2 text-nowrap">
+                                        @if($iSupplyOrder->shipment_id)
+                                            <i class="fa fa-building"></i>
+                                            {{$iSupplyOrder->shipment->status ? $iSupplyOrder->shipment->status : 'CREATED'}}
+                                        @elseif($iSupplyOrder->is_cleared_for_shipment)
+                                            <span class="text-info">
+                                                <i class="fa fa-user-nurse"></i>
+                                                Cleared for shipment
+                                            </span>
+                                        @else
+                                            <span class="text-warning-mellow">
+                                                <i class="fa fa-user-nurse"></i>
+                                                Not cleared for shipment
+                                            </span>
+                                        @endif
+                                    </td>
+                                @endif
+                            </tr>
+                        @endforeach
+                        </tbody>
+                    @else
+                        <tbody>
+                        <tr>
+                            <td class="text-secondary p-3">No supply orders have been created for this patient</td>
+                        </tr>
+                        </tbody>
+                    @endif
+                </table>
+            </div>
+            @if($supplyOrder)
+                <div class="min-width-500px ml-2 border align-self-stretch p-3">
+                    <div class="d-flex align-items-center">
+                        <h3 class="font-size-16 m-0">{{$supplyOrder->product->title}}</h3>
+                        <a class="ml-auto" href="{{route('patients.view.supply-orders', ['patient' => $patient])}}">
+                            <i class="fa fa-times-circle on-hover-opaque"></i>
+                        </a>
+                    </div>
+                    <hr class="my-3">
+                    <div class="mb-3">
+                        <label class="text-secondary text-sm mb-1">Reason</label>
+                        <div moe class="d-block">
+                            <a start show>{{$supplyOrder->reason}}</a>
+                            <form url="/api/supplyOrder/updateReason">
+                                <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Reason *</label>
+                                    <input type="text" class="form-control form-control-sm" required
+                                           name="reason" value="{{$supplyOrder->reason}}">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+                    <div class="mb-3">
+                        <label class="text-secondary text-sm mb-1">Requested Ship Date</label>
+                        <div moe class="d-block">
+                            <a start show>(not set)</a>
+                            <form url="/api/supplyOrder/updateRequestedShipDate">
+                                <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Requested Ship Date</label>
+                                    <input type="date" class="form-control form-control-sm"
+                                           name="requestedShipDate" value="">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+                    <div class="mb-3">
+                        <label class="text-secondary text-sm mb-1">Client Understanding Memo</label>
+                        <div moe class="d-block">
+                            @if($supplyOrder->client_understanding_memo)
+                                <a start show>{{$supplyOrder->client_understanding_memo}}</a>
+                            @else
+                                <a start show>(not set)</a>
+                            @endif
+                            <form url="/api/supplyOrder/updateClientUnderstandingMemo">
+                                <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Client Understanding Memo</label>
+                                    <input type="text" class="form-control form-control-sm"
+                                           name="clientUnderstandingMemo" value="{{$supplyOrder->client_understanding_memo}}">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+
+                    </div>
+                    <div class="mb-3">
+                        <label class="text-secondary text-sm mb-1">Pro Signature</label>
+                        <div class="d-flex align-items-center">
+                            @if($supplyOrder->is_signed_by_pro)
+                                <div class="text-info">
+                                    Signed by <b>{{$supplyOrder->signedPro->displayName()}}</b>
+                                    on {{friendlier_date_time($supplyOrder->pro_signed_at)}}
+                                </div>
+                            @else
+                                <div class="text-warning-mellow font-weight-bold">Not Signed</div>
+                                <div class="ml-3">
+                                    <div moe>
+                                        <a start show class="py-0">Sign</a>
+                                        <form url="/api/supplyOrder/signAsPro">
+                                            <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                            <p class="small">Sign this supply order?</p>
+                                            <div class="d-flex align-items-center">
+                                                <button class="btn btn-sm btn-success mr-2" submit>Sign</button>
+                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                </div>
+                            @endif
+                        </div>
+                    </div>
+                    <div class="mb-3">
+                        <label class="text-secondary text-sm mb-1">Patient Signature</label>
+                        <div class="d-flex align-items-center">
+                            @if($supplyOrder->is_signed_by_client)
+                                <div class="text-info">
+                                    Signed by <b>{{$patient->displayName()}}</b>
+                                    on {{friendlier_date_time($supplyOrder->client_signed_at)}}
+                                </div>
+                            @elseif($supplyOrder->is_client_signature_waived)
+                                <div class="text-info">
+                                    Waived by <b>{{$supplyOrder->waiverPro->displayName()}}</b>
+                                    on {{friendlier_date_time($supplyOrder->client_signature_waived_at)}}
+                                </div>
+                                <div class="ml-3">
+                                    <div moe bottom relative="">
+                                        <a start show class="py-0">Undo</a>
+                                        <form url="/api/supplyOrder/undoWaiveClientSignature" right>
+                                            <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                            <p class="small">Undo waiving patient signature?</p>
+                                            <div class="d-flex align-items-center">
+                                                <button class="btn btn-sm btn-primary mr-2" submit>Yes</button>
+                                                <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                </div>
+                            @else
+                                <div class="text-warning-mellow font-weight-bold">Not Signed</div>
+                                <div class="ml-3">
+                                    <div moe bottom relative="">
+                                        <a start show class="py-0">Email</a>
+                                        <form url="/api/supplyOrder/sendClientSignatureRequestByEmail">
+                                            <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                            <p class="small">Request patient signature via email?</p>
+                                            <div class="d-flex align-items-center">
+                                                <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                </div>
+                                <span class="mx-2 text-secondary">|</span>
+                                <div class="">
+                                    <div moe bottom relative="">
+                                        <a start show class="py-0">SMS</a>
+                                        <form url="/api/supplyOrder/sendClientSignatureRequestBySms">
+                                            <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                            <p class="small">Request patient signature via SMS?</p>
+                                            <div class="d-flex align-items-center">
+                                                <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                </div>
+                                <span class="mx-2 text-secondary">|</span>
+                                <div class="">
+                                    <a href="#" class="text-secondary on-hover-opaque">Problem Signing</a>
+                                </div>
+                                <span class="mx-2 text-secondary">|</span>
+                                <div class="">
+                                    <div moe bottom relative="">
+                                        <a start show class="py-0">Waive</a>
+                                        <form url="/api/supplyOrder/waiveClientSignature" right>
+                                            <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                            <p class="small mb-2">Waive patient signature?</p>
+                                            <div class="mb-2">
+                                                <label class="text-secondary mb-1 text-sm">Memo</label>
+                                                <input type="text" class="form-control form-control-sm"
+                                                       name="memo" value="{{$supplyOrder->client_signature_waiver_memo}}">
+                                            </div>
+                                            <div class="d-flex align-items-center">
+                                                <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                </div>
+                            @endif
+                        </div>
+                        @if($supplyOrder->client_signature_last_requested_at &&
+                            !$supplyOrder->is_signed_by_client &&
+                            !$supplyOrder->is_client_signature_waived)
+                            <div class="text-sm my-1 text-info">Client signature last requested on {{friendlier_date_time($iSupplyOrder->client_signature_last_requested_at)}}</div>
+                        @endif
+                        @if($supplyOrder->does_client_have_problem_signing &&
+                            !$supplyOrder->is_signed_by_client &&
+                            !$supplyOrder->is_client_signature_waived)
+                            <div class="text-sm my-1 text-warning-mellow">
+                                Client has problem signing
+                                @if($supplyOrder->client_problem_signing)
+                                    <i class="text-sm">{{$supplyOrder->client_problem_signing}}</i></div>
+                                @endif
+                            </div>
+                        @endif
+                    </div>
+                    <hr class="my-3">
+                    <div class="d-flex align-items-center mb-2">
+                        @if($supplyOrder->is_cleared_for_shipment)
+                            <div class="text-info">
+                                <i class="fa fa-check"></i> Cleared for shipment by <b>{{$supplyOrder->clearedForShipmentPro->displayName()}}</b>
+                                on {{friendlier_date_time($supplyOrder->cleared_for_shipment_at)}}
+                            </div>
+                        @else
+                            <div moe bottom relative="">
+                                <a start show class="py-0 text-success font-weight-bold">Clear for Shipment</a>
+                                <form url="/api/supplyOrder/clearForShipment">
+                                    <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                    <p class="small mb-2">Clear this supply order for shipment?</p>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        @endif
+                    </div>
+                    <div class="d-flex align-items-center">
+                        <div moe bottom relative="">
+                            <a start show class="py-0 text-danger">Cancel Supply Order</a>
+                            <form url="/api/supplyOrder/cancel">
+                                <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
+                                <p class="small text-nowrap mb-2">Cancel this supply order?</p>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Yes</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+                </div>
+            @endif
+        </div>
+    </div>
+@endsection

+ 0 - 4
resources/views/app/patient/tickets.blade.php

@@ -60,7 +60,6 @@
                 <option value="erx" {{$type === 'erx' ? 'selected' : ''}}>ERx</option>
                 <option value="lab" {{$type === 'lab' ? 'selected' : ''}}>Lab Orders</option>
                 <option value="imaging" {{$type === 'imaging' ? 'selected' : ''}}>Imaging Orders</option>
-                <option value="equipment" {{$type === 'equipment' ? 'selected' : ''}}>Equipment Orders</option>
             </select>
             <select class="ml-2 max-width-200px form-control form-control-sm pr-2"
                     v-model="statusFilter">
@@ -79,9 +78,6 @@
         @if($type === '' || $type === 'imaging')
             @include('app.patient.tickets.imaging')
         @endif
-        @if($type === '' || $type === 'equipment')
-            @include('app.patient.tickets.equipment')
-        @endif
 
         @include('app.patient.tickets.ticket_send_fax_form')
     </div>

+ 5 - 3
resources/views/app/patient/vitals-graph.blade.php

@@ -57,7 +57,7 @@
 
         // sbp
         $sbp = array_filter($allMeasurements, function($_measurement) use ($date) {
-            return $_measurement['label'] === 'SBP' && $_measurement['effective_date'] === $date;
+            return $_measurement['label'] === 'SBP' && $_measurement['effective_date'] === $date && $_measurement['numeric_value'];
         });
         if(count($sbp)) {
             $sbp = array_values($sbp);
@@ -71,7 +71,7 @@
         if($sbp) {
             $dbp = array_filter($allMeasurements, function($_measurement) use ($date) {
                 $measurementDate = date('Y-m-d', strtotime($_measurement['effective_date']));
-                return $_measurement['label'] === 'DBP' && $measurementDate === $date;
+                return $_measurement['label'] === 'DBP' && $measurementDate === $date && $_measurement['numeric_value'];
             });
             if(count($dbp)) {
                 $dbp = array_values($dbp);
@@ -91,7 +91,9 @@
 
         // weight
         $weight = array_filter($allMeasurements, function($_measurement) use ($date) {
-            return $_measurement['label'] === 'Wt. (lbs.)' && $_measurement['effective_date'] === $date && !!$_measurement['numeric_value'];
+            return $_measurement['label'] === 'Wt. (lbs.)' &&
+                $_measurement['effective_date'] === $date &&
+                $_measurement['numeric_value'];
         });
         if(count($weight)) {
             $weight = array_values($weight);

+ 2 - 1
resources/views/app/video/call-minimal.blade.php

@@ -277,7 +277,8 @@
                 );
 
                 // refresh to non-client page
-                window.location.href = '/pro/meet/';
+                // window.location.href = '{{ config('app.url') }}/pro/meet/';
+                window.location.reload()
 
             },
 

+ 2 - 1
resources/views/app/video/check-video-minimal.blade.php

@@ -280,7 +280,8 @@
                 );
 
                 // refresh to non-client page
-                window.location.href = '/pro/meet/';
+                // window.location.href = '/pro/meet/';
+                window.location.reload()
 
             },
 

+ 8 - 4
resources/views/layouts/patient.blade.php

@@ -101,12 +101,16 @@
                                     <a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 && @$type === 'imaging' ? 'active' : '' }}"
                                        href="{{ route('patients.view.patient-tickets', ['patient' => $patient, 'type' => 'imaging']) }}">Imaging</a>
                                 </li>
-                                <li class="nav-item">
-                                    <a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 && @$type === 'equipment' ? 'active' : '' }}"
-                                       href="{{ route('patients.view.patient-tickets', ['patient' => $patient, 'type' => 'equipment']) }}">Equipment</a>
-                                </li>
                             </ul>
                         </li>
+                        <li class="nav-item">
+                            <a class="nav-link {{ strpos($routeName, 'patients.view.supply-orders') === 0 ? 'active' : '' }}"
+                               href="{{ route('patients.view.supply-orders', ['patient' => $patient]) }}">Supply Orders</a>
+                        </li>
+                        <li class="nav-item">
+                            <a class="nav-link {{ strpos($routeName, 'patients.view.shipments') === 0 ? 'active' : '' }}"
+                               href="{{ route('patients.view.shipments', ['patient' => $patient]) }}">Shipments</a>
+                        </li>
                         <li class="nav-item">
                             <a class="nav-link {{ strpos($routeName, 'patients.view.incoming-reports') === 0 ? 'active' : '' }}"
                                href="{{ route('patients.view.incoming-reports', ['patient' => $patient]) }}">Incoming Reports</a>

+ 5 - 0
routes/web.php

@@ -179,6 +179,11 @@ Route::middleware('pro.auth')->group(function () {
 
         // appointments
         Route::get('appointments/{forPro}/{status}', 'PatientController@appointments')->name('appointments');
+
+        Route::get('supply-orders/{supplyOrder?}', 'PatientController@supplyOrders')->name('supply-orders');
+        Route::get('shipments/{shipment?}', 'PatientController@shipments')->name('shipments');
+
+
     });
 
     // pro dashboard events (ajax)