feat(ui): add back navigation button to detail pages
- Implement reusable back button component - Add back button to division and installation detail pages - Improve navigation logic with additional state cleanup
This commit is contained in:
No files matched your search
@@ -32,4 +32,14 @@ function handlePageChange(page: number) {
|
|||||||
:skeleton-size="paginationMeta?.pageSize"
|
:skeleton-size="paginationMeta?.pageSize"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="my-2 flex justify-end border-t-slate-300 py-2">
|
||||||
|
<PubMyUiNavFooterBa
|
||||||
|
@click="
|
||||||
|
navigateTo({
|
||||||
|
name: 'org-src-division',
|
||||||
|
})
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -32,4 +32,14 @@ function handlePageChange(page: number) {
|
|||||||
:skeleton-size="paginationMeta?.pageSize"
|
:skeleton-size="paginationMeta?.pageSize"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="my-2 flex justify-end border-t-slate-300 py-2">
|
||||||
|
<PubMyUiNavFooterBa
|
||||||
|
@click="
|
||||||
|
navigateTo({
|
||||||
|
name: 'org-src-installation',
|
||||||
|
})
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -78,6 +78,7 @@ const headerPrep: HeaderPrep = {
|
|||||||
label: 'Tambah',
|
label: 'Tambah',
|
||||||
icon: 'i-lucide-plus',
|
icon: 'i-lucide-plus',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
|
recAction.value = ''
|
||||||
recItem.value = null
|
recItem.value = null
|
||||||
recId.value = 0
|
recId.value = 0
|
||||||
isFormEntryDialogOpen.value = true
|
isFormEntryDialogOpen.value = true
|
||||||
@@ -104,12 +105,22 @@ const getCurrentDivisionDetail = async (id: number | string) => {
|
|||||||
watch([recId, recAction], () => {
|
watch([recId, recAction], () => {
|
||||||
switch (recAction.value) {
|
switch (recAction.value) {
|
||||||
case ActionEvents.showDetail:
|
case ActionEvents.showDetail:
|
||||||
navigateTo({
|
if (Number(recId.value) > 0) {
|
||||||
name: 'org-src-division-id',
|
const id = Number(recId.value)
|
||||||
params: {
|
|
||||||
id: Number(recId.value),
|
recAction.value = ''
|
||||||
},
|
recItem.value = null
|
||||||
})
|
recId.value = 0
|
||||||
|
isFormEntryDialogOpen.value = false
|
||||||
|
isReadonly.value = false
|
||||||
|
|
||||||
|
navigateTo({
|
||||||
|
name: 'org-src-division-id',
|
||||||
|
params: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case ActionEvents.showEdit:
|
case ActionEvents.showEdit:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
|||||||
import type { Installation } from '~/models/installation'
|
import type { Installation } from '~/models/installation'
|
||||||
import { getDetail as getDetailInstallation } from '~/services/installation.service'
|
import { getDetail as getDetailInstallation } from '~/services/installation.service'
|
||||||
|
|
||||||
// #region division positions
|
// #region installtaion positions
|
||||||
import { config } from '~/components/app/installation/detail/list.cfg'
|
import { config } from '~/components/app/installation/detail/list.cfg'
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
@@ -174,7 +174,7 @@ watch([recId, recAction], () => {
|
|||||||
<AppInstallationDetail :installation="installation" />
|
<AppInstallationDetail :installation="installation" />
|
||||||
<div class="h-6"></div>
|
<div class="h-6"></div>
|
||||||
|
|
||||||
<LazyAppInstallationDetailList
|
<AppInstallationDetailList
|
||||||
:data="dataMap"
|
:data="dataMap"
|
||||||
:pagination-meta="paginationMeta"
|
:pagination-meta="paginationMeta"
|
||||||
@page-change="handlePageChange"
|
@page-change="handlePageChange"
|
||||||
|
|||||||
@@ -102,12 +102,22 @@ const getCurrentInstallationDetail = async (id: number | string) => {
|
|||||||
watch([recId, recAction], () => {
|
watch([recId, recAction], () => {
|
||||||
switch (recAction.value) {
|
switch (recAction.value) {
|
||||||
case ActionEvents.showDetail:
|
case ActionEvents.showDetail:
|
||||||
navigateTo({
|
if (Number(recId.value) > 0) {
|
||||||
name: 'org-src-installation-id',
|
const id = Number(recId.value)
|
||||||
params: {
|
|
||||||
id: recId.value,
|
recAction.value = ''
|
||||||
},
|
recItem.value = null
|
||||||
})
|
recId.value = 0
|
||||||
|
isFormEntryDialogOpen.value = false
|
||||||
|
isReadonly.value = false
|
||||||
|
|
||||||
|
navigateTo({
|
||||||
|
name: 'org-src-installation-id',
|
||||||
|
params: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case ActionEvents.showEdit:
|
case ActionEvents.showEdit:
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'click'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function onClick() {
|
||||||
|
emit('click')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="m-2 flex gap-2 px-2">
|
||||||
|
<Button
|
||||||
|
class="bg-gray-400"
|
||||||
|
type="button"
|
||||||
|
@click="onClick"
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
name="i-lucide-arrow-left"
|
||||||
|
class="me-2 align-middle"
|
||||||
|
/>
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user