Bläddra i källkod

Fixes on Visit segment template

Samson Mutunga 3 år sedan
förälder
incheckning
24527349d1

+ 2 - 2
resources/views/app/practice-management/visit-templates/visit-template-segment-templates/activate-deactivate.blade.php

@@ -1,9 +1,9 @@
 <div moe>
 		<a start show href="#">
 			@if($template->is_active)
-				<span class="text-danger">Deactivate</span>
+				<span class="text-danger"><i class="fas fa-trash-alt"></i></span>
 			@else
-			<span class="text-success">Reactivate</span>
+			<span class="text-success"><i class="fas fa-trash-undo"></i></span>
 			@endif
 		</a>
 		<form url="{{ $template->is_active ? '/api/visitTemplateSegmentTemplate/deactivate' : '/api/visitTemplateSegmentTemplate/reactivate' }}" class="mt-2" right>

+ 6 - 1
resources/views/app/practice-management/visit-templates/visit-template-segment-templates/index.blade.php

@@ -40,9 +40,14 @@
                     <div class="card-body p-0">
                         <div class="table-responsive" data-position="RIGHT" droppable-section>
                             @include('app.practice-management.visit-templates.visit-template-segment-templates.segment-templates-list', ['position' => 'RIGHT'])
-                        </div>
+                        </div>                        
                     </div>
                 </div>
+                @if($visitTemplate->is_slim)
+                    <div class="alert alert-warning mt-1">
+                        <span><b><i class="fas fa-exclamation-triangle"></i> Warning:</b> Two column layout wont work well on slim.</span>
+                    </div>
+                @endif
             </div>
         </div>
 

+ 8 - 5
resources/views/app/practice-management/visit-templates/visit-template-segment-templates/segment-templates-list.blade.php

@@ -1,12 +1,12 @@
 <table data-position="{{ @$position }}" class="table table-sm table-striped border-top p-0 m-0 table-dnd">
 	<thead class="bg-light">
 		<tr>
-			<th class="border-0">Position Index</th>
+			<th class="border-0"></th>
 			<th class="border-0">Display title</th>
 			<th class="border-0">Heading</th>
 			<th class="border-0">Sub-heading</th>
 			<th class="border-0">Segment Template</th>
-			<th class="border-0">Status</th>
+			<!-- <th class="border-0">Status</th> -->
 			<th class="border-0">&nbsp;</th>
 		</tr>
 	</thead>
@@ -17,11 +17,14 @@
 				<?php $rowsCount++; ?>
 				<tr id="{{ $template->uid }}" data-uid="{{ $template->uid }}" data-positionindex="{{ $template->position_index }}" data-heading="{{ $template->heading }}" data-subheading="{{ $template->subheading }}" data-displaytitle="{{ $template->display_title }}" data-leftorright="{{ $template->left_or_right }}">
 					<td>{{ $template->position_index }}</td>
-					<td class="text-nowrap">&boxH; &nbsp; &nbsp; {{ $template->display_title }}</td>
+					<td class="text-nowrap">{{ $template->display_title }}</td>
 					<td>{{ $template->heading }}</td>
 					<td>{{ $template->subheading }}</td>
-					<td>{{ $template->segmentTemplate ? $template->segmentTemplate->default_display_title : '---' }}</td>
 					<td>
+						{{ $template->segmentTemplate ? $template->segmentTemplate->default_display_title : '---' }} ({{ $template->segmentTemplate->internal_name }})
+						@include('app.practice-management.visit-templates.visit-template-segment-templates.update-segment-tempalate')
+					</td>
+					{{--<td>
 						<div>
 							@if($template->is_active)
 							<span class="text-success">ACTIVE</span>
@@ -41,7 +44,7 @@
 							@endif
 							@endif
 						</div>
-					</td>
+					</td>--}}
 					<td>
 						<div class="d-flex align-items-center">
 							<div class="mr-2">

+ 71 - 0
resources/views/app/practice-management/visit-templates/visit-template-segment-templates/update-segment-tempalate.blade.php

@@ -0,0 +1,71 @@
+<div id="updateVisitTemplateSegmentTemplate{{@$template->uid}}" class="d-inline">
+	<div moe>
+		<a class="text-muted" href="" show start segment-template-update="{{ $template->uid }}"><i class="fas fa-pencil-alt"></i></a>
+		<form url="/api/visitTemplateSegmentTemplate/swapSegmentTemplate" style="min-width:250px;">
+			<div id="updateVisitTemplateSegmentTemplate{{@$template->uid}}Component{{@$template->uid}}" v-cloak>
+				<input type="hidden" name="uid" value="{{ $template->uid }}" />
+				<div class="mb-2">
+					<label>Segment Template<sup class="text-danger">*</sup></label>
+					<select name="segmentTemplateUid" class="form-control" v-model="form.segmentTemplateUid" select-2 required>
+						<option value=""></option>
+						<option v-for="t in segmentTemplates" v-bind:value="t.uid">@{{ t.default_display_title }} (@{{ t.internal_name }})</option>
+					</select>
+				</div>				
+			</div>
+			<div class="mb-0">
+				<button class="btn btn-success btn-sm" submit>Create</button>
+				<button class="btn btn-default border btn-sm" cancel>Cancel</button>
+			</div>
+		</form>
+	</div>
+</div>
+
+<script>
+	(function() {
+		function init() {
+			new Vue({
+				el: '#updateVisitTemplateSegmentTemplate{{@$template->uid}}Component{{@$template->uid}}',
+				data: {
+					segmentTemplates:[],
+					form:{
+						segmentTemplateUid: "{{ $template->segmentTemplate->uid }}"
+					}
+				},
+				methods: {
+					initSelect2: function(){
+						var self = this;
+						$('[select-2]').select2();
+					},
+					loadSegmentTemplates: function() {
+						var self = this;
+						$.get("{{ route('practice-management.segmentTemplates') }}", {response_type:'json'}, function(response) {
+							self.segmentTemplates = response.data;
+						}, 'json');
+					},
+					getSegmentTemplates: function(){
+						return this.segmentTemplates;
+					},
+					initOnOpenLoadSegmentTemplates: function(){
+						var self = this;
+						$('[segment-template-update={{ $template->uid }}]').click(function(){
+							self.loadSegmentTemplates();
+						});
+					},
+					init: function() {
+						this.initOnOpenLoadSegmentTemplates();
+					}
+				},
+				mounted: function() {
+					this.init();
+				},
+				updated: function(){
+					var self = this;
+					self.$nextTick(function(){
+						self.initSelect2();
+					});
+				}
+			});
+		}
+		addMCInitializer('updateVisitTemplateSegmentTemplate{{@$template->uid}}', init);
+	})();
+</script>