Merge pull request #138 from dikstub-rssa/feat/fe-sep-113
Feat: Integration Vclaim Sep
This commit is contained in:
No files matched your search
@@ -16,22 +16,23 @@ const props = defineProps<{
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string]
|
||||
'update:searchText': [value: string]
|
||||
}>()
|
||||
|
||||
const open = ref(false)
|
||||
|
||||
const searchText = ref('')
|
||||
const debouncedSearchText = refDebounced(searchText, 500) // 500ms debounce
|
||||
const selectedItem = computed(() => props.items.find((item) => item.value === props.modelValue))
|
||||
|
||||
const displayText = computed(() => {
|
||||
console.log(selectedItem)
|
||||
if (selectedItem.value?.label) {
|
||||
return selectedItem.value.label
|
||||
}
|
||||
return props.placeholder || 'Pilih item'
|
||||
})
|
||||
|
||||
watch(props, () => {
|
||||
console.log(props.modelValue)
|
||||
watch(debouncedSearchText, (newValue) => {
|
||||
emit('update:searchText', newValue)
|
||||
})
|
||||
|
||||
const searchableItems = computed(() => {
|
||||
@@ -106,6 +107,11 @@ function onSelect(item: Item) {
|
||||
class="h-9 border-0 border-b border-gray-200 bg-white text-black focus:ring-0 dark:border-gray-700 dark:bg-gray-800 dark:text-white"
|
||||
:placeholder="searchPlaceholder || 'Cari...'"
|
||||
:aria-label="`Cari ${displayText}`"
|
||||
@input="
|
||||
(evt: any) => {
|
||||
searchText = evt?.target?.value || ''
|
||||
}
|
||||
"
|
||||
/>
|
||||
<CommandEmpty class="py-6 text-center text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ emptyMessage || 'Item tidak ditemukan.' }}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, type Ref } from 'vue'
|
||||
// Components
|
||||
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
|
||||
|
||||
const props = defineProps<{
|
||||
rec: { id: string; name: string; menu: string }
|
||||
selected?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
// No emits needed - using provide/inject
|
||||
}>()
|
||||
|
||||
const record = props.rec || {}
|
||||
const recId = inject('rec_select_id') as Ref<number>
|
||||
const recMenu = inject('rec_select_menu') as Ref<string>
|
||||
const selected = computed(() => recId.value === Number(record.id) ? record.id : '')
|
||||
|
||||
function handleSelection(value: string) {
|
||||
if (value === record.id) {
|
||||
recId.value = Number(record.id) || 0
|
||||
recMenu.value = record.menu || ''
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RadioGroup
|
||||
:model-value="selected"
|
||||
@update:model-value="handleSelection"
|
||||
>
|
||||
<RadioGroupItem
|
||||
:id="record.id"
|
||||
:value="record.id"
|
||||
/>
|
||||
</RadioGroup>
|
||||
</template>
|
||||
@@ -34,9 +34,18 @@ const df = new DateFormatter('en-US', {
|
||||
dateStyle: 'medium',
|
||||
})
|
||||
|
||||
// Get current date
|
||||
const today = new Date()
|
||||
const todayCalendar = new CalendarDate(today.getFullYear(), today.getMonth() + 1, today.getDate())
|
||||
|
||||
// Get date 1 month ago
|
||||
const oneMonthAgo = new Date(today)
|
||||
oneMonthAgo.setMonth(today.getMonth() - 1)
|
||||
const oneMonthAgoCalendar = new CalendarDate(oneMonthAgo.getFullYear(), oneMonthAgo.getMonth() + 1, oneMonthAgo.getDate())
|
||||
|
||||
const value = ref({
|
||||
start: new CalendarDate(2022, 1, 20),
|
||||
end: new CalendarDate(2022, 1, 20).add({ days: 20 }),
|
||||
start: oneMonthAgoCalendar,
|
||||
end: todayCalendar,
|
||||
}) as Ref<DateRange>
|
||||
|
||||
function onFilterClick() {
|
||||
|
||||
Reference in New Issue
Block a user