4 * For various specialty forms to call from dialog using the
5 * Ajax, iFrame, Alert, Confirm or HTML modes. Just follow
6 * the example patient previous names history form pattern shown below.
9 * @link https://www.open-emr.org
10 * @author Jerry Padgett <sjpadgett@gmail.com>
11 * @copyright Copyright (c) 2021 Jerry Padgett <sjpadgett@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once(__DIR__
. "/../interface/globals.php");
17 use OpenEMR\Common\Csrf\CsrfUtils
;
18 use OpenEMR\Core\Header
;
20 if (!CsrfUtils
::verifyCsrfToken($_GET["csrf_token_form"])) {
21 CsrfUtils
::csrfNotVerified();
24 $form = trim($_GET['form_handler']);
25 echo "<script>var form=" . js_escape($form) . "</script>";
30 <title
><?php
echo xlt("Specialty Form"); ?
></title
>
31 <meta name
="viewport" content
="width=device-width, initial-scale=1.0">
32 <?php Header
::setupHeader(['opener', 'datetime-picker']); ?
>
35 $
("#names_form").submit(function(event
) {
36 event
.preventDefault();
37 const url
= top
.webroot_url +
'/library/ajax/specialty_form_ajax.php';
42 body
: new FormData(this
)
44 ).then(data
=> data
.json())
46 let ele
= opener
.document
.getElementById('form_name_history');
48 let newOption
= new Option(data
.name
, data
.id
, true, true);
49 ele
.append(newOption
);
51 let message
= xl("Previous name history already exist. Try again or Cancel.");
52 dialog
.alert(message
);
58 $
("#form_cancel").click(function(){
61 $
('.datepicker').datetimepicker({
62 <?php
$datetimepicker_timepicker = false; ?
>
63 <?php
$datetimepicker_showseconds = false; ?
>
64 <?php
$datetimepicker_formatInput = true; ?
>
65 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
71 <?php
if ($form === 'name_history') { ?
>
72 <div
class="container-fluid">
73 <form
class="form" id
="names_form">
74 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
75 <input type
="hidden" name
="pid" value
="<?php echo attr($pid); ?>" />
76 <input type
="hidden" name
="task_name_history" value
="save" />
78 <p
class="small text-center"><?php
echo xlt("Patient previous names history. Ensure to add the date the name was last used if known."); ?
></p
>
80 <div
class="form-group">
81 <input type
="text" name
="previous_name_prefix" id
="previous_name_prefix" class="form-control" />
82 <label
class="form-label" for="previous_name_prefix"><?php
echo xlt("Title"); ?
></label
>
86 <div
class="form-group">
87 <input type
="text" name
="previous_name_first" id
="previous_name_first" class="form-control" />
88 <label
class="form-label" for="previous_name_first"><?php
echo xlt("First name"); ?
></label
>
92 <div
class="form-group">
93 <input type
="text" name
="previous_name_middle" id
="previous_name_middle" class="form-control" />
94 <label
class="form-label" for="previous_name_middle"><?php
echo xlt("Middle name"); ?
></label
>
98 <div
class="form-group">
99 <input type
="text" name
="previous_name_last" id
="previous_name_last" class="form-control" />
100 <label
class="form-label" for="previous_name_last"><?php
echo xlt("Last name"); ?
></label
>
104 <div
class="form-group">
105 <input type
="text" name
="previous_name_suffix" id
="previous_name_suffix" class="form-control" />
106 <label
class="form-label" for="previous_name_suffix"><?php
echo xlt("Suffix"); ?
></label
>
110 <div
class="form-group">
111 <input type
="text" name
="previous_name_enddate" id
="previous_name_enddate" class="form-control datepicker" />
112 <label
class="form-label" for="previous_name_enddate"><?php
echo xlt("End Date"); ?
></label
>
116 <div
class="col-12 text-center">
117 <div
class="form-group">
118 <button type
='submit' class='btn btn-primary' name
='form_save' id
='form_save' value
="save"><?php
echo xlt('Save'); ?
></button
>
119 <button type
='button' class='btn btn-secondary' name
='form_cancel' id
='form_cancel'><?php
echo xlt('Cancel'); ?
></button
>