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,
|
||||
} 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[] = [
|
||||
{
|
||||
id: 'survey1',
|
||||
|
|
@ -1066,3 +1018,51 @@ export const mockExpenseRequests: ExpenseRequest[] = [
|
|||
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 { Announcement, Survey, SurveyAnswer } from '@/types/intranet'
|
||||
import { Container } from '@/components/shared'
|
||||
import { usePermission } from '@/utils/hooks/usePermission'
|
||||
|
||||
dayjs.locale('tr')
|
||||
dayjs.extend(relativeTime)
|
||||
|
|
@ -46,6 +47,7 @@ const IntranetDashboard: React.FC = () => {
|
|||
const [showOvertimeModal, setShowOvertimeModal] = useState(false)
|
||||
const [showExpenseModal, setShowExpenseModal] = useState(false)
|
||||
const [showReservationModal, setShowReservationModal] = useState(false)
|
||||
const { checkPermission } = usePermission()
|
||||
|
||||
const handleTakeSurvey = (survey: 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="lg:col-span-3 space-y-6">
|
||||
<UpcomingEvents />
|
||||
<TodayBirthdays />
|
||||
<RecentDocuments />
|
||||
<UpcomingTrainings />
|
||||
{checkPermission('App.Intranet.Events.Event.Widget') && <UpcomingEvents />}
|
||||
{checkPermission('App.Hr.Employee.Widget') && <TodayBirthdays />}
|
||||
{checkPermission('App.Files.Widget') && <RecentDocuments />}
|
||||
{checkPermission('App.Hr.Training.Widget') && <UpcomingTrainings />}
|
||||
{checkPermission('App.Intranet.Reservation.Widget') && (
|
||||
<ActiveReservations onNewReservation={() => setShowReservationModal(true)} />
|
||||
)}
|
||||
<ActiveSurveys onTakeSurvey={handleTakeSurvey} />
|
||||
<Visitors />
|
||||
{checkPermission('App.Intranet.Visitor.Widget') && <Visitors />}
|
||||
{checkPermission('App.Hr.Expense.Widget') && (
|
||||
<ExpenseManagement onNewExpense={() => setShowExpenseModal(true)} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="lg:col-span-5 space-y-6">
|
||||
|
|
@ -104,12 +110,18 @@ const IntranetDashboard: React.FC = () => {
|
|||
</div>
|
||||
|
||||
<div className="lg:col-span-3 space-y-6">
|
||||
{checkPermission('App.Intranet.Announcement.Widget') && (
|
||||
<ImportantAnnouncements onAnnouncementClick={setSelectedAnnouncement} />
|
||||
<PriorityTasks />
|
||||
<MealWeeklyMenu />
|
||||
<ShuttleSchedule />
|
||||
)}
|
||||
{checkPermission('App.Projects.Tasks.Widget') && <PriorityTasks />}
|
||||
{checkPermission('App.Intranet.Meal.Widget') && <MealWeeklyMenu />}
|
||||
{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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue