|
@@ -16,8 +16,8 @@ $point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'SLEEP_STUDY_INTAK
|
|
|
|
|
|
// replace content data
|
|
|
$contentData = [
|
|
|
- "cheif_complaint" => "",
|
|
|
- "Dozing" => ""
|
|
|
+ "Dozing" => "",
|
|
|
+ "Score" => 0
|
|
|
];
|
|
|
|
|
|
if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
@@ -39,7 +39,6 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
|
<input type="hidden" name="noteUid" value="<?= $note->uid ?>">
|
|
|
<input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
|
|
|
<input type="hidden" name="data" value="{{json_encode($contentData)}}">
|
|
|
- <input type="hidden" name="mainData" value="{{json_encode($contentData)}}">
|
|
|
|
|
|
<div id="edit-sleep_study_intake-container" class="customized-form">
|
|
|
|
|
@@ -77,19 +76,19 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
|
defaultDropdownOptions: {
|
|
|
Dozing: [{
|
|
|
label: 'Never Chance of Doze',
|
|
|
- value: 0
|
|
|
+ value: 'Never Chance of Doze'
|
|
|
},
|
|
|
{
|
|
|
label: 'Slight Chance of Dozing',
|
|
|
- value: 1
|
|
|
+ value: 'Slight Chance of Dozing'
|
|
|
},
|
|
|
{
|
|
|
label: 'Moderate Chance of Dozing',
|
|
|
- value: 2
|
|
|
+ value: 'Moderate Chance of Dozing'
|
|
|
},
|
|
|
{
|
|
|
label: 'High Chance of Dozing',
|
|
|
- value: 3
|
|
|
+ value: 'High Chance of Dozing'
|
|
|
},
|
|
|
],
|
|
|
Sitting: [{
|
|
@@ -241,23 +240,11 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
|
methods: {
|
|
|
autoSaveForm: function(){
|
|
|
var self = this;
|
|
|
- var url = self.form.attr('url');
|
|
|
- var data = self.data;
|
|
|
- var dataInput = self.form.find('[name="mainData"]');
|
|
|
- dataInput.val(JSON.stringify(data));
|
|
|
- var dataArray = self.form.serializeArray();
|
|
|
- var newDataArray = [];
|
|
|
- for(var i = 0; i < dataArray.length; i++){
|
|
|
- var field = dataArray[i];
|
|
|
- console.log({field});
|
|
|
- if(field.name !== 'data'){
|
|
|
- console.log({name: field.name});
|
|
|
- newDataArray.push(field);
|
|
|
- }
|
|
|
- }
|
|
|
- dataArray.push({name: 'data', value: dataInput.val()});
|
|
|
- console.log({data, dataArray});
|
|
|
- // $.post(url, dataArray, function(response) {}, 'json');
|
|
|
+ var url = self.form.attr('url');
|
|
|
+ self.form.find('input[name=data]').val(JSON.stringify(self.data));
|
|
|
+ // autosave on change
|
|
|
+ var dataArray = self.form.serializeArray();
|
|
|
+ $.post(url, dataArray, function(response) {}, 'json');
|
|
|
},
|
|
|
_autoSaveForm: function(){
|
|
|
let parent = $('#edit-sleep_study_intake-container').closest('form');
|
|
@@ -267,9 +254,10 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
|
autoSaveSegment(parent.find('[submit]').first());
|
|
|
},
|
|
|
saveForm: function() {
|
|
|
- let parent = $('#edit-sleep_study_intake-container').closest('form');
|
|
|
- parent.find('[name="data"]').val(JSON.stringify(this.data));
|
|
|
- autoSaveSegmentAndClose(parent.find('[submit]').first());
|
|
|
+ this.autoSaveForm();
|
|
|
+ closeStagPopup();
|
|
|
+ refreshSegment('omega_subjective_system');
|
|
|
+ refreshSegment('omega_plan_system');
|
|
|
},
|
|
|
undoChanges: function() {
|
|
|
$.post('/api/visitPoint/destroyCurrentChildReview', {
|
|
@@ -290,9 +278,11 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
|
$.each(fields, function(i, field) {
|
|
|
var value = parseInt($(field).val());
|
|
|
value = isNaN(value) ? 0 : value;
|
|
|
+ console.log({value});
|
|
|
score = score + value;
|
|
|
});
|
|
|
self.data.Score = score;
|
|
|
+ self.$forceUpdate();
|
|
|
self.autoSaveForm();
|
|
|
},
|
|
|
initOnSelectChange: function() {
|
|
@@ -308,7 +298,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
|
|
|
this.$forceUpdate();
|
|
|
}
|
|
|
this.initOnSelectChange();
|
|
|
- console.log('DATA: ', this.data);
|
|
|
+ console.log('1: DATA: ', this.data);
|
|
|
}
|
|
|
});
|
|
|
|