|
10 | 10 | <v-card-item><geometry-picker v-model="host.location" style="height: 100%"/></v-card-item> |
11 | 11 | <v-card-item><v-text-field label="elevation" v-model="host.elevation" type="number" hint="Elevation of station above mean sea level in meters" persistent-hint></v-text-field></v-card-item> |
12 | 12 | <v-card-item><v-text-field label="wigos_station_identifier" v-model="host.wigos_station_identifier" hint="WIGOS station identifier" persistent-hint></v-text-field></v-card-item> |
13 | | - <v-card-item><v-select :items="facilityTypeOptions" item-title="name" item-value="id" label="facility_type" v-model="host.facility_type" :hint="facilityTypeOptionsHint" return-object persistent-hint></v-select></v-card-item> |
| 13 | + <v-card-item><v-autocomplete :items="facilityTypeOptions" item-title="name" item-value="id" label="facility_type" v-model="host.facility_type" :hint="facilityTypeOptionsHint" return-object persistent-hint></v-autocomplete></v-card-item> |
14 | 14 | <v-card-item> |
15 | 15 | <v-container> |
16 | 16 | <v-row> |
17 | | - <v-col :cols="3"><VueDatePicker label="date_established" v-model="host.date_established" hint="Date host was first established" persistent-hint></VueDatePicker></v-col> |
18 | | - <v-col :cols="3"><VueDatePicker label="date_closed" v-model="host.date_closed" hint="Date host was first established" persistent-hint></VueDatePicker></v-col> |
| 17 | + <v-col :cols="4"><VueDatePicker label="date_established" v-model="host.date_established" hint="Date host was first established" persistent-hint></VueDatePicker></v-col> |
| 18 | + <v-col :cols="4"><VueDatePicker label="date_closed" v-model="host.date_closed" hint="Date host was first established" persistent-hint></VueDatePicker></v-col> |
19 | 19 | </v-row> |
20 | 20 | </v-container> |
21 | 21 | </v-card-item> |
22 | | - <v-card-item><v-select :items="wmoRegionOptions" item-title="name" item-value="id" label="wmo_region" v-model="host.wmo_region" :hint="wmoRegionOptionsHint" return-object persistent-hint></v-select></v-card-item> |
23 | | - <v-card-item><v-select :items="territoryOptions" item-title="name" item-value="id" label="territory" v-model="host.territory" :hint="territoryOptionsHint" return-object persistent-hint></v-select></v-card-item> |
24 | | - <v-card-item><v-select :items="timeZoneOptions" item-title="name" item-value="id" label="time_zone" v-model="host.time_zone" :hint="timeZoneOptionsHint" return-object persistent-hint></v-select></v-card-item> |
| 22 | + <v-card-item><v-autocomplete :items="wmoRegionOptions" item-title="name" item-value="id" label="wmo_region" v-model="host.wmo_region" :hint="wmoRegionOptionsHint" return-object persistent-hint></v-autocomplete></v-card-item> |
| 23 | + <v-card-item><v-autocomplete :items="territoryOptions" item-title="name" item-value="id" label="territory" v-model="host.territory" :hint="territoryOptionsHint" return-object persistent-hint></v-autocomplete></v-card-item> |
| 24 | + <v-card-item><v-autocomplete :items="timeZoneOptions" item-title="name" item-value="id" label="time_zone" v-model="host.time_zone" :hint="timeZoneOptionsHint" return-object persistent-hint></v-autocomplete></v-card-item> |
25 | 25 | <v-card-item> |
26 | 26 | <v-container> |
27 | 27 | <v-row> |
28 | | - <v-col :cols="3"><VueDatePicker label="valid_from" v-model="host.valid_from" hint="Date from which the details for this record are valid" persistent-hint></VueDatePicker></v-col> |
29 | | - <v-col :cols="3"><VueDatePicker label="valid_to" v-model="host.valid_to" hint="Date after which the details for this record are no longer valid" persistent-hint></VueDatePicker></v-col> |
| 28 | + <v-col :cols="4"><VueDatePicker label="valid_from" v-model="host.valid_from" hint="Date from which the details for this record are valid" persistent-hint></VueDatePicker></v-col> |
| 29 | + <v-col :cols="4"><VueDatePicker label="valid_to" v-model="host.valid_to" hint="Date after which the details for this record are no longer valid" persistent-hint></VueDatePicker></v-col> |
30 | 30 | </v-row> |
31 | 31 | </v-container> |
32 | 32 | </v-card-item> |
33 | 33 | <v-card-item><v-text-field label="_version" v-model="host._version" type="number" hint="Version number of this record (autoupdated)" persistent-hint readonly></v-text-field></v-card-item> |
34 | 34 | <v-card-item><v-text-field label="_change_date" v-model="host._change_date" hint="Date this record was changed (autoupdated)" persistent-hint readonly></v-text-field></v-card-item> |
35 | | - <v-card-item><v-select :items="userOptions" item-title="name" item-value="id" label="user" v-model="host._user" :hint="userOptionsHint" return-object persistent-hint></v-select></v-card-item> |
36 | | - <v-card-item><v-select :items="statusOptions" item-title="name" item-value="id" label="status" v-model="host._status" :hint="statusOptionsHint" return-object persistent-hint></v-select></v-card-item> |
| 35 | + <v-card-item><v-autocomplete :items="userOptions" item-title="name" item-value="id" label="user" v-model="host._user" :hint="userOptionsHint" return-object persistent-hint></v-autocomplete></v-card-item> |
| 36 | + <v-card-item><v-autocomplete :items="statusOptions" item-title="name" item-value="id" label="status" v-model="host._status" :hint="statusOptionsHint" return-object persistent-hint></v-autocomplete></v-card-item> |
37 | 37 | <v-card-item><v-text-field label="comments" v-model="host.comments" hint="Free text comments on this record, for example description of changes made etc" persistent-hint></v-text-field></v-card-item> |
38 | 38 | </v-form> |
39 | 39 | <v-btn @click="createHost">{{ route.params.id ? 'Save' : 'Create' }}</v-btn> |
|
45 | 45 | <script> |
46 | 46 | import * as d3 from 'd3'; |
47 | 47 | import { defineComponent, ref, computed, watch } from 'vue'; |
48 | | -import { VCard, VCardTitle, VCardText, VCardItem, VForm, VTextField, VSelect, VBtn } from 'vuetify/lib/components'; |
| 48 | +import { VCard, VCardTitle, VCardText, VCardItem, VForm, VTextField, VSelect, VBtn, VAutocomplete } from 'vuetify/lib/components'; |
49 | 49 | import { VContainer, VRow, VCol } from 'vuetify/lib/components'; |
50 | 50 | import { onBeforeMount, onMounted, onBeforeUpdate, onUpdated, onBeforeUnmount, onUnmounted, onErrorCaptured} from 'vue'; |
51 | 51 | import {useStore} from 'pinia'; |
@@ -89,7 +89,7 @@ export default defineComponent({ |
89 | 89 | VCardText, |
90 | 90 | VCardItem, |
91 | 91 | VTextField, |
92 | | - VSelect, |
| 92 | + VSelect, VAutocomplete, |
93 | 93 | VForm, |
94 | 94 | VBtn, |
95 | 95 | VueDatePicker, |
@@ -240,8 +240,8 @@ export default defineComponent({ |
240 | 240 | host.value._version = host.value._version + 1; |
241 | 241 | }else{ |
242 | 242 | host.value._version = 1; |
243 | | - host.value._user_id = "tag:beta.opencdms.org,2023:/data/user/default"; |
244 | | - host.value._status_id = "tag:beta.opencdms.org,2023:/vocab/status/draft"; |
| 243 | + host.value._user = useRepo(User).where('id','tag:beta.opencdms.org,2023:/data/user/default').first(); |
| 244 | + host.value._status = useRepo(Status).where('id','tag:beta.opencdms.org,2023:/vocab/status/draft').first(); |
245 | 245 | } |
246 | 246 | }); |
247 | 247 |
|
|
0 commit comments