minor psr12 fix
[openemr.git] / templates / prescription / general_list.html
blobf0c99c03ba549cd34d3eabdfff97098dbd1b959c
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>
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 var multiprint=document.getElementById('multiprint');
61 if(multiprint!==null) {
62 multiprint.href = document.getElementById('multiprint').href.substring(0, document.getElementById('multiprint').href.indexOf('=') + 1);
65 var multiprintcss=document.getElementById('multiprintcss');
66 if(multiprintcss!==null) {
67 multiprintcss.href = document.getElementById('multiprintcss').href.substring(0, document.getElementById('multiprintcss').href.indexOf('=') + 1);
70 var multiprintToFax=document.getElementById('multiprintToFax');
71 if(multiprintToFax!==null) {
72 multiprintToFax.href = document.getElementById('multiprintToFax').href.substring(0, document.getElementById('multiprintToFax').href.indexOf('=') +1);
74 for (let pr = 0; pr < chk.length; pr++){
75 if($(chk[pr]).parents("tr.inactive").length==0)
77 chk[pr].checked=true;
78 changeLinkHref_All('multiprint',true,chk[pr].value);
79 changeLinkHref_All('multiprintcss',true, chk[pr].value);
80 changeLinkHref_All('multiprintToFax',true, chk[pr].value);
86 function deleteDrug(d) {
87 let msg = {/literal}{xlj t='Do you really want to delete?'}{literal};
88 let choice = confirm(msg + d);
89 if (choice == true) {
90 top.restoreSession();
91 $.ajax({
92 url: "./library/deleteDrug.php",
93 type: 'POST',
94 data: {
95 drugId: d,
96 csrf_token_form: {$CSRF_TOKEN_FORM|js_escape}
98 success: function(data) {
99 console.log(data);
100 location.reload();
102 error: function(error) {
103 console.log(error)
109 function Uncheck(chk) {
110 var len=chk.length;
111 if (len==undefined) {chk.checked=false;}
112 else {
113 for (pr = 0; pr < chk.length; pr++){
114 chk[pr].checked=false;
115 changeLinkHref_All('multiprint',false,chk[pr].value);
116 changeLinkHref_All('multiprintcss',false, chk[pr].value);
117 changeLinkHref_All('multiprintToFax',false, chk[pr].value);
122 var CheckForChecks = function(chk) {
123 // Checks for any checked boxes, if none are found than an alert is raised and the link is killed
124 if (Checking(chk) == false) { return false; }
125 return top.restoreSession();
128 function Checking(chk) {
129 var len=chk.length;
130 var foundone=false;
132 if (len==undefined) {
133 if (chk.checked == true){
134 foundone=true;
137 else {
138 for (pr = 0; pr < chk.length; pr++){
139 if (chk[pr].checked == true) {
140 foundone=true;
144 if (foundone) {
145 return true;
146 } else {
147 alert({/literal}{xlj t='Please select at least one prescription!'}{literal});
148 return false;
152 $(function () {
153 $(":checkbox:checked").each(function () {
154 changeLinkHref('multiprint',this.checked, this.value);
155 changeLinkHref('multiprintcss',this.checked, this.value);
156 changeLinkHref('multiprintToFax',this.checked, this.value);
160 </script>
162 {/literal}
163 </head>
164 <body id="prescription_list">
165 <div class="container-fluid">
166 <div class="row">
167 {if $prescriptions}
168 <div class="col-12">
169 <h3>{xlt t='List'}</h3>
170 </div>
171 <div class="col-12 d-flex justify-content-between">
172 <div class="btn-group">
173 {if $GLOBALS.rx_zend_pdf_template}
174 <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="btn btn-primary btn-sm">{xlt t='Download'} ({xlt t='PDF'})</a>
175 {else}
176 <a id="multiprint" href="{$CONTROLLER}prescription&multiprint&id={$printm|attr_url}" onclick="top.restoreSession()" class="btn btn-primary btn-sm btn-download">{xlt t='Download'} ({xl t='PDF'})</a>
177 {/if}
178 {if $GLOBALS.rx_zend_html_template}
179 <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="btn btn-primary btn-sm">{xl t='View Printable Version'|text} ({xlt t='HTML'})</a>
180 {else}
181 <!-- TajEmo work by CB 2012/06/14 02:16:32 PM target="_script" opens better -->
182 <a target="_script" id="multiprintcss" href="{$CONTROLLER}prescription&multiprintcss&id={$printm|attr_url}" onclick="top.restoreSession()" class="btn btn-primary btn-sm btn-print">{xlt t='View Printable Version'} ({xlt t='HTML'})</a>
183 {/if}
184 {if $GLOBALS.rx_use_fax_template}
185 <a id="multiprintToFax" href="{$CONTROLLER}prescription&multiprintfax&id={$printm|attr_url}" onclick="top.restoreSession()" class="btn btn-primary btn-sm btn-download">{xlt t='Download'} ({xlt t='Fax'})</a>
186 {/if}
187 {if $GLOBALS.weno_rx_enable}
188 <a id="multiprintToFax" href="{$GLOBALS.webroot}/interface/weno/validate.php?csrf_token_form={$CSRF_TOKEN_FORM|attr_url}" onclick="top.restoreSession()" class="btn btn-primary btn-sm btn-transmit">{xlt t='Transmit'} {xlt t='Rx'}</a>
189 {/if}
190 {if $CAMOS_FORM == true}
191 <a id="four_panel_rx" href="{$GLOBALS.webroot}/interface/forms/CAMOS/rx_print.php?sigline=plain" onclick="top.restoreSession()" class="btn btn-primary btn-sm">{xlt t='View Four Panel'}</a>
192 {/if}
193 </div>
194 <div class="btn-group">
195 <a href="#" class="small" onClick="Check(document.presc.check_list);"><span>{xlt t='Check All'}</span></a> |
196 <a href="#" class="small" onClick="Uncheck(document.presc.check_list);"><span>{xlt t='Clear All'}</span></a>
197 </div>
198 </div>
199 <div class="col-12">
200 <div id="prescription_list">
201 <form name="presc">
202 <div class="table-responsive">
203 <table class="table table-hover">
204 <thead>
205 <tr>
206 <!-- TajEmo Changes 2012/06/14 02:01:43 PM by CB added Heading for checkbox column -->
207 <th>&nbsp;</th>
208 <th>&nbsp;</th>
209 <th>{xlt t='Drug'}</th>
210 <th>{xlt t='RxNorm'}</th>
211 <th>{xlt t='Created'}<br />{xlt t='Changed'}</th>
212 <th>{xlt t='Dosage'}</th>
213 <th>{xlt t='Qty'}.</th>
214 <th>{xlt t='Unit'}</th>
215 <th>{xlt t='Refills'}</th>
216 <th>{xlt t='Provider'}</th>
217 {if $GLOBALS.weno_rx_enable}
218 <th>{xlt t='Send NewRx'}</th>
219 <th>{xlt t='Refill Rx'}</th>
220 <th>{xlt t='Last Tx Date'}</th>
221 {/if}
222 <th></th>
223 </tr>
224 </thead>
225 <tbody>
226 {foreach from=$prescriptions item=prescription}
227 <!-- TajEmo Changes 2012/06/14 02:03:17 PM by CB added cursor:pointer for easier user understanding -->
228 <tr id="{$prescription->id|attr}" class="showborder onescript {if $prescription->active <= 0} inactive{/if}">
229 <td class="text-center">
230 <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="{xla t='Select for printing'}">
231 </td>
232 {if $prescription->erx_source==0}
233 <td class="editscript" id="{$prescription->id|attr}">
234 <a class='editscript btn btn-primary btn-sm btn-edit' id='{$prescription->id|attr}' href="controller.php?prescription&edit&id={$prescription->id|attr_url}">{xlt t='Edit'}</a>
235 <!-- TajEmo Changes 2012/06/14 02:02:22 PM by CB commented out, to avoid duplicate display of drug name
236 {if $prescription->active > 0}<b>{/if}{$prescription->drug}{if $prescription->active > 0}</b>{/if}&nbsp;
238 </td>
239 <td class="editscript" id="{$prescription->id|attr}">
240 {if $prescription->active > 0}<b>{/if}{$prescription->drug|text}{if $prescription->active > 0}</b>{/if}&nbsp;
241 <br />{$prescription->note|text}
242 </td>
243 {else}
244 <td>&nbsp;</td>
245 <td id="{$prescription->id|attr}">
246 {if $prescription->active > 0}<b>{/if}{$prescription->drug|text}{if $prescription->active > 0}</b>{/if}&nbsp;
247 <br />{$prescription->note|text}
248 </td>
249 {/if}
250 <td id="{$prescription->id|attr}">
251 {$prescription->rxnorm_drugcode|text}&nbsp;
252 </td>
253 <td id="{$prescription->id|attr}">
254 {$prescription->date_added|oeFormatShortDate|text}<br />
255 {$prescription->date_modified|oeFormatShortDate|text}&nbsp;
256 </td>
257 <td id="{$prescription->id|attr}">
258 {$prescription->get_dosage_display()|text} &nbsp;
259 </td>
260 {if $prescription->erx_source==0}
261 <td class="editscript" id="{$prescription->id|attr}">
262 {$prescription->quantity|text} &nbsp;
263 </td>
264 {else}
265 <td id="{$prescription->id|attr}">
266 {$prescription->quantity|text} &nbsp;
267 </td>
268 {/if}
269 <td id="{$prescription->id|attr}">
270 {$prescription->get_size()|text} {$prescription->get_unit_display()|text}&nbsp;
271 </td>
272 <td id="{$prescription->id|attr}">
273 {$prescription->refills|escape:'html'} &nbsp;
274 </td>
275 <td id="{$prescription->id|attr}">
276 {$prescription->provider->get_name_display()|text}&nbsp;
277 </td>
278 {if $GLOBALS.weno_rx_enable}
279 <td class="text-center">
280 {if $prescription->ntx == 0}
281 <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="{xla t="Select to transmit"}">
282 {/if}
283 </td>
284 <td class="text-center">
285 {if $prescription->ntx == 1}
286 <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="{xla t="Select to transmit"}">
287 {/if}
288 </td>
289 <td id="{$prescription->id|attr}" class="text-center">
290 {$prescription->txDate|text}
291 </td>
292 {/if}
293 <td><a href="#" id="deleteDrug" class="btn btn-danger btn-sm btn-delete" onclick="deleteDrug({$prescription->id|attr})">{xlt t='Delete'}</a></td>
294 </tr>
295 {/foreach}
296 </tbody>
297 </table>
298 </div>
299 </form>
300 </div>
301 </div>
302 {if $GLOBALS.rx_show_drug_drug}
303 <div id="drug-drug">
304 <hr>
305 <h3>{xlt t='Drug-Drug Interaction'}</h3>
306 <p title="{xla t='Severity information will be missing if interaction is found'}"><a href="#">*{xlt t='Notice'}</a></p>
307 <div id="return_info">
308 {$INTERACTION}
309 </div>
310 <hr>
311 </div>
312 {/if}
314 {else}
315 <div class="text mt-3">{xlt t='There are currently no prescriptions'}.</div>
316 {/if}
317 </div>
318 </div>
319 </body>
320 {literal}
321 <script>
323 $(function () {
324 $("#multiprint").on("click", function() { return CheckForChecks(document.presc.check_list); });
325 $("#multiprintcss").on("click", function() { return CheckForChecks(document.presc.check_list); });
326 $("#multiprintToFax").on("click", function() { return CheckForChecks(document.presc.check_list); });
327 $(".editscript").on("click", function() { ShowScript(this); });
328 $(".onescript").on("mouseover", function() { $(this).children().toggleClass("highlight"); });
329 $(".onescript").on("mouseout", function() { $(this).children().toggleClass("highlight"); });
332 var ShowScript = function(eObj) {
333 top.restoreSession();
334 objID = eObj.id;
335 document.location.href="{/literal}{$GLOBALS.webroot}{literal}/controller.php?prescription&edit&id=" + encodeURIComponent(objID);
336 return true;
339 </script>
340 {/literal}
341 </html>