|
@@ -253,13 +253,34 @@ parentSegment.find('.frm-edit-{{$label}}')
|
|
|
}
|
|
|
|
|
|
@if($patient->core_note_id !== $note->id)
|
|
|
- // store plan content
|
|
|
- let planContent = parsed && parsed.planValue ? parsed.planValue : '';
|
|
|
let reviewContent = parsed && parsed.reviewValue ? parsed.reviewValue : '';
|
|
|
- // if(!$.trim($('<div/>').html(planContent).text())) {
|
|
|
- // toastr.error('Directions cannot be empty');
|
|
|
- // return false;
|
|
|
- // }
|
|
|
+
|
|
|
+ let compareWith = false;
|
|
|
+ if(form.find('.disallow-if-review-same-as')) {
|
|
|
+ compareWith = $.trim(form.find('.disallow-if-review-same-as').text());
|
|
|
+ if(compareWith && reviewContent) {
|
|
|
+ let newValue = $('<div/>').html(reviewContent).text().replace(/[^a-zA-Z0-9]/g, '');
|
|
|
+ if(newValue === compareWith) {
|
|
|
+ alert('New review should be different from the previous review!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let planContent = parsed && parsed.planValue ? parsed.planValue : '';
|
|
|
+
|
|
|
+ compareWith = false;
|
|
|
+ if(form.find('.disallow-if-plan-same-as')) {
|
|
|
+ compareWith = $.trim(form.find('.disallow-if-plan-same-as').text());
|
|
|
+ if(compareWith && planContent) {
|
|
|
+ let newValue = $('<div/>').html(planContent).text().replace(/[^a-zA-Z0-9]/g, '');
|
|
|
+ if(newValue === compareWith) {
|
|
|
+ alert('New plan should be different from the previous plan!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(parsed.planValue) delete parsed.planValue;
|
|
|
if(parsed.reviewValue) delete parsed.reviewValue;
|
|
|
@endif
|