diff --git a/api/src/Kurs.Platform.Application.Contracts/Intranet/IntranetDashboardDto.cs b/api/src/Kurs.Platform.Application.Contracts/Intranet/IntranetDashboardDto.cs index aa2cc484..b60a6e2b 100644 --- a/api/src/Kurs.Platform.Application.Contracts/Intranet/IntranetDashboardDto.cs +++ b/api/src/Kurs.Platform.Application.Contracts/Intranet/IntranetDashboardDto.cs @@ -15,5 +15,7 @@ public class IntranetDashboardDto public List Announcements { get; set; } = []; public List ShuttleRoutes { get; set; } = []; public List Meals { get; set; } = []; + public List Leaves { get; set; } = []; + public List Overtimes { get; set; } = []; } diff --git a/api/src/Kurs.Platform.Application.Contracts/Intranet/LeaveDto.cs b/api/src/Kurs.Platform.Application.Contracts/Intranet/LeaveDto.cs new file mode 100644 index 00000000..dc20b266 --- /dev/null +++ b/api/src/Kurs.Platform.Application.Contracts/Intranet/LeaveDto.cs @@ -0,0 +1,26 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Kurs.Platform.Intranet; + +public class LeaveDto : FullAuditedEntityDto +{ + public Guid? TenantId { get; set; } + + public Guid EmployeeId { get; set; } + public EmployeeDto Employee { get; set; } + + public string LeaveType { get; set; } + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public decimal TotalDays { get; set; } + public bool IsHalfDay { get; set; } + public string Reason { get; set; } + public string Status { get; set; } + public DateTime AppliedDate { get; set; } + public Guid? ApprovedById { get; set; } + public EmployeeDto ApprovedBy { get; set; } + public DateTime? ApprovedDate { get; set; } + public string RejectionReason { get; set; } + public string Attachments { get; set; } +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Application.Contracts/Intranet/OvertimeDto.cs b/api/src/Kurs.Platform.Application.Contracts/Intranet/OvertimeDto.cs new file mode 100644 index 00000000..16100d47 --- /dev/null +++ b/api/src/Kurs.Platform.Application.Contracts/Intranet/OvertimeDto.cs @@ -0,0 +1,24 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Kurs.Platform.Intranet; + +public class OvertimeDto : FullAuditedEntityDto +{ + public Guid? TenantId { get; set; } + + public Guid EmployeeId { get; set; } + public EmployeeDto Employee { get; set; } // Navigation'dan doldurulabilir + + public DateTime Date { get; set; } // Mesai tarihi + public DateTime StartTime { get; set; } // Başlangıç zamanı + public DateTime EndTime { get; set; } // Bitiş zamanı + public decimal TotalHours { get; set; } // Toplam fazla mesai süresi + public string Reason { get; set; } // Fazla mesai nedeni + public string Status { get; set; } // Durum: "Bekliyor", "Onaylandı", "Reddedildi" + public Guid? ApprovedById { get; set; } // Onaylayan kişi ID + public DateTime? ApprovedDate { get; set; } // Onay tarihi + public string RejectionReason { get; set; } // Reddetme nedeni + public decimal Rate { get; set; } // Fazla mesai oranı (ör. 1.5x) + public decimal? Amount { get; set; } // Hesaplanan ödeme tutarı +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs b/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs index 887cfcf4..2d7b1891 100644 --- a/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs +++ b/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs @@ -33,6 +33,8 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService private readonly IRepository _departmentRepository; private readonly IRepository _shuttleRouteRepository; private readonly IRepository _mealRepository; + private readonly IRepository _leaveRepository; + private readonly IRepository _overtimeRepository; public IntranetAppService( ICurrentTenant currentTenant, @@ -48,7 +50,9 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService IRepository announcementRepository, IRepository departmentRepository, IRepository shuttleRouteRepository, - IRepository mealRepository + IRepository mealRepository, + IRepository leaveRepository, + IRepository overtimeRepository ) { _currentTenant = currentTenant; @@ -65,6 +69,8 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService _departmentRepository = departmentRepository; _shuttleRouteRepository = shuttleRouteRepository; _mealRepository = mealRepository; + _leaveRepository = leaveRepository; + _overtimeRepository = overtimeRepository; } public async Task GetIntranetDashboardAsync() @@ -80,10 +86,34 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService Documents = await GetIntranetDocumentsAsync(BlobContainerNames.Intranet), Announcements = await GetAnnouncementsAsync(), ShuttleRoutes = await GetShuttleRoutesAsync(), - Meals = await GetMealsAsync() + Meals = await GetMealsAsync(), + Leaves = await GetLeavesAsync(), + Overtimes = await GetOvertimesAsync() }; } + private async Task> GetOvertimesAsync() + { + var today = DateTime.Now; + + var overtimes = await _overtimeRepository + .WithDetailsAsync(e => e.Employee) + .ContinueWith(t => t.Result.ToList()); + + return ObjectMapper.Map, List>(overtimes); + } + + private async Task> GetLeavesAsync() + { + var today = DateTime.Now; + + var leaves = await _leaveRepository + .WithDetailsAsync(e => e.Employee) + .ContinueWith(t => t.Result.ToList()); + + return ObjectMapper.Map, List>(leaves); + } + private async Task> GetMealsAsync() { // Bu haftanın başlangıç ve bitiş tarihlerini hesapla @@ -94,7 +124,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService var weekEnd = weekStart.AddDays(6); // Sadece bu haftanın yemeklerini getir - var meals = await _mealRepository.GetListAsync(m => + var meals = await _mealRepository.GetListAsync(m => m.Date >= weekStart && m.Date <= weekEnd); var mealDtos = new List(); @@ -120,7 +150,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService return mealDtos; } - + private async Task> GetShuttleRoutesAsync() { var shuttleRoutes = await _shuttleRouteRepository.GetListAsync(); diff --git a/api/src/Kurs.Platform.Application/Intranet/IntranetAutoMapperProfile.cs b/api/src/Kurs.Platform.Application/Intranet/IntranetAutoMapperProfile.cs index f6d948ef..cbf3663f 100644 --- a/api/src/Kurs.Platform.Application/Intranet/IntranetAutoMapperProfile.cs +++ b/api/src/Kurs.Platform.Application/Intranet/IntranetAutoMapperProfile.cs @@ -16,6 +16,8 @@ public class IntranetAutoMapperProfile : Profile CreateMap(); CreateMap(); CreateMap(); + CreateMap(); + CreateMap(); CreateMap() .ForMember(dest => dest.Materials, opt => opt.Ignore()); @@ -24,7 +26,7 @@ public class IntranetAutoMapperProfile : Profile .ForMember(dest => dest.Departments, opt => opt.Ignore()); CreateMap() - .ForMember(dest => dest.Route, opt => opt.Ignore()); + .ForMember(dest => dest.Route, opt => opt.Ignore()); } } diff --git a/ui/src/mocks/mockEmployeeLeaves.ts b/ui/src/mocks/mockEmployeeLeaves.ts deleted file mode 100644 index 9fc0f237..00000000 --- a/ui/src/mocks/mockEmployeeLeaves.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { HrLeave, LeaveStatusEnum, LeaveTypeEnum } from "../types/hr"; -import { mockEmployees } from "./mockEmployees"; - -export const mockEmployeeLeaves: HrLeave[] = [ - { - id: "1", - employeeId: "1", - employee: mockEmployees.find((e) => e.id === "1"), - leaveType: LeaveTypeEnum.Annual, - startDate: new Date("2024-12-20"), - endDate: new Date("2024-12-24"), - totalDays: 5, - reason: "Yıllık izin talebi", - status: LeaveStatusEnum.Pending, - appliedDate: new Date("2024-11-15"), - isHalfDay: false, - attachments: [], - creationTime: new Date("2024-11-15"), - lastModificationTime: new Date("2024-11-15"), - }, - { - id: "2", - employeeId: "2", - employee: mockEmployees.find((e) => e.id === "2"), - leaveType: LeaveTypeEnum.Sick, - startDate: new Date("2024-11-10"), - endDate: new Date("2024-11-12"), - totalDays: 3, - reason: "Sağlık kontrolü", - status: LeaveStatusEnum.Approved, - appliedDate: new Date("2024-11-08"), - approvedDate: new Date("2024-11-09"), - isHalfDay: false, - attachments: [], - creationTime: new Date("2024-11-08"), - lastModificationTime: new Date("2024-11-09"), - }, - { - id: "3", - employeeId: "3", - employee: mockEmployees.find((e) => e.id === "3"), - leaveType: LeaveTypeEnum.Personal, - startDate: new Date("2024-12-01"), - endDate: new Date("2024-12-01"), - totalDays: 0.5, - reason: "Kişisel işler", - status: LeaveStatusEnum.Rejected, - appliedDate: new Date("2024-11-20"), - rejectionReason: "Proje teslim tarihi nedeniyle uygun değil", - isHalfDay: true, - attachments: [], - creationTime: new Date("2024-11-20"), - lastModificationTime: new Date("2024-11-21"), - }, - { - id: "4", - employeeId: "4", - employee: mockEmployees.find((e) => e.id === "4"), - leaveType: LeaveTypeEnum.Emergency, - startDate: new Date("2024-11-25"), - endDate: new Date("2024-11-26"), - totalDays: 2, - reason: "Acil aile durumu", - status: LeaveStatusEnum.Pending, - appliedDate: new Date("2024-11-24"), - isHalfDay: false, - attachments: [], - creationTime: new Date("2024-11-24"), - lastModificationTime: new Date("2024-11-24"), - }, -]; diff --git a/ui/src/mocks/mockIntranet.ts b/ui/src/mocks/mockIntranet.ts index 789dc02e..b29608a9 100644 --- a/ui/src/mocks/mockIntranet.ts +++ b/ui/src/mocks/mockIntranet.ts @@ -4,6 +4,8 @@ import { DocumentDto, EventDto, ExpenseDto, + LeaveDto, + OvertimeDto, ReservationDto, ShuttleRouteDto, TrainingDto, @@ -11,6 +13,9 @@ import { } from '@/proxy/intranet/models' import { mockEmployees } from './mockEmployees' import { Survey, SocialPost } from '@/types/intranet' +import { LeaveStatusEnum, LeaveTypeEnum } from '@/types/hr' + +const currentUser = { ...mockEmployees[0], fullName: 'Siz' } export const mockSurveys: Survey[] = [ { @@ -187,8 +192,6 @@ export const mockSurveys: Survey[] = [ }, ] -const currentUser = { ...mockEmployees[0], fullName: 'Siz' } - export const mockSocialPosts: SocialPost[] = [ { id: '1', @@ -972,3 +975,222 @@ export const mockShuttleRoutes: ShuttleRouteDto[] = [ type: 'evening', }, ] + +export const mockLeaves: LeaveDto[] = [ + { + id: '1', + employeeId: '1', + employee: mockEmployees.find((e) => e.id === '1'), + leaveType: LeaveTypeEnum.Annual, + startDate: new Date('2024-12-20'), + endDate: new Date('2024-12-24'), + totalDays: 5, + reason: 'Yıllık izin talebi', + status: LeaveStatusEnum.Pending, + appliedDate: new Date('2024-11-15'), + isHalfDay: false, + attachments: [], + creationTime: new Date('2024-11-15'), + lastModificationTime: new Date('2024-11-15'), + }, + { + id: '2', + employeeId: '2', + employee: mockEmployees.find((e) => e.id === '2'), + leaveType: LeaveTypeEnum.Sick, + startDate: new Date('2024-11-10'), + endDate: new Date('2024-11-12'), + totalDays: 3, + reason: 'Sağlık kontrolü', + status: LeaveStatusEnum.Approved, + appliedDate: new Date('2024-11-08'), + approvedDate: new Date('2024-11-09'), + isHalfDay: false, + attachments: [], + creationTime: new Date('2024-11-08'), + lastModificationTime: new Date('2024-11-09'), + }, + { + id: '3', + employeeId: '3', + employee: mockEmployees.find((e) => e.id === '3'), + leaveType: LeaveTypeEnum.Personal, + startDate: new Date('2024-12-01'), + endDate: new Date('2024-12-01'), + totalDays: 0.5, + reason: 'Kişisel işler', + status: LeaveStatusEnum.Rejected, + appliedDate: new Date('2024-11-20'), + rejectionReason: 'Proje teslim tarihi nedeniyle uygun değil', + isHalfDay: true, + attachments: [], + creationTime: new Date('2024-11-20'), + lastModificationTime: new Date('2024-11-21'), + }, + { + id: '4', + employeeId: '4', + employee: mockEmployees.find((e) => e.id === '4'), + leaveType: LeaveTypeEnum.Emergency, + startDate: new Date('2024-11-25'), + endDate: new Date('2024-11-26'), + totalDays: 2, + reason: 'Acil aile durumu', + status: LeaveStatusEnum.Pending, + appliedDate: new Date('2024-11-24'), + isHalfDay: false, + attachments: [], + creationTime: new Date('2024-11-24'), + lastModificationTime: new Date('2024-11-24'), + }, +] + +export const mockOvertimes: OvertimeDto[] = [ + { + id: '1', + employeeId: '1', + date: new Date('2024-12-15'), + startTime: '18:00', + endTime: '21:00', + totalHours: 3, + reason: "Proje deadline'ı nedeniyle acil çalışma", + status: LeaveStatusEnum.Approved, + approvedBy: 'emp_002', + rate: 1.5, + amount: 450, // 3 saat * 100 TL/saat * 1.5 kat + creationTime: new Date('2024-12-15T09:00:00'), + lastModificationTime: new Date('2024-12-15T10:30:00'), + }, + { + id: '2', + employeeId: '3', + date: new Date('2024-12-14'), + startTime: '17:30', + endTime: '20:00', + totalHours: 2.5, + reason: 'Müşteri talep değişikliği nedeniyle ek çalışma', + status: LeaveStatusEnum.Pending, + rate: 1.5, + amount: 375, // 2.5 saat * 100 TL/saat * 1.5 kat + creationTime: new Date('2024-12-14T17:30:00'), + lastModificationTime: new Date('2024-12-14T17:30:00'), + }, + { + id: '3', + employeeId: '4', + date: new Date('2024-12-13'), + startTime: '19:00', + endTime: '22:30', + totalHours: 3.5, + reason: 'Sistem bakımı ve güncelleme çalışmaları', + status: LeaveStatusEnum.Approved, + approvedBy: 'emp_002', + rate: 1.5, + amount: 525, // 3.5 saat * 100 TL/saat * 1.5 kat + creationTime: new Date('2024-12-13T19:00:00'), + lastModificationTime: new Date('2024-12-13T22:35:00'), + }, + { + id: '4', + employeeId: '5', + date: new Date('2024-12-12'), + startTime: '17:00', + endTime: '19:00', + totalHours: 2, + reason: 'Rapor hazırlama ve sunum düzenleme', + status: LeaveStatusEnum.Rejected, + approvedBy: 'emp_002', + rate: 1.5, + amount: 0, // Reddedildiği için ücret hesaplanmadı + creationTime: new Date('2024-12-12T17:00:00'), + lastModificationTime: new Date('2024-12-12T08:30:00'), + }, + { + id: '5', + employeeId: '6', + date: new Date('2024-12-11'), + startTime: '18:30', + endTime: '21:00', + totalHours: 2.5, + reason: 'Acil hata düzeltme ve test çalışmaları', + status: LeaveStatusEnum.Approved, + approvedBy: 'emp_001', + rate: 2.0, // Hafta sonu çalışması + amount: 500, // 2.5 saat * 100 TL/saat * 2.0 kat + creationTime: new Date('2024-12-11T18:30:00'), + lastModificationTime: new Date('2024-12-11T21:05:00'), + }, + { + id: '6', + employeeId: '7', + date: new Date('2024-12-10'), + startTime: '16:00', + endTime: '20:00', + totalHours: 4, + reason: 'Yeni müşteri onboarding süreci', + status: LeaveStatusEnum.Pending, + rate: 1.5, + amount: 600, // 4 saat * 100 TL/saat * 1.5 kat + creationTime: new Date('2024-12-10T16:00:00'), + lastModificationTime: new Date('2024-12-10T16:00:00'), + }, + { + id: '7', + employeeId: '8', + date: new Date('2024-12-09'), + startTime: '17:45', + endTime: '21:15', + totalHours: 3.5, + reason: 'Veri analizi ve raporlama çalışmaları', + status: LeaveStatusEnum.Approved, + approvedBy: 'emp_002', + rate: 1.5, + amount: 525, // 3.5 saat * 100 TL/saat * 1.5 kat + creationTime: new Date('2024-12-09T17:45:00'), + lastModificationTime: new Date('2024-12-09T21:20:00'), + }, + { + id: '8', + employeeId: '9', + date: new Date('2024-12-08'), + startTime: '18:00', + endTime: '20:30', + totalHours: 2.5, + reason: 'Eğitim materyali hazırlama', + status: LeaveStatusEnum.Pending, + rate: 1.5, + amount: 375, // 2.5 saat * 100 TL/saat * 1.5 kat + creationTime: new Date('2024-12-08T18:00:00'), + lastModificationTime: new Date('2024-12-08T18:00:00'), + }, + { + id: '9', + employeeId: '10', + date: new Date('2024-12-07'), + startTime: '19:30', + endTime: '23:00', + totalHours: 3.5, + reason: 'Kritik sistem güvenlik yaması uygulaması', + status: LeaveStatusEnum.Approved, + approvedBy: 'emp_001', + rate: 1.5, + amount: 525, // 3.5 saat * 100 TL/saat * 1.5 kat + creationTime: new Date('2024-12-07T19:30:00'), + lastModificationTime: new Date('2024-12-07T23:05:00'), + }, + { + id: '10', + employeeId: '1', + date: new Date('2024-12-06'), + startTime: '17:30', + endTime: '20:00', + totalHours: 2.5, + reason: 'Stratejik planlama toplantısı hazırlığı', + status: LeaveStatusEnum.Rejected, + approvedBy: 'emp_002', + rate: 1.5, + amount: 0, // Reddedildiği için ücret hesaplanmadı + creationTime: new Date('2024-12-06T17:30:00'), + lastModificationTime: new Date('2024-12-06T08:15:00'), + }, +] \ No newline at end of file diff --git a/ui/src/mocks/mockOvertimes.ts b/ui/src/mocks/mockOvertimes.ts deleted file mode 100644 index a227b437..00000000 --- a/ui/src/mocks/mockOvertimes.ts +++ /dev/null @@ -1,151 +0,0 @@ -import { HrOvertime, LeaveStatusEnum } from "../types/hr"; - -export const mockOvertimes: HrOvertime[] = [ - { - id: "1", - employeeId: "1", - date: new Date("2024-12-15"), - startTime: "18:00", - endTime: "21:00", - totalHours: 3, - reason: "Proje deadline'ı nedeniyle acil çalışma", - status: LeaveStatusEnum.Approved, - approvedBy: "emp_002", - rate: 1.5, - amount: 450, // 3 saat * 100 TL/saat * 1.5 kat - creationTime: new Date("2024-12-15T09:00:00"), - lastModificationTime: new Date("2024-12-15T10:30:00"), - }, - { - id: "2", - employeeId: "3", - date: new Date("2024-12-14"), - startTime: "17:30", - endTime: "20:00", - totalHours: 2.5, - reason: "Müşteri talep değişikliği nedeniyle ek çalışma", - status: LeaveStatusEnum.Pending, - rate: 1.5, - amount: 375, // 2.5 saat * 100 TL/saat * 1.5 kat - creationTime: new Date("2024-12-14T17:30:00"), - lastModificationTime: new Date("2024-12-14T17:30:00"), - }, - { - id: "3", - employeeId: "4", - date: new Date("2024-12-13"), - startTime: "19:00", - endTime: "22:30", - totalHours: 3.5, - reason: "Sistem bakımı ve güncelleme çalışmaları", - status: LeaveStatusEnum.Approved, - approvedBy: "emp_002", - rate: 1.5, - amount: 525, // 3.5 saat * 100 TL/saat * 1.5 kat - creationTime: new Date("2024-12-13T19:00:00"), - lastModificationTime: new Date("2024-12-13T22:35:00"), - }, - { - id: "4", - employeeId: "5", - date: new Date("2024-12-12"), - startTime: "17:00", - endTime: "19:00", - totalHours: 2, - reason: "Rapor hazırlama ve sunum düzenleme", - status: LeaveStatusEnum.Rejected, - approvedBy: "emp_002", - rate: 1.5, - amount: 0, // Reddedildiği için ücret hesaplanmadı - creationTime: new Date("2024-12-12T17:00:00"), - lastModificationTime: new Date("2024-12-12T08:30:00"), - }, - { - id: "5", - employeeId: "6", - date: new Date("2024-12-11"), - startTime: "18:30", - endTime: "21:00", - totalHours: 2.5, - reason: "Acil hata düzeltme ve test çalışmaları", - status: LeaveStatusEnum.Approved, - approvedBy: "emp_001", - rate: 2.0, // Hafta sonu çalışması - amount: 500, // 2.5 saat * 100 TL/saat * 2.0 kat - creationTime: new Date("2024-12-11T18:30:00"), - lastModificationTime: new Date("2024-12-11T21:05:00"), - }, - { - id: "6", - employeeId: "7", - date: new Date("2024-12-10"), - startTime: "16:00", - endTime: "20:00", - totalHours: 4, - reason: "Yeni müşteri onboarding süreci", - status: LeaveStatusEnum.Pending, - rate: 1.5, - amount: 600, // 4 saat * 100 TL/saat * 1.5 kat - creationTime: new Date("2024-12-10T16:00:00"), - lastModificationTime: new Date("2024-12-10T16:00:00"), - }, - { - id: "7", - employeeId: "8", - date: new Date("2024-12-09"), - startTime: "17:45", - endTime: "21:15", - totalHours: 3.5, - reason: "Veri analizi ve raporlama çalışmaları", - status: LeaveStatusEnum.Approved, - approvedBy: "emp_002", - rate: 1.5, - amount: 525, // 3.5 saat * 100 TL/saat * 1.5 kat - creationTime: new Date("2024-12-09T17:45:00"), - lastModificationTime: new Date("2024-12-09T21:20:00"), - }, - { - id: "8", - employeeId: "9", - date: new Date("2024-12-08"), - startTime: "18:00", - endTime: "20:30", - totalHours: 2.5, - reason: "Eğitim materyali hazırlama", - status: LeaveStatusEnum.Pending, - rate: 1.5, - amount: 375, // 2.5 saat * 100 TL/saat * 1.5 kat - creationTime: new Date("2024-12-08T18:00:00"), - lastModificationTime: new Date("2024-12-08T18:00:00"), - }, - { - id: "9", - employeeId: "10", - date: new Date("2024-12-07"), - startTime: "19:30", - endTime: "23:00", - totalHours: 3.5, - reason: "Kritik sistem güvenlik yaması uygulaması", - status: LeaveStatusEnum.Approved, - approvedBy: "emp_001", - rate: 1.5, - amount: 525, // 3.5 saat * 100 TL/saat * 1.5 kat - creationTime: new Date("2024-12-07T19:30:00"), - lastModificationTime: new Date("2024-12-07T23:05:00"), - }, - { - id: "10", - employeeId: "1", - date: new Date("2024-12-06"), - startTime: "17:30", - endTime: "20:00", - totalHours: 2.5, - reason: "Stratejik planlama toplantısı hazırlığı", - status: LeaveStatusEnum.Rejected, - approvedBy: "emp_002", - rate: 1.5, - amount: 0, // Reddedildiği için ücret hesaplanmadı - creationTime: new Date("2024-12-06T17:30:00"), - lastModificationTime: new Date("2024-12-06T08:15:00"), - }, -]; diff --git a/ui/src/proxy/intranet/models.ts b/ui/src/proxy/intranet/models.ts index 4d34f09a..51c56df2 100644 --- a/ui/src/proxy/intranet/models.ts +++ b/ui/src/proxy/intranet/models.ts @@ -6,11 +6,12 @@ import { HrCostCenter, HrDisciplinaryAction, HrEmergencyContact, - HrLeave, HrPerformanceEvaluation, HrTraining, HrWorkSchedule, JobLevelEnum, + LeaveStatusEnum, + LeaveTypeEnum, MaritalStatusEnum, } from '@/types/hr' @@ -25,6 +26,8 @@ export interface IntranetDashboardDto { announcements: AnnouncementDto[] shuttleRoutes: ShuttleRouteDto[] meals: MealDto[] + leaves: LeaveDto[] + overtimes: OvertimeDto[] // surveys: Survey[] // priorityTasks: TaskDto[] } @@ -91,7 +94,7 @@ export interface EmployeeDto { badgeNumber?: string employeeStatus: EmployeeStatusEnum isActive: boolean - leaves: HrLeave[] + leaves: LeaveDto[] evaluations: HrPerformanceEvaluation[] trainings: HrTraining[] disciplinaryActions: HrDisciplinaryAction[] @@ -280,3 +283,43 @@ export interface MealDto { totalCalorie?: number materials: string[] } + +// İnsan Kaynakları Fazla Mesai +export interface OvertimeDto { + id: string + employeeId: string + employee?: EmployeeDto + date: Date + startTime: string + endTime: string + totalHours: number + reason: string + status: LeaveStatusEnum + approvedBy?: string + approver?: EmployeeDto + rate?: number + amount?: number + creationTime: Date + lastModificationTime: Date +} + +// İnsan Kaynakları İzni +export interface LeaveDto { + id: string + employeeId: string + employee?: EmployeeDto + leaveType: LeaveTypeEnum + startDate: Date + endDate: Date + totalDays: number + reason?: string + status: LeaveStatusEnum + appliedDate: Date + approvedBy?: string + approvedDate?: Date + rejectionReason?: string + isHalfDay: boolean + attachments: string[] + creationTime: Date + lastModificationTime: Date +} diff --git a/ui/src/types/hr.ts b/ui/src/types/hr.ts index 9df809fd..b07d6f42 100644 --- a/ui/src/types/hr.ts +++ b/ui/src/types/hr.ts @@ -24,27 +24,6 @@ export interface HrCostCenter { lastModificationTime: Date } -export interface HrLeave { - // İnsan Kaynakları İzni - id: string - employeeId: string - employee?: EmployeeDto - leaveType: LeaveTypeEnum - startDate: Date - endDate: Date - totalDays: number - reason?: string - status: LeaveStatusEnum - appliedDate: Date - approvedBy?: string - approvedDate?: Date - rejectionReason?: string - isHalfDay: boolean - attachments: string[] - creationTime: Date - lastModificationTime: Date -} - export interface HrPerformanceEvaluation { // İnsan Kaynakları Performans Değerlendirmesi id: string @@ -185,25 +164,6 @@ export interface HrEmploymentType { lastModificationTime: Date } -export interface HrOvertime { - // İnsan Kaynakları Fazla Mesai - id: string - employeeId: string - employee?: EmployeeDto - date: Date - startTime: string - endTime: string - totalHours: number - reason: string - status: LeaveStatusEnum - approvedBy?: string - approver?: EmployeeDto - rate?: number - amount?: number - creationTime: Date - lastModificationTime: Date -} - export interface HrPayroll { // İnsan Kaynakları Maaş Bordrosu id: string @@ -547,22 +507,22 @@ export enum JobLevelEnum { export enum LeaveTypeEnum { // İzin Türü - Annual = 'ANNUAL', // Yıllık - Sick = 'SICK', // Hastalık - Maternity = 'MATERNITY', // Doğum - Paternity = 'PATERNITY', // Babalık - Personal = 'PERSONAL', // Kişisel - Emergency = 'EMERGENCY', // Acil - Study = 'STUDY', // Eğitim - Unpaid = 'UNPAID', // Ücretsiz + Annual = 'Annual', // Yıllık + Sick = 'Sick', // Hastalık + Maternity = 'Maternity', // Doğum + Paternity = 'Paternity', // Babalık + Personal = 'Personal', // Kişisel + Emergency = 'Emergency', // Acil + Study = 'Study', // Eğitim + Unpaid = 'Unpaid', // Ücretsiz } export enum LeaveStatusEnum { // İzin Durumu - Pending = 'PENDING', // Beklemede - Approved = 'APPROVED', // Onaylandı - Rejected = 'REJECTED', // Reddedildi - Cancelled = 'CANCELLED', // İptal edildi + Pending = 'Pending', // Beklemede + Approved = 'Approved', // Onaylandı + Rejected = 'Rejected', // Reddedildi + Cancelled = 'Cancelled', // İptal edildi } export enum EvaluationStatusEnum { diff --git a/ui/src/views/hr/components/LeaveManagement.tsx b/ui/src/views/hr/components/LeaveManagement.tsx index b830ac40..b8c560f8 100644 --- a/ui/src/views/hr/components/LeaveManagement.tsx +++ b/ui/src/views/hr/components/LeaveManagement.tsx @@ -9,18 +9,19 @@ import { FaEye, FaUsers, } from 'react-icons/fa' -import { HrLeave, LeaveStatusEnum, LeaveTypeEnum } from '../../../types/hr' +import { LeaveStatusEnum, LeaveTypeEnum } from '../../../types/hr' import DataTable, { Column } from '../../../components/common/DataTable' -import { mockEmployeeLeaves } from '../../../mocks/mockEmployeeLeaves' import { mockEmployees } from '../../../mocks/mockEmployees' import { mockDepartments } from '../../../mocks/mockDepartments' import Widget from '../../../components/common/Widget' import { getLeaveTypeText, getLeaveStatusColor, getLeaveStatusText } from '../../../utils/erp' import { Container } from '@/components/shared' +import { mockLeaves } from '@/mocks/mockIntranet' +import { LeaveDto } from '@/proxy/intranet/models' const LeaveManagement: React.FC = () => { // Leave states - const [leaves, setLeaves] = useState(mockEmployeeLeaves) + const [leaves, setLeaves] = useState(mockLeaves) const [selectedStatus, setSelectedStatus] = useState('all') const [selectedType, setSelectedType] = useState('all') const [selectedPeriod, setSelectedPeriod] = useState('all') @@ -33,7 +34,7 @@ const LeaveManagement: React.FC = () => { const [showViewModal, setShowViewModal] = useState(false) const [showRejectModal, setShowRejectModal] = useState(false) const [showBulkModal, setShowBulkModal] = useState(false) - const [selectedLeave, setSelectedLeave] = useState(null) + const [selectedLeave, setSelectedLeave] = useState(null) const [rejectReason, setRejectReason] = useState('') // Form state for add/edit @@ -92,7 +93,7 @@ const LeaveManagement: React.FC = () => { setShowBulkModal(true) } - const handleEdit = (leave: HrLeave) => { + const handleEdit = (leave: LeaveDto) => { setSelectedLeave(leave) setFormData({ employeeId: leave.employeeId, @@ -147,7 +148,7 @@ const LeaveManagement: React.FC = () => { } } - const handleView = (leave: HrLeave) => { + const handleView = (leave: LeaveDto) => { setSelectedLeave(leave) setShowViewModal(true) } @@ -163,7 +164,7 @@ const LeaveManagement: React.FC = () => { const totalDays = Math.ceil((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24)) + 1 - const newLeave: HrLeave = { + const newLeave: LeaveDto = { id: `leave_${Date.now()}`, employeeId: formData.employeeId, leaveType: formData.leaveType, @@ -244,7 +245,7 @@ const LeaveManagement: React.FC = () => { const totalDays = Math.ceil((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24)) + 1 - const newLeaves: HrLeave[] = bulkFormData.selectedEmployees.map((employeeId) => { + const newLeaves: LeaveDto[] = bulkFormData.selectedEmployees.map((employeeId) => { const employee = getSelectedEmployee(employeeId) return { id: `leave_${Date.now()}_${employeeId}`, @@ -325,11 +326,11 @@ const LeaveManagement: React.FC = () => { return true }) - const columns: Column[] = [ + const columns: Column[] = [ { key: 'employee', header: 'Personel', - render: (leave: HrLeave) => ( + render: (leave: LeaveDto) => (
@@ -342,12 +343,12 @@ const LeaveManagement: React.FC = () => { { key: 'leaveType', header: 'İzin Türü', - render: (leave: HrLeave) => getLeaveTypeText(leave.leaveType), + render: (leave: LeaveDto) => getLeaveTypeText(leave.leaveType), }, { key: 'period', header: 'İzin Dönemi', - render: (leave: HrLeave) => ( + render: (leave: LeaveDto) => (
{new Date(leave.startDate).toLocaleDateString('tr-TR')}
{new Date(leave.endDate).toLocaleDateString('tr-TR')}
@@ -357,7 +358,7 @@ const LeaveManagement: React.FC = () => { { key: 'totalDays', header: 'Gün Sayısı', - render: (leave: HrLeave) => ( + render: (leave: LeaveDto) => (
{leave.totalDays} gün @@ -367,12 +368,12 @@ const LeaveManagement: React.FC = () => { { key: 'appliedDate', header: 'Başvuru Tarihi', - render: (leave: HrLeave) => new Date(leave.appliedDate).toLocaleDateString('tr-TR'), + render: (leave: LeaveDto) => new Date(leave.appliedDate).toLocaleDateString('tr-TR'), }, { key: 'status', header: 'Durum', - render: (leave: HrLeave) => ( + render: (leave: LeaveDto) => ( { { key: 'actions', header: 'İşlemler', - render: (leave: HrLeave) => ( + render: (leave: LeaveDto) => (