forked from muzima/muzima-form
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenericDemographicsUpdateForm.html
More file actions
478 lines (440 loc) · 21.8 KB
/
GenericDemographicsUpdateForm.html
File metadata and controls
478 lines (440 loc) · 21.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/muzima.css" rel="stylesheet">
<link href="css/ui-darkness/jquery-ui-1.10.4.custom.min.css" rel="stylesheet">
<script src="js/jquery.min.js"></script>
<script src="js/jquery-ui-1.10.4.custom.min.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/additional-methods.min.js"></script>
<script src="js/muzima.js"></script>
<title>Demographics Update Form</title>
</head>
<body class="col-md-8 col-md-offset-2">
<div id="result"></div>
<form id="demographics_update_form" name="demographics_update_form">
<h2 class="text-center">Demographics Update Form</h2>
<div class="section">
<h3>Names</h3>
<div class="form-group">
<input class="form-control" id="patient.uuid"
name="patient.uuid" type="hidden" readonly="readonly">
</div>
<div class="form-group">
<label for="patient.family_name">Family Name: <span class="required">*</span> </label>
<input class="form-control" id="patient.family_name" name="patient.family_name" type="text"
readonly="readonly" required="required">
</div>
<div class="form-group">
<label for="patient.given_name">Given Name: <span class="required">*</span></label>
<input class="form-control" id="patient.given_name" name="patient.given_name" type="text"
readonly="readonly" required="required">
</div>
<div class="form-group">
<label for="patient.middle_name">Middle Name:</label>
<input class="form-control" id="patient.middle_name" name="patient.middle_name" type="text"
readonly="readonly">
</div>
<div class="form-group">
<label for="tmp.update_names">
<input id="tmp.update_names" name="tmp.update_names"
type="checkbox">
Will update names?
</label>
</div>
</div>
<div class="section" id="update_names">
<h3>Add Names</h3>
<div class="form-group">
<label for="demographicsupdate.family_name">New Family Name: <span class="required">*</span> </label>
<input class="form-control" id="demographicsupdate.family_name" name="demographicsupdate.family_name" type="text"
required="required">
</div>
<div class="form-group">
<label for="demographicsupdate.given_name">New Given Name: <span class="required">*</span></label>
<input class="form-control" id="demographicsupdate.given_name" name="demographicsupdate.given_name" type="text"
required="required">
</div>
<div class="form-group">
<label for="demographicsupdate.middle_name">New Middle Name:</label>
<input class="form-control" id="demographicsupdate.middle_name" name="demographicsupdate.middle_name" type="text">
</div>
</div>
<div class="section">
<div class="form-group">
<label for="patient.mothers_name">Mother's Name: </label>
<input class="form-control" id="patient.mothers_name" name="patient.mothers_name" type="text"
readonly="readonly">
</div>
<div class="form-group">
<label for="tmp.update_name_of_mother">
<input id="tmp.update_name_of_mother" name="tmp.update_name_of_mother"
type="checkbox">
Will update Mother's Name?
</label>
</div>
<div class="form-group group-set" id="update_name_of_mother" data-group="demographicsupdate.personattribute">
<label for="patient.mothers_name">Mother's Name: </label>
<input class="form-control" id="demographicsupdate.mothers_name" name="attribute_value" type="text">
<input type="hidden" data-metadata-for="attribute_value" id="attribute_type_name" name="attribute_type_name" value="Mother's Name">
<input type="hidden" data-metadata-for="attribute_value" id="attribute_type_uuid" name="attribute_type_uuid" value="8d871d18-c2cc-11de-8d13-0010c6dffd0f">
</div>
</div>
<div class="section">
<h3>Address</h3>
<div class="form-group">
<label for="demographicsupdate.county">County: </label>
<input class="form-control" id="demographicsupdate.county" name="demographicsupdate.county" type="text"
readonly="readonly">
</div>
<div class="form-group">
<label for="demographicsupdate.location">Location: </label>
<input class="form-control" id="demographicsupdate.location" name="demographicsupdate.location" type="text"
readonly="readonly">
</div>
<div class="form-group">
<label for="demographicsupdate.sub_location">Sub-location: </label>
<input class="form-control" id="demographicsupdate.sub_location" name="demographicsupdate.sub_location" type="text"
readonly="readonly">
</div>
<div class="form-group">
<label for="demographicsupdate.village">Village: </label>
<input class="form-control" id="demographicsupdate.village" name="demographicsupdate.village" type="text"
readonly="readonly">
</div>
<div class="form-group">
<label for="demographicsupdate.phone_number">Phone Number: </label>
<input class="form-control" id="demographicsupdate.phone_number" name="demographicsupdate.phone_number" type="tel"
readonly="readonly">
</div>
<div class="form-group">
<label for="tmp.update_address">
<input id="tmp.update_address" name="tmp.update_address"
type="checkbox">
Will update Address?
</label>
</div>
</div>
<div class="section group-set" id="update_address" data-group="demographicsupdate.personaddress">
<h3>Add Address</h3>
<div class="form-group">
<label for="patient.county">County: </label>
<input class="form-control" id="countyDistrict" name="countyDistrict" type="text">
</div>
<div class="form-group">
<label for="patient.location">Location: </label>
<input class="form-control" id="address6" name="address6" type="text">
</div>
<div class="form-group">
<label for="patient.sub_location">Sub-location: </label>
<input class="form-control" id="address5" name="address5" type="text">
</div>
<div class="form-group">
<label for="patient.village">Village: </label>
<input class="form-control" id="cityVillage" name="cityVillage" type="text">
</div>
</div>
<div class="section">
<h3>Identifiers</h3>
<div class="form-group">
<label for="patient.medical_record_number">Medical Record Number : <span class="required require_medical_record_number_hint">*</span></label>
<div class="form-horizontal">
<div class="group-set" data-group="patient.medical_record_number">
<input type="button" class='btn barcode_btn'>
<input class="barcode_text form-control" id="identifier_value"
name="identifier_value" type="text" disabled="disabled">
<input data-metadata-for="identifier_value" type="hidden" id="identifier_type_uuid"
name="identifier_type_uuid" value="8d793bee-c2cc-11de-8d13-0010c6dffd0f">
</div>
</div>
</div>
<div class="form-group">
<label>Other Identifiers:</label>
<div class="section repeat other_identifier" id="other_identifier" data-name="other_identifier" data-group="demographicsupdate.otheridentifier">
<div class="form-group group-set other_identifier_type" id="other_identifier_type">
<label for="identifier_type_name">Identifier Type</label>
<select class="form-control identifier_type_name" name="identifier_type_name" id="identifier_type_name">
<option value="">...</option>
<option id="amrs_medical_record_number" value="AMRS Medical Record Number">AMRS Medical Record Number</option>
<option value="CCC Number">CCC Number</option>
<option id="hct_id" value="HCT ID">HCT ID</option>
<option value="KENYAN NATIONAL ID NUMBER">KENYAN NATIONAL ID NUMBER</option>
<option value="MTCT Plus ID">MTCT Plus ID</option>
<option value="MTRH Hospital Number">MTRH Hospital Number</option>
<option value="Old AMPATH Medical Record Number">Old AMPATH Medical Record Number</option>
<option id="pmtct_id" value="pMTCT ID">pMTCT ID</option>
</select>
</div>
<div class="identifier_value_section">
<div class="form-group">
<label for="other_identifier_value">Enter Identifier</label>
<input class="form-control check-other-identifier" id="other_identifier_value" required
name="identifier_value" type="text">
</div>
<div class="form-group">
<label for="confirm_other_identifier_value">Confirm Identifier</label>
<input class="form-control check-confirm-identifier" id="confirm_other_identifier_value" required
name="confirm_other_identifier_value" type="text">
</div>
</div>
</div>
</div>
</div>
<div class="section">
<div class="form-group">
<label for="patient.sex">Sex: <span class="required">*</span></label>
<input id="patient.sex" name="patient.sex" type="hidden">
<input class="form-control" disabled id="tmp.patient.sex" name="tmp.patient.sex" type="text">
</div>
<div class="form-group">
<label for="tmp.update_sex">
<input id="tmp.update_sex" name="tmp.update_sex"
type="checkbox">
Will change Sex?
</label>
</div>
<div class="form-group sub-section" id="update_sex">
<label for="demographicsupdate.sex">Update Sex: <span class="required">*</span></label>
<select class="form-control" id="demographicsupdate.sex" name="demographicsupdate.sex">
<option value="">...</option>
<option value="M">Male</option>
<option value="F">Female</option>
</select>
</div>
<div class="form-group birthdate">
<label for="patient.birth_date">Birthdate <span class="required">*</span></label>
<input class="form-control birth_date_picker nonFutureDate" id="patient.birth_date" name="patient.birth_date"
type="text" disabled="disabled" readonly="readonly">
</div>
<div class="form-group">
<label for="tmp.update_birthdate">
<input id="tmp.update_birthdate" name="tmp.update_birthdate"
type="checkbox">
Will change Birth Date?
</label>
</div>
<div id="update_birthdate" class="sub-section">
<div class="form-group">
<label for="tmp.birthdate_type">Will Record Date of Birth... <span class="required">*</span></label>
<select class="form-control" name="tmp.birthdate_type" id="tmp.birthdate_type" required="required">
<option value="">...</option>
<option value="birthdate">By Birth-date</option>
<option value="age">By Age</option>
</select>
</div>
<div class="form-group show_birthdate">
<label for="demographicsupdate.birth_date">Select New Birthdate <span class="required">*</span></label>
<input class="form-control birth_date_picker nonFutureDate" id="demographicsupdate.birth_date"
name="demographicsupdate.birth_date"
type="text"
required="required"
readonly="readonly">
</div>
<div class="form-group show_birthdate">
<label for="demographicsupdate.birthdate_estimated">Is this birthdate an estimate? <span
class="required">*</span></label>
<select class="form-control" id="demographicsupdate.birthdate_estimated" name="demographicsupdate.birthdate_estimated"
required="required">
<option value="">...</option>
<option value="true">Yes</option>
<option value="false">No</option>
</select>
</div>
<div class="form-group show_age">
<label for="tmp.age_in_years">How old are you in Years <span class="required">*</span></label>
<input class="form-control" id="tmp.age_in_years" name="tmp.age_in_years" type="number" required="required">
</div>
</div>
</div>
<div class="section">
<div class="form-group">
<label for="encounter.location_id">Encounter Location:<span class="required">*</span></label>
<input class="form-control valid-location-only" id="encounter.location_id" type="text"
placeholder="Start typing something..." required="required">
<input class="form-control" name="encounter.location_id" type="hidden">
</div>
<div class="form-group hidden">
<label for="encounter.location_id_select">Encounter Location <span class="required">*</span></label>
<select class="form-control" id="encounter.location_id_select" required="required">
<option>...</option>
</select>
</div>
<div class="form-group">
<label for="encounter.provider_id_select">Provider Name:</label>
<input class="form-control valid-provider-only" id="encounter.provider_id_select" type="text"
placeholder="Start typing something...">
<input class="form-control" name="encounter.provider_id_select" type="hidden">
</div>
<div class="form-group hidden">
<select id="select_providers">
</select>
</div>
<div class="form-group show_provider_id_text">
<label for="encounter.provider_id">Provider's system-id:<span class="required">*</span></label>
<input class="form-control checkDigit" id="encounter.provider_id" name="encounter.provider_id"
type="text" required="required" disabled="disabled">
</div>
<div class="form-group">
<label for="encounter.encounter_datetime">Encounter Date <span class="required">*</span></label>
<input class="form-control datepicker nonFutureDate past-date" readonly="readonly" id="encounter.encounter_datetime"
name="encounter.encounter_datetime"
type="text" required="required">
</div>
<div class="form-group">
<input class="form-control" id="encounter.form_uuid" name="encounter.form_uuid"
type="hidden" required="required">
</div>
</div>
</form>
</body>
<script type="text/javascript">
$(document).ready(function () {
var requireMedicalRecordNumber = htmlDataStore.isMedicalRecordNumberRequired();
if(requireMedicalRecordNumber){
$(".require_medical_record_number_hint").show();
$("#identifier_value").attr("required","required");
} else {
$(".require_medical_record_number_hint").hide();
$("#identifier_value").removeAttr("required");
}
var dateFormat = "dd-mm-yy";
var currentDate = $.datepicker.formatDate(dateFormat, new Date());
var encounterDatetime = $('#encounter\\.encounter_datetime');
if ($(encounterDatetime).val() == "") {
$(encounterDatetime).val(currentDate);
}
var currentYear = new Date().getFullYear();
var birthdate_start_year = currentYear - 140;
$('.birth_date_picker').datepicker({
dateFormat: dateFormat,
changeMonth: true,
changeYear: true,
yearRange: birthdate_start_year + ':' + currentYear,
});
$('#save_draft').click(function () {
// pre process the medications
$(this).prop('disabled', true);
document.saveDraft(this);
$(this).prop('disabled', false);
});
$('#submit_form').click(function () {
// pre process the medications
$(this).prop('disabled', true);
document.submit();
$(this).prop('disabled', false);
});
$('#tmp\\.update_names').change(function(){
if($(this).is(':checked')){
$('#update_names').show();
} else {
$('#update_names').hide();
}
});
$('#tmp\\.update_names').trigger('change');
$('#tmp\\.update_name_of_mother').change(function(){
if($(this).is(':checked')){
$('#update_name_of_mother').show();
} else {
$('#update_name_of_mother').hide();
}
});
$('#tmp\\.update_name_of_mother').trigger('change');
$('#tmp\\.update_address').change(function(){
if($(this).is(':checked')){
$('#update_address').show();
} else {
$('#update_address').hide();
}
});
$('#tmp\\.update_address').trigger('change');
$('#tmp\\.update_sex').change(function(){
if($(this).is(':checked')){
$('#update_sex').show();
} else {
$('#update_sex').hide();
}
});
$('#tmp\\.update_sex').trigger('change');
$('#tmp\\.update_birthdate').change(function(){
if($(this).is(':checked')){
$('#update_birthdate').show();
} else {
$('#update_birthdate').hide();
}
});
$('#tmp\\.update_birthdate').trigger('change');
$('#patient\\.sex').change(function(){
if($(this).val() == 'M'){
$('#tmp\\.patient\\.sex').val('Male');
} else if ($(this).val() == 'F') {
$('#tmp\\.patient\\.sex').val('Female');
}
});
$('#patient\\.sex').trigger('change');
$.fn.calculateFields = function () {
var tempAgeInYears = $.trim($("#tmp\\.age_in_years").val());
if (tempAgeInYears != '') {
$('#demographicsupdate\\.birthdate_estimated').val('true');
$('#demographicsupdate\\.birth_date').val($.fn.getTempBirthDate(tempAgeInYears));
}
return true;
};
$.fn.customValidationCheck = function () {
return $.fn.calculateFields();
};
var dobType = $('#tmp\\.birthdate_type');
dobType.change(function () {
var $show_birth_date = $('.show_birthdate');
var $show_age = $('.show_age');
if ($('#tmp\\.birthdate_type').val() == 'age') {
$show_age.show();
$show_birth_date.find('input').val('');
$show_birth_date.hide();
} else {
$show_age.hide();
$show_age.find('input').val('');
$show_birth_date.show();
}
});
dobType.trigger('change');
$.validator.addMethod(
"validateConfirmIdentifierElement",
function(confirm_identifier_value, confirm_identifier_element){
var other_identifier_value = $(confirm_identifier_element).closest('.repeat').find('.check-other-identifier').val();
if (other_identifier_value == confirm_identifier_value) {
return true;
} else {
return false;
}
},
"Other Identifiers do not match."
);
jQuery.validator.addClassRules({
'check-confirm-identifier':{
validateConfirmIdentifierElement: true
}
});
$('.demographicsupdate\\.other_identifier_type').change(function(){
if($(this).val() == ""){
$(this).closest('.repeat').find('.identifier_value_section').hide();
}else{
$(this).closest('.repeat').find('.identifier_value_section').show();
if($('.demographicsupdate\\.other_identifier_type option:selected').hasClass("checkdigit")){
$(this).closest('.repeat').find('.demographicsupdate\\.other_identifier_value').addClass('checkDigit');
$(this).closest('.repeat').find('.demographicsupdate\\.confirm_identifier_value').addClass('checkDigit');
} else {
$(this).closest('.repeat').find('.demographicsupdate\\.other_identifier_value').removeClass('checkDigit');
$(this).closest('.repeat').find('.demographicsupdate\\.confirm_identifier_value').removeClass('checkDigit');
}
}
});
$('.demographicsupdate\\.other_identifier_type').trigger('change');
document.setupAutoCompleteData('encounter\\.location_id');
document.setupAutoCompleteDataForProvider('encounter\\.provider_id_select');
$('#demographics_update_form').validate({});
document.setupValidationForProvider("$('#encounter\\.provider_id_select').val()","encounter\\.provider_id");
document.setupValidationForLocation("$('#encounter\\.location_id').val()","encounter\\.location_id");
});
</script>
</html>