|
305 | 305 | } else if (action === 'REVISE' || action === 'NEW') { |
306 | 306 | $orderForm.find('.order-orderReason').show(); |
307 | 307 | $orderForm.find('.order-orderReasonNonCoded').show(); |
308 | | - orderWidget.enableOrderDoseWidgets($orderForm); |
| 308 | + orderWidget.enableOrderDoseWidgets($orderForm, false); |
309 | 309 | $orderForm.find('.order-urgency').show(); |
310 | 310 | orderWidget.enableOrderDurationWidgets($orderForm); |
311 | 311 | orderWidget.enableServiceOrderWidgets($orderForm); |
|
314 | 314 | // Set up ability to toggle between free-text and simple dosing instructions |
315 | 315 | $orderForm.find('.order-dosingType').find('input:radio').change(function () { |
316 | 316 | if (action === 'REVISE' || action === 'NEW') { |
317 | | - orderWidget.enableOrderDoseWidgets($orderForm); |
| 317 | + orderWidget.enableOrderDoseWidgets($orderForm, true); |
318 | 318 | } |
319 | 319 | }); |
320 | 320 |
|
|
489 | 489 | } |
490 | 490 | }; |
491 | 491 |
|
492 | | - orderWidget.enableOrderDoseWidgets = function($orderForm) { |
| 492 | + orderWidget.enableOrderDoseWidgets = function($orderForm, clearExistingValues) { |
493 | 493 | var $dosingTypeSection = $orderForm.find('.order-dosingType'); |
494 | 494 | var dosingTypeVal = $dosingTypeSection.find('input:checked').val(); |
495 | 495 |
|
496 | | - $orderForm.find('.order-field-widget.order-dose').find(':input').val(""); |
497 | | - $orderForm.find('.order-field-widget.order-doseUnits').find(':input').val(""); |
498 | | - $orderForm.find('.order-field-widget.order-frequency').find(':input').val(""); |
499 | | - $orderForm.find('.order-field-widget.order-route').find(':input').val(""); |
500 | | - $orderForm.find('.order-field-widget.order-asNeeded').find(':input').removeAttr("checked"); |
501 | | - $orderForm.find('.order-field-widget.order-instructions').find(':input').val(""); |
502 | | - $orderForm.find('.order-field-widget.order-dosingInstructions').find(':input').val(""); |
| 496 | + if (clearExistingValues) { |
| 497 | + $orderForm.find('.order-field-widget.order-dose').find(':input').val(""); |
| 498 | + $orderForm.find('.order-field-widget.order-doseUnits').find(':input').val(""); |
| 499 | + $orderForm.find('.order-field-widget.order-frequency').find(':input').val(""); |
| 500 | + $orderForm.find('.order-field-widget.order-route').find(':input').val(""); |
| 501 | + $orderForm.find('.order-field-widget.order-asNeeded').find(':input').removeAttr("checked"); |
| 502 | + $orderForm.find('.order-field-widget.order-instructions').find(':input').val(""); |
| 503 | + $orderForm.find('.order-field-widget.order-dosingInstructions').find(':input').val(""); |
| 504 | + } |
503 | 505 |
|
504 | 506 | if (dosingTypeVal === 'org.openmrs.FreeTextDosingInstructions') { |
505 | 507 | $orderForm.find('.order-dose').hide(); |
|
0 commit comments