|
@@ -131,13 +131,35 @@
|
|
dataField.val(JSON.stringify(parsed));
|
|
dataField.val(JSON.stringify(parsed));
|
|
}
|
|
}
|
|
|
|
|
|
- if(!_silent) showMask();
|
|
|
|
-
|
|
|
|
let closeOnSave = false, noteSection = form.closest('.note-section');
|
|
let closeOnSave = false, noteSection = form.closest('.note-section');
|
|
if($(_trigger).closest('[visit-moe]').is('[close-on-save]')) {
|
|
if($(_trigger).closest('[visit-moe]').is('[close-on-save]')) {
|
|
closeOnSave = true;
|
|
closeOnSave = true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // disallow-if-value-same-as
|
|
|
|
+ let compareWith = false;
|
|
|
|
+ if(form.find('.disallow-if-value-same-as')) {
|
|
|
|
+ compareWith = $.trim(form.find('.disallow-if-value-same-as').text());
|
|
|
|
+ if(compareWith && parsed) {
|
|
|
|
+ if(!parsed.value) {
|
|
|
|
+ alert('Plan cannot be empty!');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ let newValue = $('<div/>').html(parsed.value).text().replace(/[^a-zA-Z0-9]/g, '');
|
|
|
|
+ alert(newValue);
|
|
|
|
+ if(newValue === '') {
|
|
|
|
+ alert('Plan cannot be empty!');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if(newValue === compareWith) {
|
|
|
|
+ alert('New plan should be different from the previous plan!');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!_silent) showMask();
|
|
|
|
+
|
|
$.post(form.attr('url'), form.serialize(), _data => {
|
|
$.post(form.attr('url'), form.serialize(), _data => {
|
|
if(!hasResponseError(_data)) {
|
|
if(!hasResponseError(_data)) {
|
|
if(!_silent) {
|
|
if(!_silent) {
|