consolidate attr_url function (#2143)
[openemr.git] / templates / prescription / general_list.html
blob9f0e182e8613f9b0181547d0502765bde3f71a14
1 {**
2 * Prescription list
4 * @package OpenEMR
5 * @link http://www.open-emr.org
6 * @author Brady Miller <brady.g.miller@gmail.com>
7 * @author Sherwin Gaddis <sherwingaddis@gmail.com>
8 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Sherwin Gaddis <sherwingaddis@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
12 <html>
13 <head>
15 {headerTemplate assets='no_textformat|no_dialog'}
17 {literal}
18 <script language="javascript">
20 function changeLinkHref(id,addValue,value) {
21 var myRegExp = new RegExp(":" + value + ":");
22 if (addValue){ //add value to href
23 if(document.getElementById(id) !== null)document.getElementById(id).href += ':' + value + ':';
25 else { //remove value from href
26 if(document.getElementById(id) !== null)document.getElementById(id).href = document.getElementById(id).href.replace(myRegExp,'');
30 function changeLinkHrefAll(addValue, value) {
31 changeLinkHref('multiprint', addValue, value);
32 changeLinkHref('multiprintcss', addValue, value);
33 changeLinkHref('multiprintToFax', addValue, value);
36 //uses jquery to update database table
37 function markTx(oThis,id){{/literal}
38 var isChecked = oThis.checked ? 1 : 0; // @TODO this is better served if checkboxs are all checked on submit with one call to markTx
39 $.get('./interface/weno/markTx.php?rx=' + encodeURIComponent(id) + '&state=' + encodeURIComponent(isChecked) + '&csrf_token_form=' + {$CSRF_TOKEN_FORM|js_url});
40 return false;
41 {literal}}
43 function changeLinkHref_All(id,addValue,value) {
44 var myRegExp = new RegExp(":" + value + ":");
45 if (addValue){ //add value to href
46 if(document.getElementById(id) !== null)document.getElementById(id).href += ':' + value + ':';
48 else { //remove value from href
49 if(document.getElementById(id) !== null)document.getElementById(id).href = document.getElementById(id).href.replace(myRegExp,'');
50 // TajEmo Work By CB 2012/06/14 02:17:16 PM remove the target change
51 //document.getElementById(id).target = '';
55 function Check(chk) {
56 var len=chk.length;
57 if (len==undefined) {chk.checked=true;}
58 else {
59 //clean the checked id's before check all the list again
60 document.getElementById('multiprint').href = document.getElementById('multiprint').href.substring(0, document.getElementById('multiprint').href.indexOf('=') + 1);
61 document.getElementById('multiprintcss').href = document.getElementById('multiprintcss').href.substring(0, document.getElementById('multiprintcss').href.indexOf('=') + 1);
62 document.getElementById('multiprintToFax').href = document.getElementById('multiprintToFax').href.substring(0, document.getElementById('multiprintToFax').href.indexOf('=') +1);
63 for (pr = 0; pr < chk.length; pr++){
64 if($(chk[pr]).parents("tr.inactive").length==0)
66 chk[pr].checked=true;
67 changeLinkHref_All('multiprint',true,chk[pr].value);
68 changeLinkHref_All('multiprintcss',true, chk[pr].value);
69 changeLinkHref_All('multiprintToFax',true, chk[pr].value);
75 function Uncheck(chk) {
76 var len=chk.length;
77 if (len==undefined) {chk.checked=false;}
78 else {
79 for (pr = 0; pr < chk.length; pr++){
80 chk[pr].checked=false;
81 changeLinkHref_All('multiprint',false,chk[pr].value);
82 changeLinkHref_All('multiprintcss',false, chk[pr].value);
83 changeLinkHref_All('multiprintToFax',false, chk[pr].value);
88 var CheckForChecks = function(chk) {
89 // Checks for any checked boxes, if none are found than an alert is raised and the link is killed
90 if (Checking(chk) == false) { return false; }
91 return top.restoreSession();
94 function Checking(chk) {
95 var len=chk.length;
96 var foundone=false;
98 if (len==undefined) {
99 if (chk.checked == true){
100 foundone=true;
103 else {
104 for (pr = 0; pr < chk.length; pr++){
105 if (chk[pr].checked == true) {
106 foundone=true;
110 if (foundone) {
111 return true;
112 } else {
113 alert({/literal}{xl t='Please select at least one prescription!'|js_escape}{literal});
114 return false;
118 $(document).ready(function(){
119 $(":checkbox:checked").each(function () {
120 changeLinkHref('multiprint',this.checked, this.value);
121 changeLinkHref('multiprintcss',this.checked, this.value);
122 changeLinkHref('multiprintToFax',this.checked, this.value);
126 </script>
128 {/literal}
129 </head>
130 <body id="prescription_list" class="body_top">
132 {if $prescriptions}
133 <h3>{xl t='List'|text}</h3>
134 <div id="prescription_list">
136 <form name="presc">
138 <div id="print_links">
139 <table width="100%">
140 <tr>
141 <td align="left">
142 <table>
143 <tr>
144 <td>
145 {if $GLOBALS.rx_zend_pdf_template}
146 <a target="_blank" id="multiprint" href="{$GLOBALS.webroot}/{$GLOBALS.baseModDir}{$GLOBALS.zendModDir}/public/prescription-pdf-template/{$GLOBALS.rx_zend_pdf_action}?id={$printm|attr_url}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Download'|text} ({xl t='PDF'|text})</span></a>
147 {else}
148 <a id="multiprint" href="{$CONTROLLER}prescription&multiprint&id={$printm|attr_url}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Download'|text} ({xl t='PDF'|text})</span></a>
149 {/if}
150 </td>
151 <td>
152 {if $GLOBALS.rx_zend_html_template}
153 <a target="_blank" id="multiprintcss" href="{$GLOBALS.webroot}/{$GLOBALS.baseModDir}{$GLOBALS.zendModDir}/public/prescription-html-template/{$GLOBALS.rx_zend_html_action}?id={$printm|attr_url}" onclick="top.restoreSession()" class="css_button"><span>{xl t='View Printable Version'|text} ({xl t='HTML'|text})</span></a>
154 {else}
155 <!-- TajEmo work by CB 2012/06/14 02:16:32 PM target="_script" opens better -->
156 <a target="_script" id="multiprintcss" href="{$CONTROLLER}prescription&multiprintcss&id={$printm|attr_url}" onclick="top.restoreSession()" class="css_button"><span>{xl t='View Printable Version'|text} ({xl t='HTML'|text})</span></a>
157 {/if}
158 </td>
159 {if $GLOBALS.rx_use_fax_template}
160 <td style="border-style:none;">
161 <a id="multiprintToFax" href="{$CONTROLLER}prescription&multiprintfax&id={$printm|attr_url}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Download'|text} ({xl t='Fax'|text})</span></a>
162 </td>
163 {/if}
164 {if $GLOBALS.weno_rx_enable}
165 <td style="border-style:none;">
166 <a id="multiprintToFax" href="{$GLOBALS.webroot}/interface/weno/validate.php?csrf_token_form={$CSRF_TOKEN_FORM|attr_url}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Transmit'|text} {xl t='Rx'|text}</span></a>
167 </td>
168 {/if}
169 {if $CAMOS_FORM == true}
170 <td>
171 <a id="four_panel_rx" href="{$GLOBALS.webroot}/interface/forms/CAMOS/rx_print.php?sigline=plain" onclick="top.restoreSession()" class="css_button"><span>{xl t='View Four Panel'|text}</span></a>
172 </td>
173 {/if}
174 </tr>
175 </table>
176 </td>
177 <td align="right">
178 <table>
179 <tr>
180 <td>
181 <a href="#" class="small" onClick="Check(document.presc.check_list);"><span>{xl t='Check All'|text}</span></a> |
182 <a href="#" class="small" onClick="Uncheck(document.presc.check_list);"><span>{xl t='Clear All'|text}</span></a>
183 </td>
184 </tr>
185 </table>
186 </td>
187 </tr>
188 </table>
189 </div>
192 <table class="table">
193 <thead>
194 <tr>
195 <!-- TajEmo Changes 2012/06/14 02:01:43 PM by CB added Heading for checkbox column -->
196 <th>&nbsp;</th>
197 <th>&nbsp;</th>
198 <th>{xl t='Drug'|text}</th>
199 <th>{xl t='RxNorm'|text}</th>
200 <th>{xl t='Created'|text}<br />{xl t='Changed'|text}</th>
201 <th>{xl t='Dosage'|text}</th>
202 <th>{xl t='Qty'|text}.</th>
203 <th>{xl t='Unit'|text}</th>
204 <th>{xl t='Refills'|text}</th>
205 <th>{xl t='Provider'|text}</th>
206 {if $GLOBALS.weno_rx_enable}
207 <th>{xl t='Send NewRx'|text}</th>
208 <th>{xl t='Refill Rx'|text}</th>
209 <th>{xl t='Last Tx Date'|text}</th>
210 {/if}
211 </tr>
212 </thead>
213 <tbody>
214 {foreach from=$prescriptions item=prescription}
215 <!-- TajEmo Changes 2012/06/14 02:03:17 PM by CB added cursor:pointer for easier user understanding -->
216 <tr id="{$prescription->id|attr}" class="showborder onescript {if $prescription->active <= 0} inactive{/if}">
217 <td align="center">
218 <input class="check_list" id="check_list" type="checkbox" value="{$prescription->id|attr}" {if $prescription->encounter == $prescription->get_encounter() && $prescription->active > 0}checked="checked" {/if}onclick="changeLinkHref('multiprint',this.checked, this.value);changeLinkHref('multiprintcss',this.checked, this.value);changeLinkHref('multiprintToFax',this.checked, this.value)" title="{xl t='Select for printing'|attr}">
219 </td>
220 {if $prescription->erx_source==0}
221 <td class="editscript" id="{$prescription->id|attr}">
222 <a class='editscript css_button_small' id='{$prescription->id|attr}' href="controller.php?prescription&edit&id={$prescription->id|attr_url}"><span>{xl t='Edit'|text}</span></a>
223 <!-- TajEmo Changes 2012/06/14 02:02:22 PM by CB commented out, to avoid duplicate display of drug name
224 {if $prescription->active > 0}<b>{/if}{$prescription->drug}{if $prescription->active > 0}</b>{/if}&nbsp;
226 </td>
227 <td class="editscript" id="{$prescription->id|attr}">
228 {if $prescription->active > 0}<b>{/if}{$prescription->drug|text}{if $prescription->active > 0}</b>{/if}&nbsp;
229 <br />{$prescription->note|text}
230 </td>
231 {else}
232 <td>&nbsp;</td>
233 <td id="{$prescription->id|attr}">
234 {if $prescription->active > 0}<b>{/if}{$prescription->drug|text}{if $prescription->active > 0}</b>{/if}&nbsp;
235 <br />{$prescription->note|text}
236 </td>
237 {/if}
238 <td id="{$prescription->id|attr}">
239 {$prescription->rxnorm_drugcode|text}&nbsp;
240 </td>
241 <td id="{$prescription->id|attr}">
242 {$prescription->date_added|text}<br />
243 {$prescription->date_modified|text}&nbsp;
244 </td>
245 <td id="{$prescription->id|attr}">
246 {$prescription->get_dosage_display()|text} &nbsp;
247 </td>
248 {if $prescription->erx_source==0}
249 <td class="editscript" id="{$prescription->id|attr}">
250 {$prescription->quantity|text} &nbsp;
251 </td>
252 {else}
253 <td id="{$prescription->id|attr}">
254 {$prescription->quantity|text} &nbsp;
255 </td>
256 {/if}
257 <td id="{$prescription->id|attr}">
258 {$prescription->get_size()|text} {$prescription->get_unit_display()|text}&nbsp;
259 </td>
260 <td id="{$prescription->id|attr}">
261 {$prescription->refills|escape:'html'} &nbsp;
262 </td>
263 <td id="{$prescription->id|attr}">
264 {$prescription->provider->get_name_display()|text}&nbsp;
265 </td>
266 {if $GLOBALS.weno_rx_enable}
267 <td align="center">
268 {if $prescription->ntx == 0}
269 <input class="check_list" id="NewRx-{$smarty.foreach.rx.index|attr}" type="checkbox" {if $prescription->active < 1}disabled="disabled" {/if} value="{$prescription->id|attr}" {if $prescription->ntx > 0 && $prescription->active > 0}checked="checked" {/if} onClick="markTx(this,'NewRx-{$prescription->id|attr}'); changeLinkHrefAll(this.checked, this.value);" title="{xl t="Select to transmit"|attr}">
270 {/if}
271 </td>
272 <td align="center">
273 {if $prescription->ntx == 1}
274 <input class="check_list" id="RefillRx-{$smarty.foreach.rx.index|attr}" type="checkbox" {if $prescription->active < 1}disabled="disabled" {/if} value="{$prescription->id|attr}" {if $prescription->ntx > 0 && $prescription->active > 0}checked="checked" {/if} onClick="markTx(this,'RefillRx-{$prescription->id|attr}'); changeLinkHrefAll(this.checked, this.value);" title="{xl t="Select to transmit"|attr}">
275 {/if}
276 </td>
277 <td id="{$prescription->id|attr}" align="center">
278 {$prescription->txDate|text}
279 </td>
280 {/if}
281 </tr>
282 {/foreach}
283 </tbody>
284 </table>
286 </form>
287 </div>
289 {if $GLOBALS.rx_show_drug_drug}
290 <div id="drug-drug">
291 <hr>
292 <h3>{xl t='Drug-Drug Interaction'|text}</h3>
293 <p title="{xl t='Severity information will be missing if interaction is found'|attr}"><a href="#">*{xl t='Notice'|text}</a></p>
294 <div id="return_info">
295 {$INTERACTION}
296 </div>
297 <hr>
298 </div>
299 {/if}
301 {else}
302 <div class="text" style="margin-top:10px">{xl t='There are currently no prescriptions'|text}.</div>
303 {/if}
305 </body>
306 {literal}
307 <script language='JavaScript'>
309 $(document).ready(function(){
310 $("#multiprint").on("click", function() { return CheckForChecks(document.presc.check_list); });
311 $("#multiprintcss").on("click", function() { return CheckForChecks(document.presc.check_list); });
312 $("#multiprintToFax").on("click", function() { return CheckForChecks(document.presc.check_list); });
313 $(".editscript").on("click", function() { ShowScript(this); });
314 $(".onescript").on("mouseover", function() { $(this).children().toggleClass("highlight"); });
315 $(".onescript").on("mouseout", function() { $(this).children().toggleClass("highlight"); });
318 var ShowScript = function(eObj) {
319 top.restoreSession();
320 objID = eObj.id;
321 document.location.href="{/literal}{$GLOBALS.webroot}{literal}/controller.php?prescription&edit&id=" + encodeURIComponent(objID);
322 return true;
325 </script>
326 {/literal}
327 </html>