From 19c4f02f8dfdb9564b746c9b591d34da6a0f5d28 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 1 Apr 2020 10:25:20 +0100 Subject: [PATCH] Added basic wizard content --- .../static/src/components/VueWebComponent.vue | 131 +++++++++++++++--- 1 file changed, 108 insertions(+), 23 deletions(-) diff --git a/openflexure_microscope/api/extra_extensions/medscan/static/src/components/VueWebComponent.vue b/openflexure_microscope/api/extra_extensions/medscan/static/src/components/VueWebComponent.vue index 6cc87fd4..7fdbb454 100644 --- a/openflexure_microscope/api/extra_extensions/medscan/static/src/components/VueWebComponent.vue +++ b/openflexure_microscope/api/extra_extensions/medscan/static/src/components/VueWebComponent.vue @@ -3,25 +3,55 @@

Sample Scan Wizard

Base URL: {{ componentBaseURL }}

Host microscope name: {{ hostDeviceName }}

-

{{ message }}

-
-

This cheeky little counter has all of its logic contained in a server-side component:

- - {{ value }} -
-
- - -
- - -
- - + +
+

User information

+ + + +
+ + +
+ +
+

Patient information

+ + + +
+
+ +
+

Sample information

+ + +
+ + +
+ + +
+
+ +
+

Start scan

+(Confirm information) + (Confirm scan parameters, just a radio box for selecting defaults) +

{{this.payload}}

(Start button) +
+ +
+

{{ message }}

+ + + +
@@ -39,10 +69,13 @@ export default { data: function() { return { - value: 0, - message: "", + stepValue: 0, hostDeviceName: null, - currentTime: this.getLocalDatetimeString() + message: null, + username: "", + currentTime: this.getLocalDatetimeString(), + patientID: "", + sampleType: "thin" }; }, @@ -66,11 +99,37 @@ export default { methods: { decrement: function() { - this.value = this.value - 1; + if (this.stepValue > 0) { + this.stepValue = this.stepValue - 1; + } }, increment: function() { - this.value = this.value + 1; + // Validate sections + if (this.stepValue == 0) { + if (!this.username) { + this.message = "Please enter your name"; + return false; + } + } + if (this.stepValue == 1) { + if (!this.patientID) { + this.message = "Please enter a patient ID"; + return false; + } + } + // Upper bound on section number + if (this.stepValue < 3) { + this.stepValue = this.stepValue + 1; + this.message = ""; + return true; + } + }, + + restart: function() { + this.stepValue = 0; + this.patientID = ""; + this.currentTime = this.getLocalDatetimeString(); }, getLocalDatetimeString: function() { @@ -108,7 +167,7 @@ export default { return this.currentTime.substr(0, 19); }, set(val) { - console.log(val) + console.log(val); // Get timezone var dt = new Date(); var tzo = -dt.getTimezoneOffset(), @@ -118,8 +177,25 @@ export default { return (norm < 10 ? "0" : "") + norm; }; // Stick to the end of the new timestring from the form - this.currentTime = - val + dif + pad(tzo / 60) + ":" + pad(tzo % 60); + this.currentTime = val + dif + pad(tzo / 60) + ":" + pad(tzo % 60); + } + }, + + payload: { + get() { + return { + filename: `${this.patientID}_${this.sampleType}`, + temporary: false, + grid: [20, 20, 5], + fast_autofocus: true, + use_video_port: false, + annotations: { + patientID: this.patientID, + username: this.username, + clientDatetime: this.currentTime + }, + tags: ["medscan"] + }; } } } @@ -130,4 +206,13 @@ export default { .medscan-component-class { text-align: left; } + +input { + display: block +} + +button { + margin: 0 10px 0 0; + min-width: 100px; +} \ No newline at end of file