Some csrf work (#2124)
[openemr.git] / interface / forms / newpatient / common.php
blobaeabb74a6b4de928428474c943b0587461167cb9
1 <?php
2 /**
3 * Common script for the encounter form (new and view) scripts.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @package OpenEMR
17 * @author Brady Miller <brady.g.miller@gmail.com>
18 * @link http://www.open-emr.org
21 require_once("$srcdir/options.inc.php");
22 require_once("$srcdir/acl.inc");
23 require_once("$srcdir/lists.inc");
25 use OpenEMR\Core\Header;
26 use OpenEMR\Services\FacilityService;
28 $facilityService = new FacilityService();
30 if ($GLOBALS['enable_group_therapy']) {
31 require_once("$srcdir/group.inc");
34 $months = array("01","02","03","04","05","06","07","08","09","10","11","12");
35 $days = array("01","02","03","04","05","06","07","08","09","10","11","12","13","14",
36 "15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
37 $thisyear = date("Y");
38 $years = array($thisyear-1, $thisyear, $thisyear+1, $thisyear+2);
40 if ($viewmode) {
41 $id = (isset($_REQUEST['id'])) ? $_REQUEST['id'] : '';
42 $result = sqlQuery("SELECT * FROM form_encounter WHERE id = ?", array($id));
43 $encounter = $result['encounter'];
44 if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
45 echo "<body>\n<html>\n";
46 echo "<p>" . xlt('You are not authorized to see this encounter.') . "</p>\n";
47 echo "</body>\n</html>\n";
48 exit();
52 // Sort comparison for sensitivities by their order attribute.
53 function sensitivity_compare($a, $b)
55 return ($a[2] < $b[2]) ? -1 : 1;
58 // get issues
59 $ires = sqlStatement("SELECT id, type, title, begdate FROM lists WHERE " .
60 "pid = ? AND enddate IS NULL " .
61 "ORDER BY type, begdate", array($pid));
63 <!DOCTYPE html>
64 <html>
65 <head>
66 <?php Header::setupHeader(['datetime-picker', 'common', 'jquery-ui', 'jquery-ui-darkness']);?>
67 <title><?php echo xlt('Patient Encounter'); ?></title>
70 <!-- validation library -->
71 <?php
72 //Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation
73 $use_validate_js = 1;
74 require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); ?>
76 <?php include_once("{$GLOBALS['srcdir']}/ajax/facility_ajax_jav.inc.php"); ?>
77 <script language="JavaScript">
80 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
82 // Process click on issue title.
83 function newissue() {
84 dlgopen('../../patient_file/summary/add_edit_issue.php', '_blank', 700, 535, '', '', {
85 buttons: [
86 {text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}
88 });
89 return false;
92 // callback from add_edit_issue.php:
93 function refreshIssue(issue, title) {
94 var s = document.forms[0]['issues[]'];
95 s.options[s.options.length] = new Option(title, issue, true, true);
98 <?php
99 //Gets validation rules from Page Validation list.
100 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
101 $collectthis = collectValidationPageRules("/interface/forms/newpatient/common.php");
102 if (empty($collectthis)) {
103 $collectthis = "undefined";
104 } else {
105 $collectthis = json_sanitize($collectthis["new_encounter"]["rules"]);
108 var collectvalidation = <?php echo $collectthis; ?>;
109 $(document).ready(function(){
110 window.saveClicked = function(event) {
111 var submit = submitme(1, event, 'new-encounter-form', collectvalidation);
112 if (submit) {
113 top.restoreSession();
114 $('#new-encounter-form').submit();
118 $(".enc_issue").on('click', function(e) {
119 e.preventDefault();e.stopPropagation();
120 dlgopen('', '', 700, 650, '', '', {
122 buttons: [{text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}],
124 allowResize: true,
125 allowDrag: true,
126 dialogId: '',
127 type: 'iframe',
128 url: $(this).attr('href')
132 $('.datepicker').datetimepicker({
133 <?php $datetimepicker_timepicker = false; ?>
134 <?php $datetimepicker_showseconds = false; ?>
135 <?php $datetimepicker_formatInput = true; ?>
136 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
137 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
141 function bill_loc(){
142 var pid = <?php echo attr($pid);?>;
143 var dte = document.getElementById('form_date').value;
144 var facility = document.forms[0].facility_id.value;
145 ajax_bill_loc(pid, dte, facility);
146 <?php if ($GLOBALS['set_pos_code_encounter']) { ?>
147 $.ajax({
148 url: "./../../../library/ajax/facility_ajax_code.php",
149 method: "GET",
150 data: {
151 mode: "get_pos",
152 facility_id: facility,
153 csrf_token_form: <?php echo js_escape(collectCsrfToken()); ?>
155 .done(function (fid) {
156 document.forms[0].pos_code.value = fid;
158 .fail(function (xhr) {
159 console.log('error', xhr);
161 <?php } ?>
164 // Handler for Cancel clicked when creating a new encounter.
165 // Show demographics or encounters list depending on what frame we're in.
166 function cancelClickedNew() {
167 if (top.tab_mode) {
168 window.parent.left_nav.loadFrame('ens1', window.name, 'patient_file/history/encounters.php');
170 var target = window;
171 while (target != top) {
172 if (target.name == 'RBot') {
173 target.parent.left_nav.loadFrame('ens1', window.name, 'patient_file/history/encounters.php');
174 break;
176 else if (target.name == 'RTop') {
177 target.parent.left_nav.loadFrame('dem1', window.name, 'patient_file/summary/demographics.php');
178 break;
180 target = target.parent;
182 return false;
185 // Handler for cancel clicked when not creating a new encounter.
186 // Just reload the view mode.
187 function cancelClickedOld() {
188 location.href = '<?php echo "$rootdir/patient_file/encounter/forms.php"; ?>';
189 return false;
192 </script>
193 <style>
194 @media only screen and (max-width: 1024px) {
195 #visit-details [class*="col-"], #visit-issues [class*="col-"]{
196 width: 100%;
197 text-align: <?php echo ($_SESSION['language_direction'] == 'rtl') ? 'right ': 'left '?> !Important;
199 </style>
200 <?php
201 if ($viewmode) {
202 $body_javascript = '';
203 $heading_caption = xl('Patient Encounter Form');
204 } else {
205 $body_javascript = 'onload="javascript:document.new_encounter.reason.focus();"';
206 $heading_caption = xl('New Encounter Form');
210 if ($GLOBALS['enable_help'] == 1) {
211 $help_icon = '<a class="pull-right oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#676666" title="' . xla("Click to view Help") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
212 } elseif ($GLOBALS['enable_help'] == 2) {
213 $help_icon = '<a class="pull-right oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#DCD6D0 !Important" title="' . xla("To enable help - Go to Administration > Globals > Features > Enable Help Modal") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
214 } elseif ($GLOBALS['enable_help'] == 0) {
215 $help_icon = '';
218 </head>
219 <body class="body_top" <?php echo $body_javascript;?>>
220 <div class="container">
221 <div class="row">
222 <div class="col-xs-12">
223 <!-- Required for the popup date selectors -->
224 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
225 <div class="">
226 <div class="page-header">
227 <h2><?php echo text($heading_caption); ?><?php echo $help_icon; ?></h2>
228 </div>
229 </div>
230 </div>
231 </div>
232 <div class="row">
233 <div class="col-xs-12">
234 <form id="new-encounter-form" method='post' action="<?php echo $rootdir ?>/forms/newpatient/save.php" name='new_encounter'>
235 <?php if ($viewmode) { ?>
236 <input type=hidden name='mode' value='update'>
237 <input type=hidden name='id' value='<?php echo (isset($_GET["id"])) ? attr($_GET["id"]) : '' ?>'>
238 <?php } else { ?>
239 <input type='hidden' name='mode' value='new'>
240 <?php } ?>
241 <fieldset>
242 <legend><?php echo xlt('Visit Details')?></legend>
243 <div id = "visit-details">
244 <div class="form-group ">
245 <label for="pc_catid" class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Visit Category:'); ?></label>
246 <div class="col-sm-3">
247 <select name='pc_catid' id='pc_catid' class='form-control col-sm-12'>
248 <option value='_blank'>-- <?php echo xlt('Select One'); ?> --</option>
249 <?php
250 //Bring only patient ang group categories
251 $visitSQL = "SELECT pc_catid, pc_catname, pc_cattype
252 FROM openemr_postcalendar_categories
253 WHERE pc_active = 1 and pc_cattype IN (0,3) and pc_constant_id != 'no_show' ORDER BY pc_seq";
255 $visitResult = sqlStatement($visitSQL);
256 $therapyGroupCategories = [];
258 while ($row = sqlFetchArray($visitResult)) {
259 $catId = $row['pc_catid'];
260 $name = $row['pc_catname'];
262 if ($row['pc_cattype'] == 3) {
263 $therapyGroupCategories[] = $catId;
266 if ($catId === "_blank") {
267 continue;
270 if ($row['pc_cattype'] == 3 && !$GLOBALS['enable_group_therapy']) {
271 continue;
274 // Fetch acl for category of given encounter. Only if has write auth for a category, then can create an encounter of that category.
275 $postCalendarCategoryACO = fetchPostCalendarCategoryACO($catId);
276 if ($postCalendarCategoryACO) {
277 $postCalendarCategoryACO = explode('|', $postCalendarCategoryACO);
278 $authPostCalendarCategoryWrite = acl_check($postCalendarCategoryACO[0], $postCalendarCategoryACO[1], '', 'write');
279 } else { // if no aco is set for category
280 $authPostCalendarCategoryWrite = true;
283 //if no permission for category write, don't show in drop-down
284 if (!$authPostCalendarCategoryWrite) {
285 continue;
288 $optionStr = '<option value="%pc_catid%" %selected%>%pc_catname%</option>';
289 $optionStr = str_replace("%pc_catid%", attr($catId), $optionStr);
290 $optionStr = str_replace("%pc_catname%", text(xl_appt_category($name)), $optionStr);
291 if ($viewmode) {
292 $selected = ($result['pc_catid'] == $catId) ? " selected" : "";
293 } else {
294 $selected = ($GLOBALS['default_visit_category'] == $catId) ? " selected" : "";
297 $optionStr = str_replace("%selected%", $selected, $optionStr);
298 echo $optionStr;
301 </select>
302 </div>
303 <?php
304 $sensitivities = acl_get_sensitivities();
305 if ($sensitivities && count($sensitivities)) {
306 usort($sensitivities, "sensitivity_compare");
308 <label for="pc_catid" class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Sensitivity:'); ?> &nbsp;<i id='sensitivity-tooltip' class="fa fa-info-circle text-primary" aria-hidden="true"></i></label>
309 <div class="col-sm-3">
310 <select name='form_sensitivity' id='form_sensitivity' class='form-control col-sm-12' >
311 <?php
312 foreach ($sensitivities as $value) {
313 // Omit sensitivities to which this user does not have access.
314 if (acl_check('sensitivities', $value[1])) {
315 echo " <option value='" . attr($value[1]) . "'";
316 if ($viewmode && $result['sensitivity'] == $value[1]) {
317 echo " selected";
320 echo ">" . xlt($value[3]) . "</option>\n";
324 echo " <option value=''";
325 if ($viewmode && !$result['sensitivity']) {
326 echo " selected";
329 echo ">" . xlt('None'). "</option>\n";
331 </select>
332 <?php
333 } else {
336 <?php
339 </div>
340 <div class="clearfix"></div>
341 </div>
342 <div class="form-group">
343 <label for='form_date' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Date of Service:'); ?></label>
344 <div class="col-sm-3">
345 <input type='text' class='form-control datepicker col-sm-12' name='form_date' id='form_date' <?php echo $disabled ?>
346 value='<?php echo $viewmode ? attr(oeFormatShortDate(substr($result['date'], 0, 10))) : oeFormatShortDate(date('Y-m-d')); ?>'
347 title='<?php echo xla('Date of service'); ?>'/>
348 </div>
350 <div
351 <?php
352 if ($GLOBALS['ippf_specific']) {
353 echo " style='visibility:hidden;'";
354 } ?>>
355 <label for='form_onset_date' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Onset/hosp. date:'); ?> &nbsp;<i id='onset-tooltip' class="fa fa-info-circle text-primary" aria-hidden="true"></i></label>
356 <div class="col-sm-3">
357 <input type='text' class='form-control datepicker col-sm-12' name='form_onset_date' id='form_onset_date'
358 value='<?php echo $viewmode && $result['onset_date']!='0000-00-00 00:00:00' ? attr(oeFormatShortDate(substr($result['onset_date'], 0, 10))) : ''; ?>'
359 title='<?php echo xla('Date of onset or hospitalization'); ?>' />
360 </div>
361 </div>
362 <div class="clearfix"></div>
363 </div>
364 <div class="form-group"
365 <?php
366 if (!$GLOBALS['gbl_visit_referral_source']) {
367 echo "style='display:none'";
368 } ?>>">
369 <label class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Referral Source'); ?>:</label>
370 <div class="col-sm-3">
371 <?php echo generate_select_list('form_referral_source', 'refsource', $viewmode ? $result['referral_source'] : '', '');?>
372 </div>
373 <div class="clearfix"></div>
374 </div>
375 <?php if ($GLOBALS['enable_group_therapy']) { ?>
376 <div class="form-group"id="therapy_group_name" style="display: none">
377 <label for="form_group" class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Group name'); ?>:</label>
378 <div class="col-sm-3">
379 <input type='text'name='form_group' class='form-control col-sm-12' id="form_group" placeholder='<?php echo xla('Click to select');?>' value='<?php echo $viewmode && in_array($result['pc_catid'], $therapyGroupCategories) ? attr(getGroup($result['external_id'])['group_name']) : ''; ?>' onclick='sel_group()' title='<?php echo xla('Click to select group'); ?>' readonly />
380 <input type='hidden' name='form_gid' value='<?php echo $viewmode && in_array($result['pc_catid'], $therapyGroupCategories) ? attr($result['external_id']) : '' ?>' />
381 </div>
382 <div class="clearfix"></div>
383 </div>
384 <?php }?>
385 <div class="form-group">
386 <label for='facility_id' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Facility'); ?>:</label>
387 <div class="col-sm-8">
388 <select name='facility_id' id='facility_id' class='form-control col-sm-9' onChange="bill_loc()">
389 <?php
390 if ($viewmode) {
391 $def_facility = $result['facility_id'];
392 } else {
393 $dres = sqlStatement("select facility_id from users where username = ?", array($_SESSION['authUser']));
394 $drow = sqlFetchArray($dres);
395 $def_facility = $drow['facility_id'];
397 $posCode = '';
398 $facilities = $facilityService->getAllServiceLocations();
399 if ($facilities) {
400 foreach ($facilities as $iter) { ?>
401 <option value="<?php echo attr($iter['id']); ?>"
402 <?php
403 if ($def_facility == $iter['id']) {
404 if (!$viewmode) {
405 $posCode = $iter['pos_code'];
407 echo "selected";
408 }?>><?php echo text($iter['name']); ?>
409 </option>
410 <?php
414 </select>
415 </div>
416 <div class="clearfix"></div>
417 </div>
418 <div class="form-group">
419 <label for='billing_facility' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Billing Facility'); ?>:</label>
420 <div id="ajaxdiv" class="col-sm-8">
421 <?php
422 $default_bill_fac = isset($result['billing_facility']) ? $result['billing_facility'] : $def_facility;
423 billing_facility('billing_facility', $default_bill_fac);
425 </div>
426 <div class="clearfix"></div>
427 </div>
428 </div>
429 <?php if ($GLOBALS['set_pos_code_encounter']) { ?>
430 <div class="form-group">
431 <label for='pos_code' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('POS Code'); ?>:</label>
432 <div class="col-sm-8">
433 <select name="pos_code" id="pos_code" class='form-control col-sm-9'>
434 <?php
435 $pc = new POSRef();
436 foreach ($pc->get_pos_ref() as $pos) {
437 echo "<option value=\"" . attr($pos["code"]) . "\" ";
438 if (($pos["code"] == $result['pos_code'] && $viewmode) || ($pos["code"] == $posCode && !$viewmode)) {
439 echo "selected";
441 echo ">" . text($pos['code']) . ": ". xlt($pos['title']);
442 echo "</option>\n";
445 </select>
446 </div>
447 <div class="clearfix"></div>
448 </div>
449 <?php }?>
450 </fieldset>
451 <fieldset>
452 <legend><?php echo xlt('Reason for Visit')?></legend>
453 <div class="form-group">
454 <div class="col-sm-10 col-sm-offset-1">
455 <textarea name="reason" id="reason" class="form-control" cols="80" rows="4" ><?php echo $viewmode ? text($result['reason']) : text($GLOBALS['default_chief_complaint']); ?></textarea>
456 </div>
457 </div>
458 </fieldset>
459 <fieldset>
460 <legend><?php echo xlt('Link/Add Issues (Injuries/Medical/Allergy) to Current Visit')?></legend>
461 <div id = "visit-issues">
462 <div class="form-group clearfix">
463 <div class="col-sm-6 col-lg-offset-3">
464 <?php
465 // To see issues stuff user needs write access to all issue types.
466 $issuesauth = true;
467 foreach ($ISSUE_TYPES as $type => $dummy) {
468 if (!acl_check_issue($type, '', 'write')) {
469 $issuesauth = false;
470 break;
473 if ($issuesauth) {
475 <div class="col-sm-12">
476 <div class="col-sm-12 pull-left" style="padding-bottom:5px">
477 <div class="btn-group" role="group">
478 <?php if (acl_check('patients', 'med', '', 'write')) { ?>
479 <a href="../../patient_file/summary/add_edit_issue.php" class="css_button_small link_submit enc_issue"
480 onclick="top.restoreSession()"><span><?php echo xlt('Add Issue'); ?></span></a>
481 <?php } ?>
482 </div>
483 </div>
484 <div class="col-sm-12 pull-left">
485 <select multiple name='issues[]' class='col-sm-12'
486 title='<?php echo xla('Hold down [Ctrl] for multiple selections or to unselect'); ?>' size='6'>
487 <?php
488 while ($irow = sqlFetchArray($ires)) {
489 $list_id = $irow['id'];
490 $tcode = $irow['type'];
491 if ($ISSUE_TYPES[$tcode]) {
492 $tcode = $ISSUE_TYPES[$tcode][2];
494 echo " <option value='" . attr($list_id) . "'";
495 if ($viewmode) {
496 $perow = sqlQuery("SELECT count(*) AS count FROM issue_encounter WHERE " .
497 "pid = ? AND encounter = ? AND list_id = ?", array($pid, $encounter, $list_id));
498 if ($perow['count']) {
499 echo " selected";
501 } else {
502 // For new encounters the invoker may pass an issue ID.
503 if (!empty($_REQUEST['issue']) && $_REQUEST['issue'] == $list_id) {
504 echo " selected";
507 echo ">" . text($tcode) . ": " . text($irow['begdate']) . " " .
508 text(substr($irow['title'], 0, 40)) . "</option>\n";
511 </select>
512 </div>
513 <div class="col-sm-12">
514 <p><i><?php echo xlt('To link this encounter/consult to an existing issue, click the '
515 . 'desired issue above to highlight it and then click [Save]. '
516 . 'Hold down [Ctrl] button to select multiple issues.'); ?></i></p>
517 </div>
518 </div>
519 <?php
522 </div>
523 </div>
524 </div>
525 </fieldset>
526 <?php //can change position of buttons by creating a class 'position-override' and adding rule text-align:center or right as the case may be in individual stylesheets ?>
527 <div class="form-group clearfix">
528 <div class="col-sm-12 text-left position-override">
529 <button type="button" class="btn btn-default btn-save" onclick="top.restoreSession(); saveClicked(undefined);"><?php echo xlt('Save');?></button>
530 <?php if ($viewmode || empty($_GET["autoloaded"])) { // not creating new encounter ?>
531 <button type="button" class="btn btn-link btn-cancel btn-separate-left" onClick="return cancelClickedOld()"><?php echo xlt('Cancel');?></button>
532 <?php } else { // not $viewmode ?>
533 <button class="btn btn-link btn-cancel btn-separate-left link_submit" onClick="return cancelClickedNew()">
534 <?php echo xlt('Cancel'); ?></button>
535 <?php } // end not $viewmode ?>
536 </div>
537 </div>
538 <div class="clearfix"></div>
539 </form>
540 </div>
541 </div>
542 </div><!--end of container div-->
543 <br>
544 <?php
545 //home of the help modal ;)
546 //$GLOBALS['enable_help'] = 0; // Please comment out line if you want help modal to function on this page
547 if ($GLOBALS['enable_help'] == 1) {
548 echo "<script>var helpFile = 'common_help.php'</script>";
549 //help_modal.php lives in interface, set path accordingly
550 require "../../help_modal.php";
553 </body>
554 <script language="javascript">
555 <?php
556 if (!$viewmode) { ?>
557 function duplicateVisit(enc, datestr) {
558 if (!confirm('<?php echo xls("A visit already exists for this patient today. Click Cancel to open it, or OK to proceed with creating a new one.") ?>')) {
559 // User pressed the cancel button, so re-direct to today's encounter
560 top.restoreSession();
561 parent.left_nav.setEncounter(datestr, enc, window.name);
562 parent.left_nav.loadFrame('enc2', window.name, 'patient_file/encounter/encounter_top.php?set_encounter=' + enc);
563 return;
565 // otherwise just continue normally
567 <?php
569 // Search for an encounter from today
570 $erow = sqlQuery("SELECT fe.encounter, fe.date " .
571 "FROM form_encounter AS fe, forms AS f WHERE " .
572 "fe.pid = ? " .
573 " AND fe.date >= ? " .
574 " AND fe.date <= ? " .
575 " AND " .
576 "f.formdir = 'newpatient' AND f.form_id = fe.id AND f.deleted = 0 " .
577 "ORDER BY fe.encounter DESC LIMIT 1", array($pid,date('Y-m-d 00:00:00'),date('Y-m-d 23:59:59')));
579 if (!empty($erow['encounter'])) {
580 // If there is an encounter from today then present the duplicate visit dialog
581 echo "duplicateVisit('" . $erow['encounter'] . "', '" .
582 attr(oeFormatShortDate(substr($erow['date'], 0, 10))) . "');\n";
587 <?php
588 if ($GLOBALS['enable_group_therapy']) { ?>
589 /* hide / show group name input */
590 var groupCategories = <?php echo json_encode($therapyGroupCategories); ?>;
591 $('#pc_catid').on('change', function () {
592 if(groupCategories.indexOf($(this).val()) > -1){
593 $('#therapy_group_name').show();
594 } else {
595 $('#therapy_group_name').hide();
599 function sel_group() {
600 top.restoreSession();
601 var url = '<?php echo $GLOBALS['webroot']?>/interface/main/calendar/find_group_popup.php';
602 dlgopen(url, '_blank', 500, 400, '', '', {
603 buttons: [
604 {text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}
608 // This is for callback by the find-group popup.
609 function setgroup(gid, name) {
610 var f = document.forms[0];
611 f.form_group.value = name;
612 f.form_gid.value = gid;
615 <?php
616 if ($viewmode && in_array($result['pc_catid'], $therapyGroupCategories)) {?>
617 $('#therapy_group_name').show();
618 <?php
619 } ?>
620 <?php
621 } ?>
623 $(document).ready(function(){
624 $('#billing_facility').addClass('col-sm-9');
625 //for jquery tooltip to function if jquery 1.12.1.js is called via jquery-ui in the Header::setupHeader
626 // the relevant css file needs to be called i.e. jquery-ui-darkness - to get a black tooltip
627 $('#sensitivity-tooltip').attr( "title", "<?php echo xla('If set as high will restrict visibility of encounter to users belonging to certain groups (AROs). By default - Physicians and Administrators'); ?>" );
628 $('#sensitivity-tooltip').tooltip();
629 $('#onset-tooltip').attr( "title", "<?php echo xla('Hospital date needed for successful billing of hospital encounters'); ?>" );
630 $('#onset-tooltip').tooltip();
632 </script>
633 </html>