From e29a924e87aa08290e5ec04f8d55ac91f2769e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Tue, 28 Oct 2025 23:12:06 +0300 Subject: [PATCH] =?UTF-8?q?Intranet=20AppService=20i=C3=A7erisinde=20t?= =?UTF-8?q?=C3=BCm=20istekler=20birle=C5=9Ftirilecek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Intranet/EventDto.cs | 9 ++-- .../Intranet/IntranetAppService.cs | 13 ++--- .../Entities/Branch/{Hr => Intranet}/Meal.cs | 0 .../Tenant/{Hr => Intranet}/Announcement.cs | 0 .../Entities/Tenant/{Hr => Intranet}/Event.cs | 3 +- .../Tenant/{Hr => Intranet}/EventCategory.cs | 0 .../Tenant/{Hr => Intranet}/EventComment.cs | 0 .../Tenant/{Hr => Intranet}/EventPhoto.cs | 0 .../Tenant/{Hr => Intranet}/EventType.cs | 0 .../Tenant/{Hr => Intranet}/Reservation.cs | 0 .../Tenant/{Hr => Intranet}/ShuttleRoute.cs | 0 .../Tenant/{Hr => Intranet}/Survey.cs | 0 .../Tenant/{Hr => Intranet}/Visitor.cs | 0 ....cs => 20251028200151_Initial.Designer.cs} | 5 +- ...0_Initial.cs => 20251028200151_Initial.cs} | 3 +- .../PlatformDbContextModelSnapshot.cs | 3 ++ .../Tenants/Seeds/TenantData.json | 15 +++--- .../Tenants/TenantDataSeeder.cs | 1 + .../Tenants/TenantSeederDto.cs | 3 +- ui/src/mocks/mockIntranet.ts | 39 ++++++++------- ui/src/proxy/intranet/models.ts | 31 ++++++++++++ ui/src/services/ai.service.ts | 10 +--- ui/src/services/intranet.service.ts | 17 +++++++ ui/src/types/intranet.ts | 25 ---------- ui/src/views/ai/Assistant.tsx | 10 ++-- ui/src/views/intranet/Dashboard.tsx | 28 ++++++----- ui/src/views/intranet/widgets/TodayEvents.tsx | 47 ------------------- .../views/intranet/widgets/UpcomingEvents.tsx | 12 ++--- 28 files changed, 133 insertions(+), 141 deletions(-) rename api/src/Kurs.Platform.Domain/Entities/Branch/{Hr => Intranet}/Meal.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/Announcement.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/Event.cs (96%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/EventCategory.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/EventComment.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/EventPhoto.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/EventType.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/Reservation.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/ShuttleRoute.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/Survey.cs (100%) rename api/src/Kurs.Platform.Domain/Entities/Tenant/{Hr => Intranet}/Visitor.cs (100%) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251028185430_Initial.Designer.cs => 20251028200151_Initial.Designer.cs} (99%) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251028185430_Initial.cs => 20251028200151_Initial.cs} (99%) create mode 100644 ui/src/proxy/intranet/models.ts create mode 100644 ui/src/services/intranet.service.ts delete mode 100644 ui/src/views/intranet/widgets/TodayEvents.tsx diff --git a/api/src/Kurs.Platform.Application.Contracts/Intranet/EventDto.cs b/api/src/Kurs.Platform.Application.Contracts/Intranet/EventDto.cs index 5ff287a8..0e6891c8 100644 --- a/api/src/Kurs.Platform.Application.Contracts/Intranet/EventDto.cs +++ b/api/src/Kurs.Platform.Application.Contracts/Intranet/EventDto.cs @@ -6,11 +6,12 @@ namespace Kurs.Platform.Public; public class EventDto { public string Id { get; set; } - public string Title { get; set; } - public string Description { get; set; } - public string Type { get; set; } + public string CategoryName { get; set; } + public string TypeName { get; set; } public DateTime Date { get; set; } - public string Location { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string Place { get; set; } public EventOrganizerDto Organizer { get; set; } public int Participants { get; set; } public List Photos { get; set; } = new(); diff --git a/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs b/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs index 36386650..27e8c302 100644 --- a/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs +++ b/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs @@ -45,7 +45,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService private async Task> GetUpcomingEventsAsync() { var events = await _eventRepository - .WithDetailsAsync(e => e.Category, e => e.Type, e => e.Photos, e => e.Comments) + .WithDetailsAsync(e => e.Category, e => e.Type, e => e.Category, e => e.Photos, e => e.Comments) .ContinueWith(t => t.Result.ToList().Where(e => e.isPublished).OrderByDescending(e => e.CreationTime)); var result = new List(); @@ -60,11 +60,12 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService var calendarEvent = new EventDto { Id = evt.Id.ToString(), - Title = evt.Name, + Name = evt.Name, Description = evt.Description, - Type = evt.Type?.Name?.ToLowerInvariant() ?? "social", - Date = evt.CreationTime, - Location = evt.Place, + TypeName = evt.Type?.Name, + CategoryName = evt.Category?.Name, + Date = evt.Date, + Place = evt.Place, Organizer = new EventOrganizerDto { Id = employee.Id, @@ -73,7 +74,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService Avatar = employee.Avatar }, Participants = evt.ParticipantsCount, - Photos = evt.Photos?.Select(p => p.Url).ToList() ?? [], + Photos = [], Comments = [], Likes = evt.Likes, IsPublished = evt.isPublished diff --git a/api/src/Kurs.Platform.Domain/Entities/Branch/Hr/Meal.cs b/api/src/Kurs.Platform.Domain/Entities/Branch/Intranet/Meal.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Branch/Hr/Meal.cs rename to api/src/Kurs.Platform.Domain/Entities/Branch/Intranet/Meal.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Announcement.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Announcement.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Announcement.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Announcement.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Event.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Event.cs similarity index 96% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Event.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Event.cs index 09c1d6a8..9d7342ab 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Event.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Event.cs @@ -12,9 +12,10 @@ public class Event : FullAuditedEntity, IMultiTenant public Guid CategoryId { get; set; } public Guid TypeId { get; set; } + public DateTime Date { get; set; } public string Name { get; set; } - public string Place { get; set; } public string Description { get; set; } + public string Place { get; set; } public string Status { get; set; } public Guid EmployeeId { get; set; } diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventCategory.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/EventCategory.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventCategory.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/EventCategory.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventComment.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/EventComment.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventComment.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/EventComment.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventPhoto.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/EventPhoto.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventPhoto.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/EventPhoto.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventType.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/EventType.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventType.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/EventType.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Reservation.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Reservation.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Reservation.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Reservation.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/ShuttleRoute.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/ShuttleRoute.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/ShuttleRoute.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/ShuttleRoute.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Survey.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Survey.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Survey.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Survey.cs diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Visitor.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Visitor.cs similarity index 100% rename from api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Visitor.cs rename to api/src/Kurs.Platform.Domain/Entities/Tenant/Intranet/Visitor.cs diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028200151_Initial.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028200151_Initial.Designer.cs index e7d9241c..e0364783 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028200151_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251028185430_Initial")] + [Migration("20251028200151_Initial")] partial class Initial { /// @@ -3728,6 +3728,9 @@ namespace Kurs.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("CreatorId"); + b.Property("Date") + .HasColumnType("datetime2"); + b.Property("DeleterId") .HasColumnType("uniqueidentifier") .HasColumnName("DeleterId"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028200151_Initial.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028200151_Initial.cs index 7ad46960..4a8433f2 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028200151_Initial.cs @@ -4343,9 +4343,10 @@ namespace Kurs.Platform.Migrations TenantId = table.Column(type: "uniqueidentifier", nullable: true), CategoryId = table.Column(type: "uniqueidentifier", nullable: false), TypeId = table.Column(type: "uniqueidentifier", nullable: false), + Date = table.Column(type: "datetime2", nullable: false), Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - Place = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Place = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), Status = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), EmployeeId = table.Column(type: "uniqueidentifier", nullable: false), ParticipantsCount = table.Column(type: "int", nullable: false), diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index e3d77282..c23e4a5a 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -3725,6 +3725,9 @@ namespace Kurs.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("CreatorId"); + b.Property("Date") + .HasColumnType("datetime2"); + b.Property("DeleterId") .HasColumnType("uniqueidentifier") .HasColumnName("DeleterId"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index 874f7bcb..a576dd4d 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -1509,12 +1509,13 @@ { "CategoryName": "Spor", "TypeName": "Futbol Turnuvası", + "Date": "2025-11-15T10:00:00", "Name": "Yaz Futbol Turnuvası 2025", - "Place": "Şirket Kampüsü Spor Alanı", "Description": "Tüm departmanların katılımıyla düzenlenen geleneksel yaz futbol turnuvası.", + "Place": "Şirket Kampüsü Spor Alanı", "Status": "Published", - "ParticipantsCount": 64, "OrganizerEmployeeCode": "EMP-001", + "ParticipantsCount": 64, "IsPublished": true, "Likes": 120, "Photos": [], @@ -1523,12 +1524,13 @@ { "CategoryName": "Kültür", "TypeName": "Kültürel Sanat Günü", + "Date": "2025-11-17T10:00:00", "Name": "Kültür Gezisi: Kapadokya", - "Place": "Kapadokya, Nevşehir", "Description": "Çalışanlarımıza özel, rehber eşliğinde 2 günlük kültürel gezi.", + "Place": "Kapadokya, Nevşehir", "Status": "Published", - "ParticipantsCount": 25, "OrganizerEmployeeCode": "EMP-002", + "ParticipantsCount": 25, "IsPublished": true, "Likes": 45, "Photos": [], @@ -1537,12 +1539,13 @@ { "CategoryName": "Müzik", "TypeName": "Caz Akşamı", + "Date": "2025-11-18T10:00:00", "Name": "Müzik Dinletisi: Jazz Akşamı", - "Place": "Şirket Konferans Salonu", "Description": "Caz müziğinin en güzel örneklerinin canlı performanslarla sunulacağı özel akşam.", + "Place": "Şirket Konferans Salonu", "Status": "Published", - "ParticipantsCount": 40, "OrganizerEmployeeCode": "EMP-003", + "ParticipantsCount": 40, "IsPublished": true, "Likes": 85, "Photos": [], diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs index bbdf4578..4be0018d 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -1538,6 +1538,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency { CategoryId = category.Id, TypeId = type.Id, + Date = item.Date, Name = item.Name, Place = item.Place, Description = item.Description, diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index 2019565f..a43b410e 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -699,9 +699,10 @@ public class EventSeedDto { public string CategoryName { get; set; } public string TypeName { get; set; } + public DateTime Date { get; set; } public string Name { get; set; } - public string Place { get; set; } public string Description { get; set; } + public string Place { get; set; } public string Status { get; set; } public string OrganizerEmployeeCode { get; set; } public int ParticipantsCount { get; set; } diff --git a/ui/src/mocks/mockIntranet.ts b/ui/src/mocks/mockIntranet.ts index f4c112a7..2082e558 100644 --- a/ui/src/mocks/mockIntranet.ts +++ b/ui/src/mocks/mockIntranet.ts @@ -1,7 +1,7 @@ +import { EventDto } from '@/proxy/intranet/models' import { mockEmployees } from './mockEmployees' import { Announcement, - CalendarEvent, Visitor, Document, Certificate, @@ -822,15 +822,16 @@ export const mockSocialPosts: SocialPost[] = [ ///////////////////////////////////////////////////////////////////////////////////// ///////APP SERVİS YAPILANLAR////////// -export const mockEvents: CalendarEvent[] = [ +export const mockEvents: EventDto[] = [ { id: 'evt1', - title: 'Yaz Pikniği 2025', + name: 'Yaz Pikniği 2025', description: 'Şirket çalışanları olarak doğayla iç içe harika bir gün geçirdik. Takım oyunları, barbekü ve çok eğlence!', - type: 'social', + categoryName: 'Spor', + typeName: 'Futbol Turnuvası', date: new Date('2025-10-20'), - location: 'Polonezköy Piknik Alanı', + place: 'Polonezköy Piknik Alanı', organizer: mockEmployees[4], participants: 45, photos: [ @@ -860,11 +861,12 @@ export const mockEvents: CalendarEvent[] = [ }, { id: 'evt2', - title: 'Hackathon 2025', + name: 'Hackathon 2025', description: '24 saatlik yazılım geliştirme maratonu. İnovasyon, teknoloji ve takım çalışması!', - type: 'training', + categoryName: 'Spor', + typeName: 'training', date: new Date('2025-20-22'), - location: 'Ofis - Ana Salon', + place: 'Ofis - Ana Salon', organizer: mockEmployees[0], participants: 28, photos: [ @@ -893,11 +895,12 @@ export const mockEvents: CalendarEvent[] = [ }, { id: 'evt3', - title: 'Kurumsal Futbol Turnuvası', + name: 'Kurumsal Futbol Turnuvası', description: 'Departmanlar arası futbol turnuvasında ter döktük, gol attık ve kazandık! 🏆', - type: 'sport', + categoryName: 'Spor', + typeName: 'sport', date: new Date('2025-10-25'), - location: 'Spor Kompleksi Halı Saha', + place: 'Spor Kompleksi Halı Saha', organizer: mockEmployees[2], participants: 32, photos: [ @@ -920,11 +923,12 @@ export const mockEvents: CalendarEvent[] = [ }, { id: 'evt4', - title: 'Yılbaşı Gala Gecesi 2024', + name: 'Yılbaşı Gala Gecesi 2024', description: 'Harika bir yıla muhteşem bir gala ile veda ettik. Müzik, dans ve sürprizler!', - type: 'company', + categoryName: 'Spor', + typeName: 'company', date: new Date('2024-12-28'), - location: 'Grand Hotel - Balo Salonu', + place: 'Grand Hotel - Balo Salonu', organizer: mockEmployees[3], participants: 68, photos: [ @@ -962,11 +966,12 @@ export const mockEvents: CalendarEvent[] = [ }, { id: 'evt5', - title: 'Sanat Atölyesi - Ebru Workshop', + name: 'Sanat Atölyesi - Ebru Workshop', description: 'Geleneksel Türk sanatı ebru yapımı atölyesinde harika eserler ortaya çıktı!', - type: 'culture', + categoryName: 'Spor', + typeName: 'culture', date: new Date('2025-05-12'), - location: 'Ofis - Yaratıcı Alan', + place: 'Ofis - Yaratıcı Alan', organizer: mockEmployees[1], participants: 18, photos: [ diff --git a/ui/src/proxy/intranet/models.ts b/ui/src/proxy/intranet/models.ts new file mode 100644 index 00000000..54f70130 --- /dev/null +++ b/ui/src/proxy/intranet/models.ts @@ -0,0 +1,31 @@ +import { HrEmployee } from '@/types/hr' + +export interface IntranetDashboardDto { + events: EventDto[]; +} + +// Etkinlik +export interface EventDto { + id: string + categoryName: string + typeName: string + date: Date + name: string + description: string + place: string + organizer: HrEmployee + participants: number + photos: string[] + comments: EventCommentDto[] + likes: number + isPublished: boolean +} + +// Etkinlik Yorumu +export interface EventCommentDto { + id: string + author: HrEmployee + content: string + creationTime: Date + likes: number +} diff --git a/ui/src/services/ai.service.ts b/ui/src/services/ai.service.ts index 41d0afab..22cc7d11 100644 --- a/ui/src/services/ai.service.ts +++ b/ui/src/services/ai.service.ts @@ -20,12 +20,4 @@ export class AiService { ) } -export const getAi = async (skipCount = 0, maxResultCount = 1000, sorting = 'botName') => { - const service = new AiService() - - return await service.getList({ - sorting, - skipCount, - maxResultCount, - }) -} +export const aiService = new AiService() diff --git a/ui/src/services/intranet.service.ts b/ui/src/services/intranet.service.ts new file mode 100644 index 00000000..959bbebc --- /dev/null +++ b/ui/src/services/intranet.service.ts @@ -0,0 +1,17 @@ +import apiService, { Config } from './api.service' +import { IntranetDashboardDto } from '@/proxy/intranet/models' + +export class IntranetService { + apiName = 'Default' + + getDashboard = (config?: Partial) => + apiService.fetchData( + { + method: 'GET', + url: '/api/app/intranet/intranet-dashboard', + }, + { apiName: this.apiName, ...config }, + ) +} + +export const intranetService = new IntranetService() diff --git a/ui/src/types/intranet.ts b/ui/src/types/intranet.ts index 6f8aca56..1a5c550d 100644 --- a/ui/src/types/intranet.ts +++ b/ui/src/types/intranet.ts @@ -17,31 +17,6 @@ export interface Announcement { imageUrl?: string } -// Etkinlik -export interface CalendarEvent { - id: string - title: string - description: string - type: 'social' | 'training' | 'company' | 'sport' | 'culture' - date: Date - location: string - organizer: HrEmployee - participants: number - photos: string[] - comments: EventComment[] - likes: number - isPublished: boolean -} - -// Etkinlik Yorumu -export interface EventComment { - id: string - author: HrEmployee - content: string - creationTime: Date - likes: number -} - // Harcama export interface ExpenseRequest { id: string diff --git a/ui/src/views/ai/Assistant.tsx b/ui/src/views/ai/Assistant.tsx index 7ec19783..b08c251e 100644 --- a/ui/src/views/ai/Assistant.tsx +++ b/ui/src/views/ai/Assistant.tsx @@ -1,10 +1,10 @@ import React, { useState, useRef, useEffect, SyntheticEvent } from 'react' -import { FaRobot } from 'react-icons/fa'; +import { FaRobot } from 'react-icons/fa' import { useStoreActions, useStoreState } from '@/store' import { Avatar, Dropdown } from '@/components/ui' import LoadAiPostsFromLocalStorage from './LoadAiPostsFromLocalStorage' import { useLocalization } from '@/utils/hooks/useLocalization' -import { getAi } from '@/services/ai.service' +import { aiService } from '@/services/ai.service' import { AiDto } from '@/proxy/ai/models' import { Container } from '@/components/shared' import { Helmet } from 'react-helmet' @@ -60,7 +60,11 @@ const Assistant = () => { useEffect(() => { const fetchBots = async () => { try { - const result = await getAi() + const result = await aiService.getList({ + skipCount: 0, + maxResultCount: 1000, + sorting: 'botName', + }) const items = result?.data?.items?.map((bot: AiDto) => ({ key: bot.id!, diff --git a/ui/src/views/intranet/Dashboard.tsx b/ui/src/views/intranet/Dashboard.tsx index 0a40b553..5e615a09 100644 --- a/ui/src/views/intranet/Dashboard.tsx +++ b/ui/src/views/intranet/Dashboard.tsx @@ -34,18 +34,13 @@ import SocialWall from './SocialWall' import { Announcement, Survey, SurveyAnswer } from '@/types/intranet' import { Container } from '@/components/shared' import { usePermission } from '@/utils/hooks/usePermission' +import { IntranetDashboardDto } from '@/proxy/intranet/models' +import { intranetService, IntranetService } from '@/services/intranet.service' dayjs.locale('tr') dayjs.extend(relativeTime) dayjs.extend(isBetween) -interface WidgetConfig { - id: string - permission: string - component: React.ReactNode - column: 'left' | 'center' | 'right' -} - const WIDGET_ORDER_KEY = 'dashboard-widget-order' const IntranetDashboard: React.FC = () => { @@ -63,6 +58,18 @@ const IntranetDashboard: React.FC = () => { center: [], right: [], }) + + const [intranetDashboard, setIntranetDashboard] = useState() + + const fetchIntranetDashboard = async () => { + const dashboard = await intranetService.getDashboard() + setIntranetDashboard(dashboard.data) + } + + useEffect(() => { + fetchIntranetDashboard() + }, []) + // Drag state'leri birleştirildi const [dragState, setDragState] = useState<{ draggedId: string | null @@ -173,11 +180,6 @@ const IntranetDashboard: React.FC = () => { e.dataTransfer.setData('sourceColumn', column) } - const handleDragOver = (e: React.DragEvent) => { - e.preventDefault() - e.dataTransfer.dropEffect = 'move' - } - const handleDragEnterWidget = (e: React.DragEvent, column: string, index: number) => { // Sadece widget'ın üst kısmına yakınsa indicator göster const rect = (e.currentTarget as HTMLElement).getBoundingClientRect() @@ -243,7 +245,7 @@ const IntranetDashboard: React.FC = () => { const renderWidgetComponent = (widgetId: string) => { switch (widgetId) { case 'upcoming-events': - return + return case 'today-birthdays': return case 'recent-documents': diff --git a/ui/src/views/intranet/widgets/TodayEvents.tsx b/ui/src/views/intranet/widgets/TodayEvents.tsx deleted file mode 100644 index ab340d38..00000000 --- a/ui/src/views/intranet/widgets/TodayEvents.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react' -import { FaCalendarAlt } from 'react-icons/fa' -import dayjs from 'dayjs' -import { mockEvents } from '../../../mocks/mockIntranet' - -const TodayEvents: React.FC = () => { - const todayEvents = mockEvents.filter( - (event) => event.isPublished && dayjs(event.date).isSame(dayjs(), 'day'), - ) - - return ( -
-
-

- - Bugün -

-
-
- {todayEvents.length > 0 ? ( - todayEvents.map((event) => ( -
-

- {event.title} -

-

- {dayjs(event.date).format('DD MMMM YYYY')} - {event.location} -

-

- {event.participants} katılımcı -

-
- )) - ) : ( -

- Bugün etkinlik yok -

- )} -
-
- ) -} - -export default TodayEvents diff --git a/ui/src/views/intranet/widgets/UpcomingEvents.tsx b/ui/src/views/intranet/widgets/UpcomingEvents.tsx index 2bf7049a..c4b37344 100644 --- a/ui/src/views/intranet/widgets/UpcomingEvents.tsx +++ b/ui/src/views/intranet/widgets/UpcomingEvents.tsx @@ -1,10 +1,10 @@ import React from 'react' import { FaCalendarAlt } from 'react-icons/fa' import dayjs from 'dayjs' -import { mockEvents } from '../../../mocks/mockIntranet' +import { EventDto } from '@/proxy/intranet/models' -const UpcomingEvents: React.FC = () => { - const upcomingEvents = mockEvents.filter( +const UpcomingEvents: React.FC<{ events: EventDto[] }> = ({ events }) => { + const upcomingEvents = events.filter( (event) => event.isPublished && dayjs(event.date).isAfter(dayjs()) && @@ -26,11 +26,9 @@ const UpcomingEvents: React.FC = () => { key={event.id} className="p-3 rounded-lg border-l-4 bg-gray-50 dark:bg-gray-700/50 border-l-green-500" > -

- {event.title} -

+

{event.name}

- {dayjs(event.date).format('DD MMMM YYYY')} - {event.location} + {dayjs(event.date).format('DD MMMM YYYY')} - {event.place}

))