|
@@ -83,15 +83,16 @@ $formID = rand(0, 100000);
|
|
data-field="title" v-model="item.label" readonly>
|
|
data-field="title" v-model="item.label" readonly>
|
|
</td>
|
|
</td>
|
|
<td>
|
|
<td>
|
|
- <input type="text" :data-index="index" v-if="index === 'bmi'" :readonly="index === 'bmi'"
|
|
|
|
- class="form-control form-control-sm vitals-title"
|
|
|
|
- data-field="value" v-model="bmi">
|
|
|
|
<input type="text" :data-index="index" v-if="index !== 'bmi'"
|
|
<input type="text" :data-index="index" v-if="index !== 'bmi'"
|
|
|
|
+ class="form-control form-control-sm"
|
|
|
|
+ data-field="value" v-model="item.value"
|
|
|
|
+ v-on:change="autoDate(item, index)" v-on:keyup="autoDate(item, index)">
|
|
|
|
+ <input type="text" :data-index="index" v-if="index === 'bmi'" readonly
|
|
class="form-control form-control-sm vitals-title"
|
|
class="form-control form-control-sm vitals-title"
|
|
- data-field="value" v-model="item.value">
|
|
|
|
|
|
+ data-field="value" v-model="bmi">
|
|
</td>
|
|
</td>
|
|
<td>
|
|
<td>
|
|
- <input type="date" :data-index="index" v-if="index !== 'bmi'"
|
|
|
|
|
|
+ <input type="date" :data-index="index" :readonly="index === 'bmi'"
|
|
class="form-control form-control-sm vitals-title"
|
|
class="form-control form-control-sm vitals-title"
|
|
data-field="date" v-model="item.date">
|
|
data-field="date" v-model="item.date">
|
|
</td>
|
|
</td>
|
|
@@ -106,7 +107,9 @@ $formID = rand(0, 100000);
|
|
window.clientVitalsApp = new Vue({
|
|
window.clientVitalsApp = new Vue({
|
|
el: '#vitalsSection',
|
|
el: '#vitalsSection',
|
|
data: {
|
|
data: {
|
|
- items: <?= json_encode($contentData) ?>
|
|
|
|
|
|
+ today: '{{ date("Y-m-d") }}',
|
|
|
|
+ items: <?= json_encode($contentData) ?>,
|
|
|
|
+ itemsOriginal: <?= json_encode($contentData) ?>
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|
|
$(this.$el).closest('#vitalsSection').find('[name="data"]').val(
|
|
$(this.$el).closest('#vitalsSection').find('[name="data"]').val(
|
|
@@ -114,7 +117,7 @@ $formID = rand(0, 100000);
|
|
);
|
|
);
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- $data: {
|
|
|
|
|
|
+ items: {
|
|
handler: function(val, oldVal) {
|
|
handler: function(val, oldVal) {
|
|
$(this.$el).closest('#vitalsSection').find('[name="data"]').val(
|
|
$(this.$el).closest('#vitalsSection').find('[name="data"]').val(
|
|
JSON.stringify(this.cleanObject(this.items))
|
|
JSON.stringify(this.cleanObject(this.items))
|
|
@@ -146,6 +149,12 @@ $formID = rand(0, 100000);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ autoDate: function(_item, _index) {
|
|
|
|
+ console.log('ALIX autoDate for', _index)
|
|
|
|
+ if((_item.value !== this.itemsOriginal[_index].value) && !_item.date) {
|
|
|
|
+ _item.date = this.today;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
cleanObject: function(_source) {
|
|
cleanObject: function(_source) {
|
|
let plObject = {};
|
|
let plObject = {};
|
|
for (let y in _source) {
|
|
for (let y in _source) {
|
|
@@ -156,7 +165,7 @@ $formID = rand(0, 100000);
|
|
plObject.bmi = {
|
|
plObject.bmi = {
|
|
label: "BMI (kg/m²)",
|
|
label: "BMI (kg/m²)",
|
|
value: this.bmi,
|
|
value: this.bmi,
|
|
- date: "",
|
|
|
|
|
|
+ date: this.bmi ? this.today : '',
|
|
};
|
|
};
|
|
return plObject;
|
|
return plObject;
|
|
}
|
|
}
|