瀏覽代碼

Updated listing & filter for equipment

Vijayakrishnan 4 年之前
父節點
當前提交
7b6cfd7231

+ 1 - 1
resources/views/app/patient/action-items-equipment.blade.php

@@ -4,7 +4,7 @@
 ?>
 @section('inner-content')
 
-    <div class="mb-5">
+    <div class="mb-3">
 
     @include('app/patient/partials/equipment')
 

+ 30 - 11
resources/views/app/patient/partials/equipment.blade.php

@@ -3,30 +3,45 @@
         <h4 class="font-weight-bold m-0 font-size-14"><i class="fa fa-car-battery mr-2"></i>Equipment/Device</h4>
         <span class="mx-2 text-secondary">|</span>
         <a class="py-0 font-weight-normal c-pointer" v-on:click.prevent="showPopup('equipment-popup')">Add</a>
+        <select class="ml-auto max-width-300px form-control form-control-sm"
+                onchange="fastLoad('/patients/view/{{$patient->uid}}/action-items-equipment/' + this.value, true, false, false)">
+            <option value="open" {{ $filter === 'open' ? 'selected' : '' }}>Open tickets</option>
+            <option value="closed" {{ $filter === 'closed' ? 'selected' : '' }}>Closed tickets</option>
+            <option value="all" {{ $filter === 'all' ? 'selected' : '' }}>All tickets</option>
+        </select>
     </div>
-    <table class="table table-sm table-bordered mb-0" style="table-layout: fixed">
+    <table class="table table-sm table-bordered mb-0">
         <thead>
         <tr class="bg-light">
             <th class="px-2 text-secondary border-bottom-0 width-30px">#</th>
-            <th class="px-2 text-secondary border-bottom-0">Items</th>
-            <th class="px-2 text-secondary border-bottom-0">Purpose</th>
+            <th class="px-2 text-secondary border-bottom-0">Equipment</th>
             <th class="px-2 text-secondary border-bottom-0">Memo</th>
-            <th class="px-2 text-secondary border-bottom-0">&nbsp;</th>
         </tr>
         </thead>
         <tbody>
-            <tr v-for="(item, index) in items" :class="item.is_open ? '' : 'opacity-60'">
+            <tr v-for="(item, index) in items" :class="item.is_open ? '' : 'opacity-60 bg-light'">
                 <td class="px-2">@{{ index + 1 }}</td>
-                <td class="px-2" v-html="item.items && Array.isArray(item.items) ? item.items.join('<br>') : item.items"></td>
-                <td class="px-2">@{{item.purpose}}</td>
-                <td class="px-2">@{{item.memo}}</td>
                 <td class="px-2">
+                    <div class="d-flex align-items-center flex-wrap">
+                        <div>
+                            <a v-html="item.items && Array.isArray(item.items) ? item.items.join(', ') : '-'"
+                               href="#" class="font-weight-bold font-size-13"></a>
+                        </div>
+                        <span class="mx-2 text-secondary">•</span>
+                        <div>
+                            <span class="text-secondary">Purpose:</span>
+                            <span v-html="item.purpose ? item.purpose : '-'"></span>
+                        </div>
+                    </div>
+                </td>
+                <td class="px-2">@{{item.memo}}</td>
+                {{--<td class="px-2">
                     <a class="mr-2 c-pointer" v-on:click.prevent="showPopup('equipment-popup', item)">Edit</a>
                     <a class="mr-2 c-pointer" v-if="item.is_open" v-on:click.prevent="closeItem(item)">Close</a>
                     <a class="mr-2 c-pointer" v-if="!item.is_open" v-on:click.prevent="openItem(item)">Open</a>
 
                     @include('app.patient.partials.ticket_action_links')
-                </td>
+                </td>--}}
             </tr>
         </tbody>
     </table>
@@ -76,8 +91,12 @@
 <script>
     (function() {
         <?php
-        $tickets = $patient->tickets->filter(function($_item) {
-            return $_item->category === 'equipment';
+        $tickets = $patient->tickets->filter(function($_item) use ($filter) {
+            $match = $_item->category === 'equipment';
+            if($filter !== 'all') {
+                $match = $match && ($filter === 'open' ? $_item->is_open : !$_item->is_open);
+            }
+            return $match;
         });
         $items = [];
         foreach ($tickets as $ticket) {