Remote state

This commit is contained in:
2022-10-01 07:05:12 -04:00
parent 976a96e5e0
commit 24da5347f4
5 changed files with 57 additions and 48 deletions

View File

@@ -10,14 +10,13 @@
<td v-if="production"><router-link :to="'/patient/$' + row.HRN">{{row.Name}} <span :title="row.HRN">{{row.HRN.slice(-4)}}</span></router-link></td>
<td v-else><router-link :title="strtr_unscramble(row.Name)" :to="'/patient/$' + row.Name.charAt(0) + row.HRN.slice(-4) + '?name=' + row.Name">{{row.Name}} ${{row.HRN}}</router-link></td>
<td>{{row.NOTE}} [{{row.APPT_MADE_BY}} on {{row.DATE_APPT_MADE}}]</td>
<td><Autocomplete :value="practitioner[row.Name]" @update:value="x => set_practitioner(row.Name, x)" :items="practitioner_list" /></td>
<td><Autocomplete :value="practitioner[row.Name]" @update:value="x => practitioner[row.Name] = x" :items="practitioner_list" /></td>
</tr>
</tbody>
</table>
</template>
<script>
import { state } from './vistax.mjs';
import { uniq, strtr_unscramble, strHashHSL, strfdate_vista, debounce } from './util.mjs';
import Autocomplete from './Autocomplete.vue';
@@ -38,7 +37,6 @@
data() {
return {
appointments: [],
practitioner: {},
production: true
};
},
@@ -46,6 +44,9 @@
params() {
return { selection: this.selection, date_begin: this.date_begin, date_end: this.date_end };
},
practitioner() {
return this.client.remotestate.practitioner || (this.client.remotestate.practitioner = {});
},
practitioner_list() {
return this.practitioner ? uniq(Object.values(this.practitioner)).sort() : [];
}
@@ -57,18 +58,12 @@
},
methods: {
strHashHSL,
strtr_unscramble,
set_practitioner(patient, practitioner) {
this.practitioner[patient] = practitioner;
state.practitioner = this.practitioner;
}
strtr_unscramble
},
created() {
this.debounced_params = debounce(async function(value) { this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', strfdate_vista(value.date_begin), strfdate_vista(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : []; }, 500);
},
async mounted() {
var practitioner = state.practitioner;
if(practitioner) this.practitioner = practitioner;
this.production = (await this.client.serverinfo()).result.production == '1';
}
};