|
@@ -52,7 +52,8 @@ $formID = rand(0, 100000);
|
|
|
<thead>
|
|
|
<tr class="bg-light">
|
|
|
<th class="px-2 text-secondary border-bottom-0 width-30px text-center">#</th>
|
|
|
- <th class="px-2 text-secondary border-bottom-0 w-35">
|
|
|
+ <th class="px-2 text-secondary border-bottom-0 width-30px text-center">Active</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0 w-25">
|
|
|
<div class="d-flex align-items-center font-weight-normal">
|
|
|
<span>Title</span>
|
|
|
<div class="hide-if-dashboard ml-auto">
|
|
@@ -82,14 +83,20 @@ $formID = rand(0, 100000);
|
|
|
</div>
|
|
|
</div>
|
|
|
</th>
|
|
|
- <th class="px-2 text-secondary border-bottom-0">Strength/Form/Freq.</th>
|
|
|
- <th class="px-2 text-secondary border-bottom-0 w-35">Detail</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0 width-150px">Strength/Form/Freq.</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0 w-25">Detail</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Notes</th>
|
|
|
<th class="px-2 text-secondary border-bottom-0"></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
<tr v-for="(item, index) in items">
|
|
|
<td class="px-2 pt-2 text-center text-sm font-weight-bold">@{{ index + 1 }}</td>
|
|
|
+ <td>
|
|
|
+ <label class="d-block text-center py-2">
|
|
|
+ <input type="checkbox" v-model="item.is_currently_active">
|
|
|
+ </label>
|
|
|
+ </td>
|
|
|
<td>
|
|
|
<input type="text" :data-index="index"
|
|
|
class="form-control form-control-sm canvas-rx-title"
|
|
@@ -112,6 +119,9 @@ $formID = rand(0, 100000);
|
|
|
rx-rte :data-index="index" data-field="detail"
|
|
|
v-model="item.detail"></textarea>
|
|
|
</td>
|
|
|
+ <td>
|
|
|
+ <textarea class="form-control form-control-sm" v-model="item.notes[item.notes.length-1].text"></textarea>
|
|
|
+ </td>
|
|
|
<td class="px-2 text-nowrap">
|
|
|
<a href="#"
|
|
|
v-if="!isFavorite(item)" v-on:click.prevent="addToFavorites(item)"
|
|
@@ -147,11 +157,24 @@ $formID = rand(0, 100000);
|
|
|
for (let i = 0; i < favorites.length; i++) {
|
|
|
favorites[i].data = JSON.parse(favorites[i].data);
|
|
|
}
|
|
|
+ let dbItems = <?= json_encode($contentData['items']) ?>;
|
|
|
+ for (let i = 0; i < dbItems.length; i++) {
|
|
|
+ if(typeof dbItems[i].is_currently_active === 'undefined') {
|
|
|
+ dbItems[i].is_currently_active = true;
|
|
|
+ }
|
|
|
+ if(typeof dbItems[i].notes === 'undefined') {
|
|
|
+ dbItems[i].notes = [];
|
|
|
+ }
|
|
|
+ dbItems[i].notes.push({
|
|
|
+ date: '{{@$note ? $note->effective_dateest : date('Y-m-d')}}',
|
|
|
+ text: '',
|
|
|
+ });
|
|
|
+ }
|
|
|
function init() {
|
|
|
window.clientRXApp_{{$formID}} = new Vue({
|
|
|
el: '#rxSection_{{$formID}}',
|
|
|
data: {
|
|
|
- items: <?= json_encode($contentData['items']) ?>,
|
|
|
+ items: dbItems,
|
|
|
favorites: favorites,
|
|
|
},
|
|
|
mounted: function() {
|
|
@@ -163,8 +186,14 @@ $formID = rand(0, 100000);
|
|
|
watch: {
|
|
|
$data: {
|
|
|
handler: function(val, oldVal) {
|
|
|
+ let payload = JSON.parse(JSON.stringify(this.cleanArray(this.items)));
|
|
|
+ for (let i = 0; i < payload.length; i++) {
|
|
|
+ payload[i].notes = payload[i].notes.filter(_x => {
|
|
|
+ return !!_x.text;
|
|
|
+ })
|
|
|
+ }
|
|
|
$(this.$el).closest('#rxSection_{{$formID}}').find('[name="data"]').val(JSON.stringify({
|
|
|
- items: this.cleanArray(this.items)
|
|
|
+ items: payload
|
|
|
}));
|
|
|
},
|
|
|
deep: true
|
|
@@ -178,6 +207,7 @@ $formID = rand(0, 100000);
|
|
|
strength: '',
|
|
|
frequency: '',
|
|
|
detail: '',
|
|
|
+ is_currently_active: true,
|
|
|
});
|
|
|
Vue.nextTick(function() {
|
|
|
self.initRTE();
|