Some jquery updates (#2028)
[openemr.git] / templates / prescription / general_list.html
blob768590f54eb57a242851a9cba582f4c7833d307c
1 {**
2 * Prescription list
4 * @package OpenEMR
5 * @link http://www.open-emr.org
6 * @author Brady Miller <brady.g.miller@gmail.com>
7 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
8 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
9 *}
10 <html>
11 <head>
13 {headerTemplate assets='no_bootstrap|no_fontawesome|no_textformat|no_dialog'}
15 {literal}
16 <style type="text/css" title="mystyles" media="all">
17 .inactive {
18 color:#777777;
20 </style>
22 <script language="javascript">
24 function changeLinkHref(id,addValue,value) {
25 var myRegExp = new RegExp(":" + value + ":");
26 if (addValue){ //add value to href
27 if(document.getElementById(id) !== null)document.getElementById(id).href += ':' + value + ':';
29 else { //remove value from href
30 if(document.getElementById(id) !== null)document.getElementById(id).href = document.getElementById(id).href.replace(myRegExp,'');
34 function changeLinkHrefAll(addValue, value) {
35 changeLinkHref('multiprint', addValue, value);
36 changeLinkHref('multiprintcss', addValue, value);
37 changeLinkHref('multiprintToFax', addValue, value);
40 //uses jquery to update database table
41 function markTx(oThis,id){{/literal}
42 var isChecked = oThis.checked ? 1 : 0; // @TODO this is better served if checkboxs are all checked on submit with one call to markTx
43 $.get('./interface/weno/markTx.php?rx=' + encodeURIComponent(id) + '&state=' + encodeURIComponent(isChecked) + '&csrf_token_form=' + {$CSRF_TOKEN_FORM|js_url});
44 return false;
45 {literal}}
47 function changeLinkHref_All(id,addValue,value) {
48 var myRegExp = new RegExp(":" + value + ":");
49 if (addValue){ //add value to href
50 if(document.getElementById(id) !== null)document.getElementById(id).href += ':' + value + ':';
52 else { //remove value from href
53 if(document.getElementById(id) !== null)document.getElementById(id).href = document.getElementById(id).href.replace(myRegExp,'');
54 // TajEmo Work By CB 2012/06/14 02:17:16 PM remove the target change
55 //document.getElementById(id).target = '';
59 function Check(chk) {
60 var len=chk.length;
61 if (len==undefined) {chk.checked=true;}
62 else {
63 //clean the checked id's before check all the list again
64 document.getElementById('multiprint').href = document.getElementById('multiprint').href.substring(0, document.getElementById('multiprint').href.indexOf('=') + 1);
65 document.getElementById('multiprintcss').href = document.getElementById('multiprintcss').href.substring(0, document.getElementById('multiprintcss').href.indexOf('=') + 1);
66 document.getElementById('multiprintToFax').href = document.getElementById('multiprintToFax').href.substring(0, document.getElementById('multiprintToFax').href.indexOf('=') +1);
67 for (pr = 0; pr < chk.length; pr++){
68 if($(chk[pr]).parents("tr.inactive").length==0)
70 chk[pr].checked=true;
71 changeLinkHref_All('multiprint',true,chk[pr].value);
72 changeLinkHref_All('multiprintcss',true, chk[pr].value);
73 changeLinkHref_All('multiprintToFax',true, chk[pr].value);
79 function Uncheck(chk) {
80 var len=chk.length;
81 if (len==undefined) {chk.checked=false;}
82 else {
83 for (pr = 0; pr < chk.length; pr++){
84 chk[pr].checked=false;
85 changeLinkHref_All('multiprint',false,chk[pr].value);
86 changeLinkHref_All('multiprintcss',false, chk[pr].value);
87 changeLinkHref_All('multiprintToFax',false, chk[pr].value);
92 var CheckForChecks = function(chk) {
93 // Checks for any checked boxes, if none are found than an alert is raised and the link is killed
94 if (Checking(chk) == false) { return false; }
95 return top.restoreSession();
98 function Checking(chk) {
99 var len=chk.length;
100 var foundone=false;
102 if (len==undefined) {
103 if (chk.checked == true){
104 foundone=true;
107 else {
108 for (pr = 0; pr < chk.length; pr++){
109 if (chk[pr].checked == true) {
110 foundone=true;
114 if (foundone) {
115 return true;
116 } else {
117 alert("{/literal}{xl t='Please select at least one prescription!'}{literal}");
118 return false;
122 $(document).ready(function(){
123 $(":checkbox:checked").each(function () {
124 changeLinkHref('multiprint',this.checked, this.value);
125 changeLinkHref('multiprintcss',this.checked, this.value);
126 changeLinkHref('multiprintToFax',this.checked, this.value);
130 </script>
132 {/literal}
133 </head>
134 <body id="prescription_list" class="body_top">
136 {if $prescriptions}
137 <span class="title"><b>{xl t='List'|escape:'html'}</b></span>
139 <div id="prescription_list">
141 <form name="presc">
143 <div id="print_links">
144 <table width="100%">
145 <tr>
146 <td align="left">
147 <table>
148 <tr>
149 <td>
150 {if $GLOBALS.rx_zend_pdf_template}
151 <a target="_blank" id="multiprint" href="{$GLOBALS.webroot}/{$GLOBALS.baseModDir}{$GLOBALS.zendModDir}/public/prescription-pdf-template/{$GLOBALS.rx_zend_pdf_action}?id={$printm}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Download'|escape:'html'} ({xl t='PDF'|escape:'html'})</span></a>
152 {else}
153 <a id="multiprint" href="{$CONTROLLER}prescription&multiprint&id={$printm}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Download'|escape:'html'} ({xl t='PDF'|escape:'html'})</span></a>
154 {/if}
155 </td>
156 <td>
157 {if $GLOBALS.rx_zend_html_template}
158 <a target="_blank" id="multiprintcss" href="{$GLOBALS.webroot}/{$GLOBALS.baseModDir}{$GLOBALS.zendModDir}/public/prescription-html-template/{$GLOBALS.rx_zend_html_action}?id={$printm}" onclick="top.restoreSession()" class="css_button"><span>{xl t='View Printable Version'|escape:'html'} ({xl t='HTML'|escape:'html'})</span></a>
159 {else}
160 <!-- TajEmo work by CB 2012/06/14 02:16:32 PM target="_script" opens better -->
161 <a target="_script" id="multiprintcss" href="{$CONTROLLER}prescription&multiprintcss&id={$printm}" onclick="top.restoreSession()" class="css_button"><span>{xl t='View Printable Version'|escape:'html'} ({xl t='HTML'|escape:'html'})</span></a>
162 {/if}
163 </td>
164 {if $GLOBALS.rx_use_fax_template}
165 <td style="border-style:none;">
166 <a id="multiprintToFax" href="{$CONTROLLER}prescription&multiprintfax&id={$printm}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Download'|escape:'html'} ({xl t='Fax'|escape:'html'})</span></a>
167 </td>
168 {/if}
169 {if $GLOBALS.weno_rx_enable}
170 <td style="border-style:none;">
171 <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'|escape:'html'} {xl t='Rx'|escape:'html'}</span></a>
172 </td>
173 {/if}
174 {if $CAMOS_FORM == true}
175 <td>
176 <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'|escape:'html'}</span></a>
177 </td>
178 {/if}
179 </tr>
180 </table>
181 </td>
182 <td align="right">
183 <table>
184 <tr>
185 <td>
186 <a href="#" class="small" onClick="Check(document.presc.check_list);"><span>{xl t='Check All'|escape:'html'}</span></a> |
187 <a href="#" class="small" onClick="Uncheck(document.presc.check_list);"><span>{xl t='Clear All'|escape:'html'}</span></a>
188 </td>
189 </tr>
190 </table>
191 </td>
192 </tr>
193 </table>
194 </div>
197 <table width="100%" class="showborder_head" cellspacing="0px" cellpadding="2px">
198 <tr>
199 <!-- TajEmo Changes 2012/06/14 02:01:43 PM by CB added Heading for checkbox column -->
200 <th width="8px">&nbsp;</th>
201 <th width="8px">&nbsp;</th>
203 <th width="70px">{xl t='Drug'|escape:'html'}</th>
204 <th width="70px">{xl t='RxNorm'|escape:'html'}</th>
205 <th width="70px">{xl t='Created'|escape:'html'}<br />{xl t='Changed'|escape:'html'}</th>
206 <th width="20px">{xl t='Dosage'|escape:'html'}</th>
207 <th width="20px">{xl t='Qty'|escape:'html'}.</th>
208 <th>{xl t='Unit'|escape:'html'}</th>
209 <th width="20px">{xl t='Refills'|escape:'html'}</th>
210 <th>{xl t='Provider'|escape:'html'}</th>
211 {if $GLOBALS.weno_rx_enable}
212 <th>{xl t='Send'|escape:'html'}<br>{xl t='NewRx'|escape:'html'}</th>
213 <th>{xl t='Refill'|escape:'html'}<br>{xl t='Rx'|escape:'html'}</th>
214 <th>{xl t='Last'|escape:'html'}<br>{xl t='Tx Date'|escape:'html'}</th>
215 {/if}
216 </tr>
218 {foreach from=$prescriptions item=prescription}
219 <!-- TajEmo Changes 2012/06/14 02:03:17 PM by CB added cursor:pointer for easier user understanding -->
220 <tr style="cursor:pointer" id="{$prescription->id|escape:'html'}" class="showborder onescript {if $prescription->active <= 0} inactive{/if}" title="{xl t='Click to view/edit'|escape:'html'}">
221 <td align="center">
222 <input class="check_list" id="check_list" type="checkbox" value="{$prescription->id|escape:'html'}" {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'|escape:'html'}">
223 </td>
224 {if $prescription->erx_source==0}
225 <td class="editscript" id="{$prescription->id}">
226 <a class='editscript css_button_small' id='{$prescription->id}' href="controller.php?prescription&edit&id={$prescription->id}" style="margin-top:-2px"><span>{xl t='Edit'|escape:'html'}</span></a>
227 <!-- TajEmo Changes 2012/06/14 02:02:22 PM by CB commented out, to avoid duplicate display of drug name
228 {if $prescription->active > 0}<b>{/if}{$prescription->drug}{if $prescription->active > 0}</b>{/if}&nbsp;
230 </td>
231 <td class="editscript" id="{$prescription->id}">
232 {if $prescription->active > 0}<b>{/if}{$prescription->drug|escape:'html'}{if $prescription->active > 0}</b>{/if}&nbsp;
233 <br />{$prescription->note|escape:'html'}
234 </td>
235 {else}
236 <td>&nbsp;</td>
237 <td id="{$prescription->id}">
238 {if $prescription->active > 0}<b>{/if}{$prescription->drug|escape:'html'}{if $prescription->active > 0}</b>{/if}&nbsp;
239 <br />{$prescription->note|escape:'html'}
240 </td>
241 {/if}
242 <td id="{$prescription->id}">
243 {$prescription->rxnorm_drugcode|escape:'html'}&nbsp;
244 </td>
245 <td id="{$prescription->id}">
246 {$prescription->date_added|escape:'html'}<br />
247 {$prescription->date_modified|escape:'html'}&nbsp;
248 </td>
249 <td id="{$prescription->id}">
250 {$prescription->get_dosage_display()|escape:'html'} &nbsp;
251 </td>
252 {if $prescription->erx_source==0}
253 <td class="editscript" id="{$prescription->id}">
254 {$prescription->quantity|escape:'html'} &nbsp;
255 </td>
256 {else}
257 <td id="{$prescription->id}">
258 {$prescription->quantity|escape:'html'} &nbsp;
259 </td>
260 {/if}
261 <td id="{$prescription->id}">
262 {$prescription->get_size()|escape:'html'} {$prescription->get_unit_display()|escape:'html'}&nbsp;
263 </td>
264 <td id="{$prescription->id}">
265 {$prescription->refills|escape:'html'} &nbsp;
266 </td>
267 <td id="{$prescription->id}">
268 {$prescription->provider->get_name_display()|escape:'html'}&nbsp;
269 </td>
270 {if $GLOBALS.weno_rx_enable}
271 <td align="center">
272 {if $prescription->ntx == 0}
273 <input class="check_list" id="NewRx-{$smarty.foreach.rx.index|escape:'html'}" type="checkbox" {if $prescription->active < 1}disabled="disabled" {/if} value="{$prescription->id|escape:'html'}" {if $prescription->ntx > 0 && $prescription->active > 0}checked="checked" {/if} onClick="markTx(this,'NewRx-{$prescription->id|escape:'html'}'); changeLinkHrefAll(this.checked, this.value);" title={xl t="Select to transmit"|escape:'html'}>
274 {/if}
275 </td>
276 <td align="center">
277 {if $prescription->ntx == 1}
278 <input class="check_list" id="RefillRx-{$smarty.foreach.rx.index|escape:'html'}" type="checkbox" {if $prescription->active < 1}disabled="disabled" {/if} value="{$prescription->id|escape:'html'}" {if $prescription->ntx > 0 && $prescription->active > 0}checked="checked" {/if} onClick="markTx(this,'RefillRx-{$prescription->id|escape:'html'}'); changeLinkHrefAll(this.checked, this.value);" title={xl t="Select to transmit"|escape:'html'}>
279 {/if}
280 </td>
281 <td id="{$prescription->id|escape:'html'}" align="center">
282 {$prescription->txDate|escape:'html'}
283 </td>
284 {/if}
285 </tr>
286 {/foreach}
288 </table>
290 </form>
291 </div>
293 {else}
294 <div class="text" style="margin-top:10px">{xl t='There are currently no prescriptions'|escape:'html'}.</div>
295 {/if}
297 </body>
298 {literal}
299 <script language='JavaScript'>
301 $(document).ready(function(){
302 $("#multiprint").on("click", function() { return CheckForChecks(document.presc.check_list); });
303 $("#multiprintcss").on("click", function() { return CheckForChecks(document.presc.check_list); });
304 $("#multiprintToFax").on("click", function() { return CheckForChecks(document.presc.check_list); });
305 $(".editscript").on("click", function() { ShowScript(this); });
306 $(".onescript").on("mouseover", function() { $(this).children().toggleClass("highlight"); });
307 $(".onescript").on("mouseout", function() { $(this).children().toggleClass("highlight"); });
310 var ShowScript = function(eObj) {
311 top.restoreSession();
312 objID = eObj.id;
313 document.location.href="{/literal}{$GLOBALS.webroot}{literal}/controller.php?prescription&edit&id="+objID;
314 return true;
317 </script>
318 {/literal}
319 </html>