Merge branch 'dev' into feat/consultation-82

This commit is contained in:
2025-10-08 07:55:22 +07:00
287 changed files with 11633 additions and 2327 deletions

No files matched your search

+4 -1
View File
@@ -2,6 +2,7 @@ import type { DataTableLoader } from '~/components/pub/my-ui/data-table/type'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import { refDebounced, useUrlSearchParams } from '@vueuse/core'
import * as z from 'zod'
import { is } from "date-fns/locale"
// Default query schema yang bisa digunakan semua list
export const defaultQuerySchema = z.object({
@@ -75,6 +76,8 @@ export function usePaginatedList<T = any>(options: UsePaginatedListOptions<T>) {
// Functions
async function fetchData() {
if (isLoading.isTableLoading) return
isLoading.isTableLoading = true
try {
@@ -97,7 +100,6 @@ export function usePaginatedList<T = any>(options: UsePaginatedListOptions<T>) {
paginationMeta.hasPrev = paginationMeta.page > 1
}
} catch (error) {
console.error(`Error fetching ${entityName} list:`, error)
data.value = []
paginationMeta.recordCount = 0
paginationMeta.totalPage = 0
@@ -126,6 +128,7 @@ export function usePaginatedList<T = any>(options: UsePaginatedListOptions<T>) {
watch(
params,
(newParams) => {
console.log('watch ~ newParams', newParams)
// Sync search input with URL params (for back/forward navigation)
if (newParams.search !== searchInput.value) {
searchInput.value = newParams.search || ''
+25
View File
@@ -0,0 +1,25 @@
import { computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
export function useQueryMode(key: string = 'mode') {
const route = useRoute()
const router = useRouter()
const mode = computed<'list' | 'add'>({
get: () => (route.query[key] && route.query[key] === 'add' ? 'add' : 'list'),
set: (val) => {
router.replace({
path: route.path,
query: {
...route.query,
[key]: val === 'list' ? undefined : val,
},
})
},
})
const openForm = () => (mode.value = 'add')
const backToList = () => (mode.value = 'list')
return { mode, openForm, backToList }
}