Peter Muturi 1 年之前
父節點
當前提交
e941fdd8ff

+ 6 - 0
public/css/style.css

@@ -33,6 +33,12 @@
   font-weight: 800;
   color: rgb(13, 89, 175);
 }
+.ui-sortable-handle {
+  cursor: grab;
+}
+.ui-sortable-helper {
+  cursor: grabbing;
+}
 .login-container small {
   font-size: 12px;
   color: #999;

+ 51 - 13
resources/views/app/patient/partials/rm-reasons-display.blade.php

@@ -21,22 +21,28 @@ $displayData = [
 		'description' => $record->rm_reason_icd4description
 	],
 ];
+	$submitUrl = null;
+	if(@$recordType === 'CLIENT') $submitUrl = '/api/client/putRmReasons';
+	if(@$recordType === 'NOTE') $submitUrl = '/api/note/putReasons';
+	if(@$recordType === 'CARE_MONTH') $submitUrl = '/api/careMonth/putRmReasons';
 ?>
 <div>
-	<div class="d-flex flex-wrap">
+	<div class="d-flex">
 		<?php $emptyICDs = true; ?>
-		@foreach($displayData as $rmKey=>$rmData)
-			<?php
-			$emptyICD = true;
-			if (!empty($rmData['reason']) || !empty($rmData['description'])) {
-				$emptyICDs = false;
-				$emptyICD = false;
-			}
-			?>
-			@if(!$emptyICD)
-				<span class="badge badge-info px-2 mb-1 mr-2">{{$rmData['reason']}} @if(!empty($rmData['description']))({{ $rmData['description'] }})@endif</span>
-			@endif
-		@endforeach
+		<ul id="sort_icds" class="pl-0">
+			@foreach($displayData as $rmKey=>$rmData)
+				<?php
+				$emptyICD = true;
+				if (!empty($rmData['reason']) || !empty($rmData['description'])) {
+					$emptyICDs = false;
+					$emptyICD = false;
+				}
+				?>
+				@if(!$emptyICD)
+					<li title="Drag and drop to rearrange the order" class="d-block badge badge-info p-2 px-3 text-left mb-1 mr-2" id="{{$rmKey}}"><i class="fas fa-ellipsis-v"></i><i class="fas fa-ellipsis-v mr-2"></i> {{$rmData['reason']}} @if(!empty($rmData['description']))({{ $rmData['description'] }})@endif</li>
+				@endif
+			@endforeach
+		</ul>
 		@if($emptyICDs)
 			@if($patient->is_enrolled_in_rm)
 			<div class="d-flex">
@@ -57,3 +63,35 @@ $displayData = [
 	</div>
 	@endif
 </div>
+<script type="text/javascript">
+	var initialOrder = <?= json_encode($displayData) ?>;
+
+	$( function() {
+		$( "#sort_icds" ).sortable({
+			stop: function(event, ui) {
+				var els = $('.badge-info.ui-sortable-handle');
+				var newOrder = {};
+				for (var i = 0; i < els.length; i++) {
+					var icd_num = els[i].id;
+					newOrder["icd_"+ (1+i)] = initialOrder[icd_num]
+				}
+				var data = {
+					uid: "{{$record->uid}}",
+					reasonIcd1: newOrder['icd_1'].reason,
+					reasonIcd1Description: newOrder['icd_1'].description,
+					reasonIcd2: newOrder['icd_2'].reason,
+					reasonIcd2Description: newOrder['icd_2'].description,
+					reasonIcd3: newOrder['icd_3'].reason,
+					reasonIcd3Description: newOrder['icd_3'].description,
+					reasonIcd4: newOrder['icd_4'].reason,
+					reasonIcd4Description: newOrder['icd_4'].description
+				};
+				$.post("{{$submitUrl}}", data, function(results){
+					if (results.success) {
+						fastReload();
+					}
+			  });
+			}
+		});
+	});
+</script>

+ 14 - 24
resources/views/app/patient/partials/sticky-notes-history.blade.php

@@ -4,7 +4,7 @@ use App\Models\ClientStickyNote;
 
 $recentStickyNotes = ClientStickyNote::where('client_id', $patient->id)->orderBy('created_at', 'DESC')->limit(5)->get();
 ?>
-<div moe relative wide center class="ml-2">
+<div moe relative center class="ml-2">
 	<a start show><i class="fas fa-history fa-fw on-hover-opaque"></i></a>
 	<form url="" class="mcp-theme-1">
 		<div>
@@ -14,29 +14,19 @@ $recentStickyNotes = ClientStickyNote::where('client_id', $patient->id)->orderBy
 					<i class="fas fa-times"></i>
 				</button>
 			</div>
-			<table class="table table-sm table-striped table-bordered">
-				<thead class="bg-light">
-					<tr>
-						<th class="border-bottom-0">Date</th>
-						<th class="border-bottom-0">Note</th>
-						<th class="border-bottom-0">Created By</th>
-					</tr>
-				</thead>
-				<tbody>
-					@foreach($recentStickyNotes as $sn)
-					<tr>
-						<td style="width:180px">{{ friendly_date_time($sn->created_at) }}</td>
-						<td style="width:400px;"><?= nl2br($sn->sticky_note) ?></td>
-						<td>{{ $sn->createdBy->pro->displayName() }}</td>
-					</tr>
-					@endforeach
-					@if(!count($recentStickyNotes))
-						<tr>
-							<td colspan="4">No records found</td>
-						</tr>
-					@endif
-				</tbody>
-			</table>
+			@foreach($recentStickyNotes as $sn)
+				<div class="border bg-light mt-2 p-2">
+					<p class="mb-1"><?= nl2br($sn->sticky_note) ?></p>
+					<div class="text-muted">
+						<span>By: <b>{{ $sn->createdBy->pro->displayName() }}</b></span> - <span>{{ friendly_date_time($sn->created_at) }}</span>
+					</div>
+				</div>
+			@endforeach
+			@if(!count($recentStickyNotes))
+				<div class="border-top p-3">
+					<p class="text-center m-0">No records found</p>
+				</div>
+			@endif
 		</div>
 	</form>
 </div>