fix: added created/modified time stamp

also added scroll to details and activities section
This commit is contained in:
Shariq Ansari 2023-08-02 18:05:44 +05:30
parent f49f6d7b84
commit 4580d3ca9b
2 changed files with 142 additions and 112 deletions

View File

@ -67,11 +67,18 @@
:style="{ left: `${indicatorLeftValue}px` }" :style="{ left: `${indicatorLeftValue}px` }"
/> />
</TabList> </TabList>
<TabPanels class="flex h-full"> <TabPanels class="flex h-full overflow-hidden">
<TabPanel class="flex-1" v-for="tab in tabs" :key="tab.label"> <TabPanel
class="flex-1 overflow-y-auto"
v-for="tab in tabs"
:key="tab.label"
>
<Activities :activities="tab.content" /> <Activities :activities="tab.content" />
</TabPanel> </TabPanel>
<div class="flex flex-col gap-6.5 border-l p-3 w-[390px]"> <div
class="flex flex-col justify-between border-l w-[390px] overflow-hidden"
>
<div class="flex flex-col gap-6.5 p-3 overflow-y-auto">
<div <div
v-for="section in detailSections" v-for="section in detailSections"
:key="section.label" :key="section.label"
@ -185,6 +192,18 @@
</Toggler> </Toggler>
</div> </div>
</div> </div>
<div class="text-sm px-6 p-3 leading-5 cursor-pointer">
<span class="text-gray-600">Created </span>
<span :title="dateFormat(lead.doc.creation)">
{{ timeAgo(lead.doc.creation) }}
</span>
<span>&nbsp;&middot;&nbsp;</span>
<span class="text-gray-600">Updated </span>
<span :title="dateFormat(lead.doc.modified)">
{{ timeAgo(lead.doc.modified) }}
</span>
</div>
</div>
</TabPanels> </TabPanels>
</TabGroup> </TabGroup>
</template> </template>
@ -209,6 +228,7 @@ import {
} from 'frappe-ui' } from 'frappe-ui'
import { TransitionPresets, useTransition } from '@vueuse/core' import { TransitionPresets, useTransition } from '@vueuse/core'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { dateFormat, timeAgo } from '@/utils'
import { ref, computed, h } from 'vue' import { ref, computed, h } from 'vue'
import Breadcrumbs from '@/components/Breadcrumbs.vue' import Breadcrumbs from '@/components/Breadcrumbs.vue'

10
frontend/src/utils.js Normal file
View File

@ -0,0 +1,10 @@
import { useDateFormat, useTimeAgo } from '@vueuse/core'
export function dateFormat(date, format) {
const _format = format || 'DD-MM-YYYY HH:mm:ss'
return useDateFormat(date, _format).value
}
export function timeAgo(date) {
return useTimeAgo(date).value
}