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-->
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.
23 var collectvalidation = {{ collectThis }};
25 function submitform() {
27 var valid = submitme(1, undefined, 'facility-form', collectvalidation);
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);
57 let post_url = $("#facility-form").attr("action");
58 let request_method = $("#facility-form").attr("method");
59 let form_data = $("#facility-form").serialize();
65 }).done(function (r) { //
66 dlgclose('refreshme', false);
71 function copyAddress(base) {
73 ["mail_street", "street"],
74 ["mail_city", "city"],
75 ["mail_state", "state"],
76 ["mail_zip", "postal_code"]
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 + "']");
92 * add required/star sign to required form fields
94 for (var prop in collectvalidation) {
95 //if (collectvalidation[prop].requiredSign)
96 if (collectvalidation[prop].presence)
97 $("label[for='" + prop + "']").append('*');
100 $("input[name='facility']").focus();
101 $("#btnCopyMailing").on('click', function() {
102 copyAddress("mailing");
104 $("#btnCopyPhysical").on('click', function() {
105 copyAddress("physical");
108 var cp = new ColorPicker('window');
110 // Runs when a color is clicked
111 function pickColor(color) {
112 document.getElementById('ncolor').value = color;
117 function pick(anchorname, target) {
118 var cp = new ColorPicker('window');
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 }});
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>
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>
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 }}">
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 }}'>
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>
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>
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>
179 <input type='text' class='form-control' name="street" placeholder="{{ 'Address'|xla }}" value="{{ facility.street|default('')|attr }}">
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 }}">
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 }}">
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 }}" />
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 }}">
209 <div class="col-sm-12">
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>
223 <input type="text" class="form-control" placeholder="{{ 'Street Addres'|xla }}" name="mail_street" value="{{ facility.mail_street|default('')|attr }}">
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 }}">
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 }}">
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 }}">
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 }}">
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 }}'>
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 }}'>
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 }}">
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 }}">
281 <div class="form-row">
282 <div class="col-sm-12 col-md-7">
283 <div class="border p-2 bg-light d-flex">
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>
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>
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 }}">
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>
317 <input type='text' class='form-control form-control-sm' name='federal_ein' value="{{ facility.federal_ein|default('')|attr }}">
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 }}">
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 }}">
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 }}">
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 }}">
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 }}">
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 }}">
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">
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>
357 <div class="form-row custom-control custom-switch my-2">
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>
363 <small class="form-text text-muted mt-0">({{ 'only if billing location'|xlt }})</small>
366 <div class="form-row custom-control custom-switch my-2">
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>
372 <div class="form-row custom-control custom-switch my-2">
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>
381 <div class="form-row custom-control custom-switch my-2">
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>
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>
395 <p class="text"><span class="mandatory">*</span> {{ 'Required'|xlt }}</p>
404 alert({{ alertMsg|xlj }});