Эх сурвалжийг харах

Fixed multpile pros access to visit template

Samson Mutunga 3 жил өмнө
parent
commit
14f4b60ae4

+ 7 - 2
resources/views/app/practice-management/visit-templates/visit-template-accesses/create.blade.php

@@ -1,13 +1,14 @@
 <div id="createVisitTemplateProAccess">
 	<div moe>
 		<a start show href="#">Create</a>
-		<form url="/api/visitTemplateAccess/create" class="mt-2">
+		<form url="/api/visitTemplateAccess/createBulk" class="mt-2">
 			<input type="hidden" name="visitTemplateUid" value="{{ $visitTemplate->uid }}">
+			<input type="hidden" name="proUids" />
 
 			<div class="sm-section" style="width: 250px !important;">
 				<div class="">
 					<label class="mb-1 text-secondary">Pro:</label>
-					<select id="searchForProInput" name="proUid" class="form-control input-sm"></select>
+					<select id="searchForProInput" name="proUid" class="form-control input-sm" multiple></select>
 				</div>
 			</div>
 
@@ -49,6 +50,10 @@
 						};
 					}
 				}
+			}).on('change', function(e) {
+				var proUids = $('#searchForProInput').val();
+				proUids = proUids.join('|');
+				$('input[name=proUids]').val(proUids);
 			});
 		}
 		addMCInitializer('createVisitTemplateProAccess', init, '#createVisitTemplateProAccess');

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

@@ -20,6 +20,7 @@
                         <thead class="bg-light">
                             <tr>
                                 <th class="border-0">Pro</th>
+                                <th class="border-0">Pro Type</th>
                                 <th class="border-0">Type</th>
                                 <th class="border-0">Status</th>
                                 <th class="border-0">&nbsp;</th>
@@ -29,6 +30,7 @@
                             @foreach($visitTemplateAccesses as $access)
                             <tr>
                                 <td>{{ $access->pro->displayName() }}</td>
+                                <td>{{ $access->pro->pro_type }}</td>
                                 <td>{{ $access->type }}</td>
                                 <td>
                                     <div>
@@ -62,7 +64,7 @@
                             @endforeach
                             @if(!count($visitTemplateAccesses))
                             <tr>
-                                <td colspan="8">No records found!</td>
+                                <td colspan="5">No records found!</td>
                             </tr>
                             @endif
                         </tbody>