|
9 | 9 | <SecondaryButton @click="modal = !modal">Modal Dialog</SecondaryButton>
|
10 | 10 | </div>
|
11 | 11 |
|
| 12 | + <div class="mt-8 mx-auto max-w-4xl flex flex-col gap-y-4"> |
| 13 | + <h3>date</h3> |
| 14 | + <div class="grid grid-cols-6 gap-6"> |
| 15 | + <TextInput class="col-span-2" type="date" id="isoDate7Z" v-model="dates.isoDate7Z" :label="dates.isoDate7Z" required /> |
| 16 | + <TextInput class="col-span-2" type="date" id="isoDate3Z" v-model="dates.isoDate3Z" :label="dates.isoDate3Z" required /> |
| 17 | + <TextInput class="col-span-2" type="date" id="isoDateZ" v-model="dates.isoDateZ" :label="dates.isoDateZ" required /> |
| 18 | + <TextInput class="col-span-2" type="date" id="isoDate" v-model="dates.isoDate" :label="dates.isoDate" required /> |
| 19 | + <TextInput class="col-span-2" type="date" id="isoDateOnly" v-model="dates.isoDateOnly" :label="dates.isoDateOnly" required /> |
| 20 | + </div> |
| 21 | + |
| 22 | + <h3>datetime-local</h3> |
| 23 | + <div class="grid grid-cols-6 gap-6"> |
| 24 | + <TextInput class="col-span-2" type="datetime-local" id="isoDate7Z" v-model="dates.isoDate7Z" :label="dates.isoDate7Z" required /> |
| 25 | + <TextInput class="col-span-2" type="datetime-local" id="isoDate3Z" v-model="dates.isoDate3Z" :label="dates.isoDate3Z" required /> |
| 26 | + <TextInput class="col-span-2" type="datetime-local" id="isoDateZ" v-model="dates.isoDateZ" :label="dates.isoDateZ" required /> |
| 27 | + <TextInput class="col-span-2" type="datetime-local" id="isoDate" v-model="dates.isoDate" :label="dates.isoDate" required /> |
| 28 | + <TextInput class="col-span-2" type="datetime-local" id="isoDateOnly" v-model="dates.isoDateOnly" :label="dates.isoDateOnly" required /> |
| 29 | + </div> |
| 30 | + |
| 31 | + <h3>Dynamic DateTimes</h3> |
| 32 | + <div class="grid grid-cols-6 gap-6"> |
| 33 | + <div v-for="f in dynamicDateTimes" class="col-span-2"> |
| 34 | + <DynamicInput :input="f" :modelValue="modelDateTimes" @update:modelValue="modelDateTimes=$event" :api="api" /> |
| 35 | + <div>{{ modelDateTimes[f.id] }}</div> |
| 36 | + </div> |
| 37 | + </div> |
| 38 | + <div> |
| 39 | + <pre>{{ modelDateTimes }}</pre> |
| 40 | + </div> |
| 41 | + |
| 42 | + <h3>Dynamic Dates</h3> |
| 43 | + <div class="grid grid-cols-6 gap-6"> |
| 44 | + <div v-for="f in dynamicDates" class="col-span-2"> |
| 45 | + <DynamicInput :input="f" :modelValue="modelDates" @update:modelValue="modelDates=$event" :api="api" /> |
| 46 | + <div>{{ modelDates[f.id] }}</div> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + <div> |
| 50 | + <pre>{{ modelDates }}</pre> |
| 51 | + </div> |
| 52 | + </div> |
| 53 | + |
12 | 54 | <div class="mt-8">
|
13 | 55 |
|
14 | 56 | <form v-if="show" class="mx-auto max-w-4xl" @submit.prevent="onSubmit">
|
|
111 | 153 | </template>
|
112 | 154 | </AutoQueryGrid>
|
113 | 155 |
|
114 |
| - <AutoQueryGrid class="mb-3" type="Customer" /> |
115 |
| - |
116 | 156 | <AutoQueryGrid class="mb-3" apis="QueryBookings,CreateBooking,UpdateBooking" />
|
117 | 157 |
|
118 | 158 | <AutoQueryGrid class="mb-3" type="Booking" selected-columns="id,name,roomType,roomNumber,cost,bookingStartDate" />
|
|
649 | 689 | </template>
|
650 | 690 |
|
651 | 691 | <script setup lang="ts">
|
652 |
| -import type { ApiResponse } from '../types' |
| 692 | +import type { ApiResponse, InputInfo } from '../types' |
653 | 693 | import { inject, onMounted, ref } from 'vue'
|
654 | 694 | import { lastRightPart, JsonServiceClient } from '@servicestack/client'
|
655 | 695 | import { useConfig, useMetadata, useFiles, useUtils, useFormatters, useAuth } from '../'
|
@@ -713,6 +753,38 @@ setAutoQueryGridDefaults({
|
713 | 753 | // showCopyApiUrl: false,
|
714 | 754 | })
|
715 | 755 |
|
| 756 | +const dates = { |
| 757 | + isoDate7Z: "2024-03-16T12:11:03.8071595Z", |
| 758 | + isoDate3Z: "2024-03-16T12:11:03.807Z", |
| 759 | + isoDateZ: "2024-03-16T12:11:03Z", |
| 760 | + isoDate: "2024-03-16T12:11:03", |
| 761 | + isoDateOnly: "2024-03-16", |
| 762 | +} |
| 763 | +
|
| 764 | +const api:{error?:any} = {} |
| 765 | +
|
| 766 | +let modelDateTimes = ref<{[k:string]:string}>({}) |
| 767 | +const dynamicDateTimes:{[k:string]:InputInfo} = Object.keys(dates).reduce((acc,x) => { |
| 768 | + acc[x] = { |
| 769 | + id:x, |
| 770 | + type:'datetime-local', |
| 771 | + label: dates[x], |
| 772 | + value: dates[x] |
| 773 | + } |
| 774 | + modelDateTimes.value[x] = dates[x] |
| 775 | + return acc }, {}) |
| 776 | +
|
| 777 | +let modelDates = ref<{[k:string]:string}>({}) |
| 778 | +const dynamicDates:{[k:string]:InputInfo} = Object.keys(dates).reduce((acc,x) => { |
| 779 | + acc[x] = { |
| 780 | + id:x, |
| 781 | + type:'date', |
| 782 | + label: dates[x], |
| 783 | + value: dates[x] |
| 784 | + } |
| 785 | + modelDates.value[x] = dates[x] |
| 786 | + return acc }, {}) |
| 787 | +
|
716 | 788 | const client = inject<JsonServiceClient>('client')!
|
717 | 789 |
|
718 | 790 | authenticate()
|
|
0 commit comments