Dashboard kısmında Widgetlar yetkiye bağlandı
This commit is contained in:
parent
d10763c4ea
commit
98d81ce296
2 changed files with 73 additions and 61 deletions
|
|
@ -14,54 +14,6 @@ import {
|
||||||
SocialPost,
|
SocialPost,
|
||||||
} from '@/types/intranet'
|
} from '@/types/intranet'
|
||||||
|
|
||||||
export const mockDocuments: Document[] = [
|
|
||||||
{
|
|
||||||
id: 'doc1',
|
|
||||||
name: 'Çalışan El Kitabı 2024',
|
|
||||||
type: 'pdf',
|
|
||||||
category: 'policy',
|
|
||||||
size: '3.2 MB',
|
|
||||||
uploadedBy: mockEmployees[3],
|
|
||||||
uploadDate: new Date('2024-01-15'),
|
|
||||||
version: '2.0',
|
|
||||||
url: '#',
|
|
||||||
description: 'Şirket politikaları ve prosedürleri',
|
|
||||||
departments: ['Tüm Departmanlar'],
|
|
||||||
downloadCount: 234,
|
|
||||||
tags: ['politika', 'prosedür', 'çalışan hakları'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'doc2',
|
|
||||||
name: 'İzin Talep Formu',
|
|
||||||
type: 'doc',
|
|
||||||
category: 'form',
|
|
||||||
size: '124 KB',
|
|
||||||
uploadedBy: mockEmployees[3],
|
|
||||||
uploadDate: new Date('2024-02-01'),
|
|
||||||
version: '1.5',
|
|
||||||
url: '#',
|
|
||||||
description: 'İzin talepleri için kullanılacak form',
|
|
||||||
departments: ['Tüm Departmanlar'],
|
|
||||||
downloadCount: 567,
|
|
||||||
tags: ['form', 'izin', 'HR'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'doc3',
|
|
||||||
name: 'Yazılım Geliştirme Standartları',
|
|
||||||
type: 'pdf',
|
|
||||||
category: 'procedure',
|
|
||||||
size: '1.8 MB',
|
|
||||||
uploadedBy: mockEmployees[4],
|
|
||||||
uploadDate: new Date('2024-03-10'),
|
|
||||||
version: '3.1',
|
|
||||||
url: '#',
|
|
||||||
description: 'Kod standartları ve best practices',
|
|
||||||
departments: ['Yazılım Geliştirme'],
|
|
||||||
downloadCount: 89,
|
|
||||||
tags: ['development', 'standards', 'coding'],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
export const mockSurveys: Survey[] = [
|
export const mockSurveys: Survey[] = [
|
||||||
{
|
{
|
||||||
id: 'survey1',
|
id: 'survey1',
|
||||||
|
|
@ -1066,3 +1018,51 @@ export const mockExpenseRequests: ExpenseRequest[] = [
|
||||||
creationTime: new Date('2024-10-14T22:00:00'),
|
creationTime: new Date('2024-10-14T22:00:00'),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const mockDocuments: Document[] = [
|
||||||
|
{
|
||||||
|
id: 'doc1',
|
||||||
|
name: 'Çalışan El Kitabı 2024',
|
||||||
|
type: 'pdf',
|
||||||
|
category: 'policy',
|
||||||
|
size: '3.2 MB',
|
||||||
|
uploadedBy: mockEmployees[3],
|
||||||
|
uploadDate: new Date('2024-01-15'),
|
||||||
|
version: '2.0',
|
||||||
|
url: '#',
|
||||||
|
description: 'Şirket politikaları ve prosedürleri',
|
||||||
|
departments: ['Tüm Departmanlar'],
|
||||||
|
downloadCount: 234,
|
||||||
|
tags: ['politika', 'prosedür', 'çalışan hakları'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'doc2',
|
||||||
|
name: 'İzin Talep Formu',
|
||||||
|
type: 'doc',
|
||||||
|
category: 'form',
|
||||||
|
size: '124 KB',
|
||||||
|
uploadedBy: mockEmployees[3],
|
||||||
|
uploadDate: new Date('2024-02-01'),
|
||||||
|
version: '1.5',
|
||||||
|
url: '#',
|
||||||
|
description: 'İzin talepleri için kullanılacak form',
|
||||||
|
departments: ['Tüm Departmanlar'],
|
||||||
|
downloadCount: 567,
|
||||||
|
tags: ['form', 'izin', 'HR'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'doc3',
|
||||||
|
name: 'Yazılım Geliştirme Standartları',
|
||||||
|
type: 'pdf',
|
||||||
|
category: 'procedure',
|
||||||
|
size: '1.8 MB',
|
||||||
|
uploadedBy: mockEmployees[4],
|
||||||
|
uploadDate: new Date('2024-03-10'),
|
||||||
|
version: '3.1',
|
||||||
|
url: '#',
|
||||||
|
description: 'Kod standartları ve best practices',
|
||||||
|
departments: ['Yazılım Geliştirme'],
|
||||||
|
downloadCount: 89,
|
||||||
|
tags: ['development', 'standards', 'coding'],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
@ -33,6 +33,7 @@ import AnnouncementDetailModal from './modals/AnnouncementDetailModal'
|
||||||
import SocialWall from './SocialWall'
|
import SocialWall from './SocialWall'
|
||||||
import { Announcement, Survey, SurveyAnswer } from '@/types/intranet'
|
import { Announcement, Survey, SurveyAnswer } from '@/types/intranet'
|
||||||
import { Container } from '@/components/shared'
|
import { Container } from '@/components/shared'
|
||||||
|
import { usePermission } from '@/utils/hooks/usePermission'
|
||||||
|
|
||||||
dayjs.locale('tr')
|
dayjs.locale('tr')
|
||||||
dayjs.extend(relativeTime)
|
dayjs.extend(relativeTime)
|
||||||
|
|
@ -46,6 +47,7 @@ const IntranetDashboard: React.FC = () => {
|
||||||
const [showOvertimeModal, setShowOvertimeModal] = useState(false)
|
const [showOvertimeModal, setShowOvertimeModal] = useState(false)
|
||||||
const [showExpenseModal, setShowExpenseModal] = useState(false)
|
const [showExpenseModal, setShowExpenseModal] = useState(false)
|
||||||
const [showReservationModal, setShowReservationModal] = useState(false)
|
const [showReservationModal, setShowReservationModal] = useState(false)
|
||||||
|
const { checkPermission } = usePermission()
|
||||||
|
|
||||||
const handleTakeSurvey = (survey: Survey) => {
|
const handleTakeSurvey = (survey: Survey) => {
|
||||||
setSelectedSurvey(survey)
|
setSelectedSurvey(survey)
|
||||||
|
|
@ -89,14 +91,18 @@ const IntranetDashboard: React.FC = () => {
|
||||||
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-11 gap-4">
|
<div className="grid grid-cols-1 lg:grid-cols-11 gap-4">
|
||||||
<div className="lg:col-span-3 space-y-6">
|
<div className="lg:col-span-3 space-y-6">
|
||||||
<UpcomingEvents />
|
{checkPermission('App.Intranet.Events.Event.Widget') && <UpcomingEvents />}
|
||||||
<TodayBirthdays />
|
{checkPermission('App.Hr.Employee.Widget') && <TodayBirthdays />}
|
||||||
<RecentDocuments />
|
{checkPermission('App.Files.Widget') && <RecentDocuments />}
|
||||||
<UpcomingTrainings />
|
{checkPermission('App.Hr.Training.Widget') && <UpcomingTrainings />}
|
||||||
<ActiveReservations onNewReservation={() => setShowReservationModal(true)} />
|
{checkPermission('App.Intranet.Reservation.Widget') && (
|
||||||
|
<ActiveReservations onNewReservation={() => setShowReservationModal(true)} />
|
||||||
|
)}
|
||||||
<ActiveSurveys onTakeSurvey={handleTakeSurvey} />
|
<ActiveSurveys onTakeSurvey={handleTakeSurvey} />
|
||||||
<Visitors />
|
{checkPermission('App.Intranet.Visitor.Widget') && <Visitors />}
|
||||||
<ExpenseManagement onNewExpense={() => setShowExpenseModal(true)} />
|
{checkPermission('App.Hr.Expense.Widget') && (
|
||||||
|
<ExpenseManagement onNewExpense={() => setShowExpenseModal(true)} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="lg:col-span-5 space-y-6">
|
<div className="lg:col-span-5 space-y-6">
|
||||||
|
|
@ -104,12 +110,18 @@ const IntranetDashboard: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="lg:col-span-3 space-y-6">
|
<div className="lg:col-span-3 space-y-6">
|
||||||
<ImportantAnnouncements onAnnouncementClick={setSelectedAnnouncement} />
|
{checkPermission('App.Intranet.Announcement.Widget') && (
|
||||||
<PriorityTasks />
|
<ImportantAnnouncements onAnnouncementClick={setSelectedAnnouncement} />
|
||||||
<MealWeeklyMenu />
|
)}
|
||||||
<ShuttleSchedule />
|
{checkPermission('App.Projects.Tasks.Widget') && <PriorityTasks />}
|
||||||
<LeaveManagement onNewLeave={() => setShowLeaveModal(true)} />
|
{checkPermission('App.Intranet.Meal.Widget') && <MealWeeklyMenu />}
|
||||||
<OvertimeManagement onNewOvertime={() => setShowOvertimeModal(true)} />
|
{checkPermission('App.Intranet.ShuttleRoute.Widget') && <ShuttleSchedule />}
|
||||||
|
{checkPermission('App.Hr.Leave.Widget') && (
|
||||||
|
<LeaveManagement onNewLeave={() => setShowLeaveModal(true)} />
|
||||||
|
)}
|
||||||
|
{checkPermission('App.Hr.Overtime.Widget') && (
|
||||||
|
<OvertimeManagement onNewOvertime={() => setShowOvertimeModal(true)} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue