Ver código fonte

updated function

Peter Muturi 1 ano atrás
pai
commit
b9a4a926d8

+ 3 - 0
js-dev/icd-autocomplete.js

@@ -28,6 +28,9 @@
             });
             $(elem).attr('ac-initialized', 1);
         });
+        $('.addICDBtn').on('click', function() { // init dynamic fields
+            return init();
+        });
     }
 
     addMCInitializer('icd-autocomplete', init);

+ 3 - 0
public/js/icd-autocomplete.js

@@ -28,6 +28,9 @@
             });
             $(elem).attr('ac-initialized', 1);
         });
+        $('.addICDBtn').on('click', function() { // init dynamic fields
+            return init();
+        });
     }
 
     addMCInitializer('icd-autocomplete', init);

+ 3 - 2
resources/views/app/patient/partials/put-rm-reasons.blade.php

@@ -62,7 +62,7 @@ if($recordType === 'NOTE'){
 					</tr>
 					<tr v-if="fields.length < 4">
 						<td colspan="3">
-							<a href="javascript:;" @click.prevent="addICDCode" class="btn w-100 py-0 btn-sm">+ Add ICD Code</a>
+							<a href="javascript:;" @click.prevent="addICDCode" class="btn w-100 py-0 btn-sm addICDBtn">+ Add ICD Code</a>
 						</td>
 					</tr>
 				</tbody>
@@ -113,7 +113,8 @@ if($recordType === 'NOTE'){
 			},
 			removeICDCode: function(fl) {
 				var self = this;
-				self.fields.splice(fl, 1);
+				var ind = self.fields.indexOf(fl);
+				self.fields.splice(ind, 1);
 			},
 			checkDescription: function(fl) {
 				if (fl.reason == '') {