updated US CDC website link to current immunization VIS page (#7855)
[openemr.git] / templates / super / facilities / form.html.twig
blobf69fa5dffd92422186d8aaf6c6b4ffa4cdfe3f9e
1 <html>
2 <head>
3 {{ setupHeader(['opener', 'erx']) }}
5 <script src="../main/calendar/modules/PostCalendar/pnincludes/AnchorPosition.js"></script>
6 <script src="../main/calendar/modules/PostCalendar/pnincludes/PopupWindow.js"></script>
7 <script src="../main/calendar/modules/PostCalendar/pnincludes/ColorPicker2.js"></script>
9 <!-- validation library -->
10 <!--//Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation-->
11 {% if forceClose %}
12 <script>
13 <!--
14 dlgclose();
15 //-->
16 </script>
17 {% endif %}
18 <script>
20 * validation on the form with new client side validation (using validate.js).
21 * this enable to add new rules for this form in the pageValidation list.
22 * */
23 var collectvalidation = {{ collectThis }};
25 function submitform() {
27     var valid = submitme(1, undefined, 'facility-form', collectvalidation);
28     if (!valid) return;
30     {% if erxEnabled %}
31     alertMsg = '';
32     f = document.forms[0];
33     for (i = 0; i < f.length; i++) {
34         if (f[i].type == 'text' && f[i].value) {
35             if (f[i].name == 'facility' || f[i].name == 'Washington') {
36                 alertMsg += checkLength(f[i].name, f[i].value, 35);
37                 alertMsg += checkFacilityName(f[i].name, f[i].value);
38             } else if (f[i].name == 'street') {
39                 alertMsg += checkLength(f[i].name, f[i].value, 35);
40                 alertMsg += checkAlphaNumeric(f[i].name, f[i].value);
41             } else if (f[i].name == 'phone' || f[i].name == 'fax') {
42                 alertMsg += checkPhone(f[i].name, f[i].value);
43             } else if (f[i].name == 'federal_ein') {
44                 alertMsg += checkLength(f[i].name, f[i].value, 10);
45                 alertMsg += checkFederalEin(f[i].name, f[i].value);
46             }
47         }
48     }
49     if (alertMsg) {
50         alert(alertMsg);
51         return false;
52     }
53     {% endif %}
55     top.restoreSession();
57     let post_url = $("#facility-form").attr("action");
58     let request_method = $("#facility-form").attr("method");
59     let form_data = $("#facility-form").serialize();
61     $.ajax({
62         url: post_url,
63         type: request_method,
64         data: form_data
65     }).done(function (r) { //
66         dlgclose('refreshme', false);
67     });
68     return false;
71 function copyAddress(base) {
72     let _map = [
73         ["mail_street", "street"],
74         ["mail_city", "city"],
75         ["mail_state", "state"],
76         ["mail_zip", "postal_code"]
77     ];
79     _map.forEach(f => {
80         let s = (base == "mailing") ? f[0] : f[1];
81         let d = (base == "mailing") ? f[1] : f[0];
82         let _s = document.querySelector("input[name='" + s + "']");
83         let _d = document.querySelector("input[name='" + d + "']");
84         console.log(_s);
85         console.log(_d);
86         _d.value = _s.value;
87     });
90 $(function () {
91     /**
92     * add required/star sign to required form fields
93     */
94     for (var prop in collectvalidation) {
95         //if (collectvalidation[prop].requiredSign)
96         if (collectvalidation[prop].presence)
97             $("label[for='" + prop + "']").append('*');
98     }
100     $("input[name='facility']").focus();
101     $("#btnCopyMailing").on('click', function() {
102         copyAddress("mailing");
103     });
104     $("#btnCopyPhysical").on('click', function() {
105         copyAddress("physical");
106     });
108 var cp = new ColorPicker('window');
110 // Runs when a color is clicked
111 function pickColor(color) {
112     document.getElementById('ncolor').value = color;
115 var field;
117 function pick(anchorname, target) {
118     var cp = new ColorPicker('window');
119     field = target;
120     cp.show(anchorname);
123 function displayAlert() {
124     if (document.getElementById('primary_business_entity').checked == false)
125         alert({{ 'Primary Business Entity tax id is used as the account id for NewCrop ePrescription.'|xlj }});
126     else if (document.getElementById('primary_business_entity').checked == true)
127         alert({{ 'Once the Primary Business Facility is set, changing the facility id will affect NewCrop ePrescription.'|xlj }});
129 </script>
131 </head>
132 <body class="body_top">
133     <div class="container-fluid">
134         <div class="row mb-3">
135             <div class="col-sm-12 d-flex justify-content-between align-items-center">
136                 <h5 class="m-0">{{ ((mode == "add") ? "Add Facility" : "Edit Facility")|xlt }}</h5>
137                 <div>
138                     <a class="btn btn-text" id='cancel' onclick='dlgclose();' href='#'>{{ 'Cancel'|xlt }}</a>
139                     <a class="btn btn-primary" name='form_save' id='form_save' onclick='submitform();' href='#'>{{ 'Save'|xlt }}</a>
140                 </div>
141             </div>
142         </div>
143         <form name='facility-form' id="facility-form" method='post' action="facilities.php">
144             <input type="hidden" name="csrf_token_form" value="{{ csrfTokenRaw() }}">
145             <input type="hidden" name='mode' value="facility">
146             {% if mode == "edit" %}
147             <input type="hidden" name='newmode' value="admin_facility">
148             <!-- diffrentiate Admin and add post backs !-->
149             <input type="hidden" name="fid" value="{{ my_fid|default('')|attr }}">
150             {% endif %}
152             <div class="form-row">
153                 <div class="form-group w-100">
154                     <label for='facility' class="sr-only">{{ 'Name'|xlt }}</label>
155                     <input type='text' class='form-control form-control-lg' placeholder="{{ 'Facility Name'|xla }}" name='facility' value='{{ facility.name|default('')|attr }}'>
156                 </div>
157             </div>
158             <div class="form-row mb-2">
159                 <div class="col-sm-12 col-md-7">
160                     <div class="bg-light border">
161                         <ul class="nav nav-pills mt-2" id="addressTab" role="tablist">
162                             <li class="nav-item py-1 px-2" role="presentation">
163                                 <button type="button" class="nav-link py-1 px-2 active" id="physical-address-tab" data-toggle="tab" data-target="#physicalAddress" role="tab" aria-controls="physicalAddress" aria-selected="true">{{ 'Physical Address'|xlt }}</button>
164                             </li>
165                             <li class="nav-item py-1 px-2" role="presentation">
166                                 <button type="button" class="nav-link py-1 px-2" id="mailing-address-tab" data-toggle="tab" data-target="#mailingAddress" role="tab" aria-controls="mailingAddress" aria-selected="true">{{ 'Mailing Address'|xlt }}</button>
167                             </li>
168                         </ul>
169                         <div class="tab-content m-2" id="addressTabContent">
170                             <div class="tab-pane show active" id="physicalAddress" role="tabpanel" aria-labelledby="physical-address-tab">
171                                 <div class="form-row">
172                                     <div class="col-sm-12">
173                                         <div class="form-group">
174                                             <label for='street' class='col-form-label sr-only'>{{ 'Address'|xlt }} </label>
175                                             <div class="input-group">
176                                                 <div class="input-group-prepend">
177                                                     <button type="button" id="btnCopyMailing" class="btn btn-outline-secondary" title="{{ "Copy from mailing address"|xla }}"><i class="fa fa-clone"></i><span class="sr-only">{{ 'Copy Mailing'|xlt }}</span></button>
178                                                 </div>
179                                                 <input type='text' class='form-control' name="street" placeholder="{{ 'Address'|xla }}" value="{{ facility.street|default('')|attr }}">
180                                             </div>
181                                         </div>
182                                     </div>
183                                 </div>
184                                 <div class="form-row">
185                                     <div class="col-sm-4">
186                                         <div class="form-group">
187                                             <label for='city' class='col-form-label sr-only'>{{ 'City'|xlt }}: </label>
188                                             <input type='text' class='form-control' name='city' placeholder="{{ 'City'|xla }}" value="{{ facility.city|default('')|attr }}">
189                                         </div>
190                                     </div>
191                                     <div class="col-sm-2">
192                                         <div class="form-group">
193                                             <label for='state' class='col-form-label sr-only'>{{ 'State'|xlt }}</label>
194                                             <input type='text' class='form-control' name='state' placeholder="{{ 'State'|xla }}" value="{{ facility.state|default('')|attr }}">
195                                         </div>
196                                     </div>
197                                     <div class="col-sm-2">
198                                         <div class="form-group">
199                                             <label for='postal_code' class='col-form-label sr-only'>{{ 'Zip Code'|xlt }}</label>
200                                             <input type="text" class='form-control' placeholder="{{ 'Zip Code'|xla }}" name='postal_code' value="{{ facility.postal_code|default('')|attr }}" />
201                                         </div>
202                                     </div>
203                                     <div class="col-sm-4">
204                                         <div class="form-group">
205                                             <label for='country_code' class='col-form-label sr-only'>{{ 'Country'|xlt }}</label>
206                                             <input type='text' class='form-control' placeholder="{{ 'Country'|xla }}" name='country_code' value="{{ facility.country_code|default('')|attr }}">
207                                         </div>
208                                     </div>
209                                     <div class="col-sm-12">
211                                     </div>
212                                 </div>
213                             </div>
214                             <div class="tab-pane" id="mailingAddress" role="tabpanel" aria-labelledby="mailing-address-tab">
215                                 <div class="form-row">
216                                     <div class="col-sm-12">
217                                         <div class="form-group">
218                                             <label for="mail_street" class="col-form-label sr-only">{{ 'Mailing Address'|xlt }}</label>
219                                             <div class="input-group">
220                                                 <div class="input-group-prepend">
221                                                         <button type="button" id="btnCopyPhysical" class="btn btn-outline-secondary" title="{{ "Copy from physical address"|xla }}"><i class="fa fa-clone"></i><span class="sr-only">{{ 'Copy physical address'|xlt }}</span></button>
222                                                     </div>
223                                                 <input type="text" class="form-control" placeholder="{{ 'Street Addres'|xla }}" name="mail_street" value="{{ facility.mail_street|default('')|attr }}">
224                                             </div>
225                                         </div>
226                                     </div>
227                                     <div class="col-sm-12">
228                                         <div class="form-group">
229                                             <label for="mail_street2" class="col-form-label sr-only">{{ 'Address Line Two'|xlt }}</label>
230                                             <input type="text" class="form-control" placeholder="{{ 'Address Line Two'|xla }}" name="mail_street2" value="{{ facility.mail_street2|default('')|attr }}">
231                                         </div>
232                                     </div>
233                                 </div>
234                                 <div class="form-row">
235                                     <div class="col-sm-4">
236                                         <label for="mail_city" class="col-form-label sr-only">{{ 'City'|xlt }}</label>
237                                         <input type="text" class="form-control" placeholder="{{ 'City'|xla }}" name="mail_city" value="{{ facility.mail_city|default('')|attr }}">
238                                     </div>
239                                     <div class="col-sm-4">
240                                         <label for="mail_state" class="col-form-label sr-only">{{ 'State'|xlt }}</label>
241                                         <input type="text" class="form-control" placeholder="{{ 'State'|xla }}" name="mail_state" value="{{ facility.mail_state|default('')|attr }}">
242                                     </div>
243                                     <div class="col-sm-4">
244                                         <label for="mail_zip" class="col-form-label sr-only">{{ 'Zip'|xlt }}</label>
245                                         <input type="text" class="form-control" placeholder="{{ 'Zip Code'|xla }}" name="mail_zip" value="{{ facility.mail_zip|default('')|attr }}">
246                                     </div>
247                                 </div>
248                             </div>
249                         </div>
250                     </div>
251                 </div>
252                 <div class="col-sm-12 col-md-5">
253                     <div class="p-2 bg-light border">
254                         <div class="form-group row">
255                             <label class="col-form-label col-sm-2" for='phone'>{{ 'Phone'|xlt }}</label>
256                             <div class="col-sm-10">
257                                 <input type='text' class='form-control' name='phone' placeholder="{{ 'Phone'|xla }}" value='{{ facility.phone|default('')|attr }}'>
258                             </div>
259                         </div>
260                         <div class="form-group row">
261                             <label class="col-form-label col-sm-2" for='fax'>{{ 'Fax'|xlt }}</label>
262                             <div class="col-sm-10">
263                                 <input type="text" class='form-control' name="fax" placeholder="{{ 'Fax'|xla }}" value='{{ facility.fax|default('')|attr }}'>
264                             </div>
265                         </div>
266                         <div class="form-group row">
267                             <label class="col-form-label col-sm-2" for='website'>{{ 'Website'|xlt }}</label>
268                             <div class="col-sm-10">
269                                 <input type="text" class='form-control' placeholder="{{ 'Website'|xla }}" name='website' value="{{ facility.website|default('')|attr }}">
270                             </div>
271                         </div>
272                         <div class="form-group row">
273                             <label class="col-form-label col-sm-2" for='email'>{{ 'Email'|xlt }}</label>
274                             <div class="col-sm-10">
275                                 <input type="text" class='form-control' placeholder="{{ 'Email'|xla }}" name='email' value="{{ facility.email|default('')|attr }}">
276                             </div>
277                         </div>
278                     </div>
279                 </div>
280             </div>
281             <div class="form-row">
282             <div class="col-sm-12 col-md-7">
283                 <div class="border p-2 bg-light d-flex">
284                     <div class="pr-1">
285                         <div class="form-group">
286                             <label for='ncolor'>{{ 'Color'|xlt }}</label>
287                             <div class="input-group">
288                                 <input type="text" class='form-control form-control-sm' name='ncolor' id='ncolor' size='20' value="{{ facility.color|attr }}">
289                                 <div class="input-group-append">
290                                     <a href="#" onClick="pick('pick','newcolor'); return false;" class="btn btn-outline-secondary" name="pick" id="pick">
291                                         <i class="fa fa-eye-dropper"></i><span class="sr-only">{{ 'Pick'|xlt }}</span>
292                                     </a>
293                                 </div>
294                             </div>
295                         </div>
296                         <div class="form-group">
297                             <label for='pos_code'>{{ 'POS Code'|xlt }}</label>
298                             <select name="pos_code" class="form-control form-control-sm">
299                                 {% for c in pos_code %}
300                                     <option value="{{ c.code }}" {{ (facility.pos_code == c.code) ? 'selected' : '' }}>{{ c.code|text }}: {{ c.title|text }}</option>
301                                 {% endfor %}
302                             </select>
303                         </div>
304                         <div class="form-group">
305                             <label for="domain_identifier">{{ 'CLIA Number'|xlt }}</label>
306                             <input type="text" class="form-control form-control-sm" name="domain_identifier" size="45" value="{{ facility.domain_identifier|attr }}">
307                         </div>
308                         <div class="form-group">
309                             <label for='federal_ein'>{{ 'Tax ID'|xlt }}</label>
310                             <div class="input-group">
311                                 <div class="input-group-prepend">
312                                     <select name='tax_id_type' class='form-control form-control-sm'>
313                                         <option value="EI"{{ (facility.tax_id_type != 'SY') ? ' selected' : ''}}>{{ 'EIN'|xlt }}</option>
314                                         <option value="SY"{{ (facility.tax_id_type == 'SY') ? ' selected' : ''}}>{{ 'SSN'|xlt }}</option>
315                                     </select>
316                                 </div>
317                                 <input type='text' class='form-control form-control-sm' name='federal_ein' value="{{ facility.federal_ein|default('')|attr }}">
318                             </div>
319                         </div>
320                         <div class="form-group">
321                             <label for='facility_npi'>{{ (simple_dems == true) ? 'Facility Code'|xlt : 'Facility NPI'|xlt }}</label>
322                             <input type="text" class='form-control form-control-sm' size='20' name='facility_npi' value="{{ facility.facility_npi|default('')|attr }}">
323                         </div>
324                     </div>
325                     <div class="pl-1">
326                         <div class="form-group">
327                             <label for='iban'>{{ 'IBAN'|xlt }}</label>
328                             <input type="text" class='form-control form-control-sm' size='20' name='iban' value="{{ facility.iban|default('')|attr }}">
329                         </div>
330                         <div class="form-group">
331                             <label for='facility_taxonomy'>{{ 'Facility Taxonomy'|xlt }}</label>
332                             <input type="text" class='form-control form-control-sm' size='20' name='facility_taxonomy' value="{{ facility.facility_taxonomy|default('')|attr }}">
333                         </div>
334                         <div class="form-group">
335                             <label for="attn">{{ 'Billing Attn'|xlt }}</label>
336                             <input type="text" class="form-control form-control-sm" name="attn" size="45" value="{{ facility.attn|default('')|attr }}">
337                         </div>
338                         <div class="form-group">
339                             <label for="facility_id">{{ 'Facility Lab Code'|xlt }}</label>
340                             <input type="text" class="form-control form-control-sm" name="facility_id" size="45" value="{{ facility.facility_code|default('')|attr }}">
341                         </div>
342                         <div class="form-group">
343                             <label for="oid">{{ 'OID'|xlt }}: </label>
344                             <input type="text" class="form-control form-control-sm" size="20" name="oid" value="{{ facility.oid|default('')|attr }}">
345                         </div>
346                     </div>
347                 </div>
348             </div>
349             <div class="col-sm-12 col-md-5">
350                 <div class="border p-2 bg-light">
351                     <div class="form-row custom-control custom-switch my-2">
352                         <div class="col">
353                             <input type='checkbox' class='custom-control-input' name='billing_location' id='billing_location' value='1' {{ facility.billing_location != 0 ? 'checked' : '' }}>
354                             <label for='billing_location' class='custom-control-label'>{{ 'Billing Location'|xlt }}</label>
355                         </div>
356                     </div>
357                     <div class="form-row custom-control custom-switch my-2">
358                         <div class="col">
359                             <input type='checkbox' class='custom-control-input' name='accepts_assignment' id='accepts_assignment' value='1' {{ facility.accepts_assignment == 1 ? 'checked' : '' }}>
360                             <label for='accepts_assignment' class='custom-control-label'>{{ 'Accepts Assignment'|xlt }}</label>
361                         </div>
362                         <div class="col">
363                             <small class="form-text text-muted mt-0">({{ 'only if billing location'|xlt }})</small>
364                         </div>
365                     </div>
366                     <div class="form-row custom-control custom-switch my-2">
367                         <div class="col">
368                             <input type='checkbox' class='custom-control-input' name='service_location' id='service_location' value='1' {{ facility.service_location == 1 ? 'checked' : '' }}>
369                             <label for='service_location' class='custom-control-label'>{{ 'Service Location'|xlt }}</label>
370                         </div>
371                     </div>
372                     <div class="form-row custom-control custom-switch my-2">
373                         <div class="col">
374                             {% set _oc = (erxEnabled) ? 'onchange="return displayAlert()"' : '' %}
375                             {% set _pbeCheck = (facility.primary_business_entity == 1) ? 'checked' : '' %}
376                             <input type='checkbox' class='custom-control-input' name='primary_business_entity' id='primary_business_entity'
377                                    value='1' {{ _pbeCheck }} {{ _oc }} {{ disablePBE }}>
378                             <label for='primary_business_entity' class='custom-control-label'>{{ 'Primary Business Entity'|xlt }}</label>
379                         </div>
380                     </div>
381                     <div class="form-row custom-control custom-switch my-2">
382                         <div class="col">
383                             <input type='checkbox' class='custom-control-input' name='inactive' id='inactive' value='1'{{ facility.inactive != 0 ? ' checked' : '' }}>
384                             <label for='inactive' class='custom-control-label'>{{ 'Facility Inactive'|xlt }}</label>
385                         </div>
386                     </div>
387                 </div>
388                 <div class="border p-2 bg-light mt-2">
389                     <div class="form-group">
390                         <label for="info">{{ 'Info'|xlt }}</label>
391                         <textarea class="form-control form-control-sm" rows="5" name="info">{{ facility.info|default('')|text }}</textarea>
392                     </div>
393                 </div>
394                 <div class="p-2">
395                     <p class="text"><span class="mandatory">*</span> {{ 'Required'|xlt }}</p>
396                 </div>
397             </div>
398         </div>
399     </form>
400     </div>
401 </body>
402 {% if alertMsg %}
403 <script>
404 alert({{ alertMsg|xlj }});
405 </script>
406 {% endif %}
407 </html>