feat: new web page table
This commit is contained in:
@@ -16,6 +16,18 @@
|
|||||||
class="mx-2 my-0.5"
|
class="mx-2 my-0.5"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mt-4 mx-2 pt-1 border-t border-gray-200">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<span class="text-sm font-medium text-gray-600">
|
||||||
|
{{ __('Web Pages') }}
|
||||||
|
</span>
|
||||||
|
<Button variant="ghost" @click="openPageModal()">
|
||||||
|
<template #icon>
|
||||||
|
<Plus class="h-4 w-4 text-gray-700 stroke-1.5" />
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
:link="{
|
:link="{
|
||||||
@@ -44,29 +56,25 @@ import SidebarLink from '@/components/SidebarLink.vue'
|
|||||||
import { useStorage } from '@vueuse/core'
|
import { useStorage } from '@vueuse/core'
|
||||||
import { ref, onMounted, inject } from 'vue'
|
import { ref, onMounted, inject } from 'vue'
|
||||||
import { getSidebarLinks } from '../utils'
|
import { getSidebarLinks } from '../utils'
|
||||||
import { sessionStore } from '@/stores/session'
|
import { usersStore } from '@/stores/user'
|
||||||
import { Bell, File } from 'lucide-vue-next'
|
import { Bell, Plus } from 'lucide-vue-next'
|
||||||
import { createResource } from 'frappe-ui'
|
import { createResource, Button } from 'frappe-ui'
|
||||||
|
|
||||||
const { user } = sessionStore()
|
const { userResource } = usersStore()
|
||||||
|
console.log(userResource)
|
||||||
const socket = inject('$socket')
|
const socket = inject('$socket')
|
||||||
const unreadCount = ref(0)
|
const unreadCount = ref(0)
|
||||||
const sidebarLinks = ref(getSidebarLinks())
|
const sidebarLinks = ref(getSidebarLinks())
|
||||||
|
const showPageModal = ref(false)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
socket.on('publish_lms_notifications', (data) => {
|
socket.on('publish_lms_notifications', (data) => {
|
||||||
unreadNotifications.reload()
|
unreadNotifications.reload()
|
||||||
})
|
})
|
||||||
|
console.log(userResource.data)
|
||||||
if (user) {
|
setTimeout(() => {
|
||||||
sidebarLinks.value.push({
|
addNotifications()
|
||||||
label: 'Notifications',
|
}, 500)
|
||||||
icon: Bell,
|
|
||||||
to: 'Notifications',
|
|
||||||
activeFor: ['Notifications'],
|
|
||||||
count: unreadCount.value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const unreadNotifications = createResource({
|
const unreadNotifications = createResource({
|
||||||
@@ -76,7 +84,7 @@ const unreadNotifications = createResource({
|
|||||||
return {
|
return {
|
||||||
doctype: 'Notification Log',
|
doctype: 'Notification Log',
|
||||||
filters: {
|
filters: {
|
||||||
for_user: user,
|
for_user: userResource.data?.email,
|
||||||
read: 0,
|
read: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -90,9 +98,21 @@ const unreadNotifications = createResource({
|
|||||||
return link
|
return link
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
auto: user ? true : false,
|
auto: userResource.data ? true : false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const addNotifications = () => {
|
||||||
|
if (userResource.data) {
|
||||||
|
sidebarLinks.value.push({
|
||||||
|
label: 'Notifications',
|
||||||
|
icon: Bell,
|
||||||
|
to: 'Notifications',
|
||||||
|
activeFor: ['Notifications'],
|
||||||
|
count: unreadCount.value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const sidebarSettings = createResource({
|
const sidebarSettings = createResource({
|
||||||
url: 'lms.lms.api.get_sidebar_settings',
|
url: 'lms.lms.api.get_sidebar_settings',
|
||||||
cache: 'Sidebar Settings',
|
cache: 'Sidebar Settings',
|
||||||
@@ -105,7 +125,7 @@ const sidebarSettings = createResource({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (data.nav_items) {
|
/* if (data.nav_items) {
|
||||||
data.nav_items.forEach((item) => {
|
data.nav_items.forEach((item) => {
|
||||||
sidebarLinks.value.push({
|
sidebarLinks.value.push({
|
||||||
label: item.label,
|
label: item.label,
|
||||||
@@ -114,11 +134,15 @@ const sidebarSettings = createResource({
|
|||||||
activeFor: [item.label],
|
activeFor: [item.label],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
} */
|
||||||
console.log(data)
|
console.log(data)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const openPageModal = () => {
|
||||||
|
showPageModal.value = true
|
||||||
|
}
|
||||||
|
|
||||||
const getSidebarFromStorage = () => {
|
const getSidebarFromStorage = () => {
|
||||||
return useStorage('sidebar_is_collapsed', false)
|
return useStorage('sidebar_is_collapsed', false)
|
||||||
}
|
}
|
||||||
|
|||||||
24
frontend/src/components/Modals/PageModal.vue
Normal file
24
frontend/src/components/Modals/PageModal.vue
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog
|
||||||
|
v-model="show"
|
||||||
|
class="text-base"
|
||||||
|
:options="{
|
||||||
|
title: __('Apply for this job'),
|
||||||
|
size: 'lg',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: 'Submit',
|
||||||
|
variant: 'solid',
|
||||||
|
onClick: (close) => {
|
||||||
|
submitResume(close)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #body-content> </template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { Dialog } from 'frappe-ui'
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user