currentLocalDate yeni tarih formatı
This commit is contained in:
parent
27eabae6b6
commit
e34755d5d7
23 changed files with 137 additions and 62 deletions
|
|
@ -10,7 +10,6 @@ import { FaCheck } from 'react-icons/fa'
|
|||
import type { CommonProps } from '@/proxy/common'
|
||||
import appConfig from '@/proxy/configs/app.config'
|
||||
import { dateLocales } from '@/constants/dateLocales.constant'
|
||||
import { Tooltip } from '../ui'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
|
||||
const _LanguageSelector = ({ className }: CommonProps) => {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import dayjs from 'dayjs'
|
||||
|
||||
// Veritabanındaki tarihi olduğu gibi göstermek için yardımcı fonksiyon
|
||||
export function showDbDateAsIs(dateStr: string) {
|
||||
if (!dateStr) return ''
|
||||
|
|
@ -5,3 +7,8 @@ export function showDbDateAsIs(dateStr: string) {
|
|||
// Sadece ilk 19 karakteri (YYYY-MM-DD HH:mm:ss) al
|
||||
return dateStr.replace('T', ' ').substring(0, 19)
|
||||
}
|
||||
|
||||
// Locale parametresi alan fonksiyon - hook kullanmadan
|
||||
export function currentLocalDate(date: Date, locale: string, format: string = 'LL') {
|
||||
return dayjs(date).locale(locale).format(format)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import isEmpty from 'lodash/isEmpty'
|
|||
import keys from 'lodash/keys'
|
||||
import Event from './Event'
|
||||
import TimeLineAvatar from './TimeLineAvatar'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
|
||||
const Log = ({
|
||||
notifications,
|
||||
|
|
@ -23,6 +24,7 @@ const Log = ({
|
|||
loadable: boolean
|
||||
}) => {
|
||||
const { translate } = useLocalization()
|
||||
const currentLocale = useLocale()
|
||||
|
||||
return (
|
||||
<Loading type="cover" loading={isLoading}>
|
||||
|
|
@ -30,7 +32,7 @@ const Log = ({
|
|||
{keys(notifications).map((group) => (
|
||||
<div key={group} className="mb-8">
|
||||
<div className="mb-4 font-semibold uppercase">
|
||||
{dayjs(group).format('dddd, MMMM D, YYYY')}
|
||||
{dayjs(group).locale(currentLocale).format('LL')}
|
||||
</div>
|
||||
<Timeline>
|
||||
{isEmpty(notifications[group]) ? (
|
||||
|
|
|
|||
|
|
@ -32,12 +32,14 @@ import {
|
|||
getCustomerSegmentText,
|
||||
} from '../../../utils/erp'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
|
||||
const CustomerCards: React.FC = () => {
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
const [filterStatus, setFilterStatus] = useState('all')
|
||||
const [filterSegment, setFilterSegment] = useState('all')
|
||||
const [showFilters, setShowFilters] = useState(false)
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const {
|
||||
data: customers,
|
||||
|
|
@ -377,7 +379,8 @@ const CustomerCards: React.FC = () => {
|
|||
{customer.lastOrderDate && (
|
||||
<div className="flex items-center">
|
||||
<FaCalendar className="w-4 h-4 mr-1" />
|
||||
<span>{dayjs(customer.lastOrderDate).format('DD.MM.YY')}</span>
|
||||
<span>
|
||||
{dayjs(customer.lastOrderDate).locale(currentLocale).format('LL')}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -30,12 +30,14 @@ import {
|
|||
getCustomerSegmentText,
|
||||
} from '../../../utils/erp'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
|
||||
const CustomerList: React.FC = () => {
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
const [filterStatus, setFilterStatus] = useState('all')
|
||||
const [filterSegment, setFilterSegment] = useState('all')
|
||||
const [showFilters, setShowFilters] = useState(false)
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const {
|
||||
data: customers,
|
||||
|
|
@ -360,7 +362,7 @@ const CustomerList: React.FC = () => {
|
|||
{customer.lastOrderDate && (
|
||||
<div className="flex items-center text-sm text-gray-900">
|
||||
<FaCalendar size={14} className="mr-1" />
|
||||
{dayjs(customer.lastOrderDate).format('DD.MM.YYYY')}
|
||||
{dayjs(customer.lastOrderDate).locale(currentLocale).format('LL')}
|
||||
</div>
|
||||
)}
|
||||
<div className="text-sm text-gray-500">Son sipariş</div>
|
||||
|
|
|
|||
|
|
@ -36,11 +36,14 @@ import {
|
|||
import { BusinessPartyStatusEnum } from '../../../types/common'
|
||||
import { Container } from '@/components/shared'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
|
||||
const CustomerView: React.FC = () => {
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const navigate = useNavigate()
|
||||
const [activeTab, setActiveTab] = useState('overview')
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const {
|
||||
data: customer,
|
||||
|
|
@ -325,8 +328,9 @@ const CustomerView: React.FC = () => {
|
|||
<div className="flex justify-between">
|
||||
<span className="text-gray-600">Son Sipariş:</span>
|
||||
<span className="font-medium">
|
||||
|
||||
{customer.lastOrderDate
|
||||
? dayjs(customer.lastOrderDate).format('DD.MM.YYYY')
|
||||
? currentLocalDate(customer.lastOrderDate, currentLocale || 'tr')
|
||||
: 'Henüz sipariş yok'}
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -341,7 +345,7 @@ const CustomerView: React.FC = () => {
|
|||
<div className="flex justify-between">
|
||||
<span className="text-gray-600">Kayıt Tarihi:</span>
|
||||
<span className="font-medium">
|
||||
{dayjs(customer.creationTime).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(customer.creationTime, currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -476,7 +480,7 @@ const CustomerView: React.FC = () => {
|
|||
<div className="flex-1">
|
||||
<p className="text-sm text-gray-900">Yeni sipariş oluşturuldu</p>
|
||||
<p className="text-sm text-gray-600">
|
||||
{dayjs().subtract(2, 'hour').format('HH:mm')}
|
||||
{currentLocalDate(dayjs().subtract(2, 'hour').toDate(), currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -485,7 +489,7 @@ const CustomerView: React.FC = () => {
|
|||
<div className="flex-1">
|
||||
<p className="text-sm text-gray-900">Teklif onaylandı</p>
|
||||
<p className="text-sm text-gray-600">
|
||||
{dayjs().subtract(1, 'day').format('DD.MM.YYYY')}
|
||||
{currentLocalDate(dayjs().subtract(1, 'day').toDate(), currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -494,7 +498,7 @@ const CustomerView: React.FC = () => {
|
|||
<div className="flex-1">
|
||||
<p className="text-sm text-gray-900">Görüşme yapıldı</p>
|
||||
<p className="text-sm text-gray-600">
|
||||
{dayjs().subtract(3, 'day').format('DD.MM.YYYY')}
|
||||
{currentLocalDate(dayjs().subtract(3, 'day').toDate(), currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -761,7 +765,7 @@ const CustomerView: React.FC = () => {
|
|||
Kayıt Tarihi
|
||||
</label>
|
||||
<p className="text-gray-900">
|
||||
{dayjs(customer.creationTime).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(customer.creationTime, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -769,7 +773,7 @@ const CustomerView: React.FC = () => {
|
|||
Son Güncelleme
|
||||
</label>
|
||||
<p className="text-gray-900">
|
||||
{dayjs(customer.lastModificationTime).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(customer.lastModificationTime, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -893,7 +897,7 @@ const CustomerView: React.FC = () => {
|
|||
Son Sipariş Tarihi
|
||||
</label>
|
||||
<p className="text-gray-900">
|
||||
{dayjs(customer.lastOrderDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(customer.lastOrderDate, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -917,7 +921,7 @@ const CustomerView: React.FC = () => {
|
|||
<div className="flex items-center justify-between">
|
||||
<h4 className="font-medium text-gray-900">Müşteri Kaydı Oluşturuldu</h4>
|
||||
<span className="text-sm text-gray-500">
|
||||
{dayjs(customer.creationTime).format('DD.MM.YYYY HH:mm')}
|
||||
{currentLocalDate(customer.creationTime, currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -929,7 +933,7 @@ const CustomerView: React.FC = () => {
|
|||
<div className="flex items-center justify-between">
|
||||
<h4 className="font-medium text-gray-900">Son Güncelleme</h4>
|
||||
<span className="text-sm text-gray-500">
|
||||
{dayjs(customer.lastModificationTime).format('DD.MM.YYYY HH:mm')}
|
||||
{currentLocalDate(customer.lastModificationTime, currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm text-gray-600 mt-1">Müşteri bilgileri güncellendi.</p>
|
||||
|
|
@ -943,11 +947,11 @@ const CustomerView: React.FC = () => {
|
|||
<div className="flex items-center justify-between">
|
||||
<h4 className="font-medium text-gray-900">Son Sipariş</h4>
|
||||
<span className="text-sm text-gray-500">
|
||||
{dayjs(customer.lastOrderDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(customer.lastOrderDate, currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
Son sipariş tarihi: {dayjs(customer.lastOrderDate).format('DD.MM.YYYY')}
|
||||
Son sipariş tarihi: {currentLocalDate(customer.lastOrderDate, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import { Team, TeamRoleEnum } from '../../../types/common'
|
|||
import { getTeamRoleText } from '../../../utils/erp'
|
||||
import { Container } from '@/components/shared'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
|
||||
const SalesTeamView: React.FC = () => {
|
||||
const navigate = useNavigate()
|
||||
|
|
@ -70,6 +72,7 @@ const SalesTeamView: React.FC = () => {
|
|||
const performance = calculateTeamPerformance(team)
|
||||
const revenue = calculateTeamRevenue(team)
|
||||
const activeTarget = team.targets?.find((t) => t.status === 'ACTIVE')
|
||||
const currentLocale = useLocale()
|
||||
|
||||
return (
|
||||
<Container>
|
||||
|
|
@ -211,7 +214,7 @@ const SalesTeamView: React.FC = () => {
|
|||
<label className="block text-xs font-medium text-gray-600 mb-1">
|
||||
Oluşturulma Tarihi
|
||||
</label>
|
||||
<p className="text-gray-900">{dayjs(team.creationTime).format('DD.MM.YYYY')}</p>
|
||||
<p className="text-gray-900">{currentLocalDate(team.creationTime, currentLocale || 'tr')}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
|
@ -219,7 +222,7 @@ const SalesTeamView: React.FC = () => {
|
|||
Son Güncelleme
|
||||
</label>
|
||||
<p className="text-gray-900">
|
||||
{dayjs(team.lastModificationTime).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(team.lastModificationTime, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -246,7 +249,7 @@ const SalesTeamView: React.FC = () => {
|
|||
<div>
|
||||
<p className="font-medium text-gray-900">{member.employee?.fullName}</p>
|
||||
<p className="text-sm text-gray-500">
|
||||
Katılım: {dayjs(member.joinDate).format('DD.MM.YYYY')}
|
||||
Katılım: {currentLocalDate(member.joinDate, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -399,8 +402,8 @@ const SalesTeamView: React.FC = () => {
|
|||
Başlangıç - Bitiş
|
||||
</label>
|
||||
<p className="text-sm text-gray-900">
|
||||
{dayjs(activeTarget.startDate).format('DD.MM.YYYY')} -{' '}
|
||||
{dayjs(activeTarget.endDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(activeTarget.startDate, currentLocale || 'tr')} -{' '}
|
||||
{currentLocalDate(activeTarget.endDate, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
import { AnimatePresence } from 'framer-motion'
|
||||
import dayjs from 'dayjs'
|
||||
import 'dayjs/locale/tr'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import isBetween from 'dayjs/plugin/isBetween'
|
||||
import localizedFormat from 'dayjs/plugin/localizedFormat'
|
||||
|
||||
// Widgets
|
||||
import TodayBirthdays from './widgets/TodayBirthdays'
|
||||
|
|
@ -36,10 +36,12 @@ import { intranetService } from '@/services/intranet.service'
|
|||
import Announcements from './widgets/Announcements'
|
||||
import ShuttleRoute from './widgets/ShuttleRoute'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
dayjs.locale('tr')
|
||||
dayjs.extend(relativeTime)
|
||||
dayjs.extend(isBetween)
|
||||
dayjs.extend(localizedFormat)
|
||||
|
||||
const WIDGET_ORDER_KEY = 'dashboard-widget-order'
|
||||
|
||||
|
|
@ -61,6 +63,7 @@ const IntranetDashboard: React.FC = () => {
|
|||
|
||||
const [intranetDashboard, setIntranetDashboard] = useState<IntranetDashboardDto>()
|
||||
const { translate } = useLocalization()
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const fetchIntranetDashboard = async () => {
|
||||
const dashboard = await intranetService.getDashboard()
|
||||
|
|
@ -507,7 +510,7 @@ const IntranetDashboard: React.FC = () => {
|
|||
<div>
|
||||
<p className="text-gray-600 dark:text-gray-400 mt-1">
|
||||
<span className="font-medium">{translate('::AI.Welcome')},</span>{' '}
|
||||
{dayjs().format('DD MMMM YYYY dddd')}
|
||||
{currentLocalDate(new Date(), currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { motion } from 'framer-motion'
|
|||
import { FaTimes, FaEye, FaClipboard } from 'react-icons/fa'
|
||||
import dayjs from 'dayjs'
|
||||
import { AnnouncementDto } from '@/proxy/intranet/models'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
interface AnnouncementDetailModalProps {
|
||||
announcement: AnnouncementDto
|
||||
|
|
@ -10,6 +12,7 @@ interface AnnouncementDetailModalProps {
|
|||
}
|
||||
|
||||
const AnnouncementDetailModal: React.FC<AnnouncementDetailModalProps> = ({ announcement, onClose }) => {
|
||||
const currentLocale = useLocale()
|
||||
const getCategoryColor = (category: string) => {
|
||||
const colors: Record<string, string> = {
|
||||
general: 'bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300',
|
||||
|
|
@ -81,7 +84,7 @@ const AnnouncementDetailModal: React.FC<AnnouncementDetailModalProps> = ({ annou
|
|||
</p>
|
||||
<div className="flex items-center gap-3 text-sm text-gray-600 dark:text-gray-400">
|
||||
<span>
|
||||
{dayjs(announcement.publishDate).format('DD MMMM YYYY, HH:mm')}
|
||||
{currentLocalDate(announcement.publishDate, currentLocale || 'tr')}
|
||||
</span>
|
||||
<span>•</span>
|
||||
<span className="flex items-center gap-1">
|
||||
|
|
@ -171,7 +174,7 @@ const AnnouncementDetailModal: React.FC<AnnouncementDetailModalProps> = ({ annou
|
|||
<div className="mt-6 pt-6 border-t border-gray-200 dark:border-gray-700">
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400">
|
||||
<span className="font-medium">Son Geçerlilik Tarihi:</span>{' '}
|
||||
{dayjs(announcement.expiryDate).format('DD MMMM YYYY')}
|
||||
{currentLocalDate(announcement.expiryDate, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import React from 'react'
|
|||
import { FaKey, FaPlus } from 'react-icons/fa'
|
||||
import dayjs from 'dayjs'
|
||||
import { ReservationDto } from '@/proxy/intranet/models'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
interface ActiveReservationsProps {
|
||||
reservations: ReservationDto[]
|
||||
|
|
@ -12,6 +14,8 @@ const ActiveReservations: React.FC<ActiveReservationsProps> = ({
|
|||
reservations,
|
||||
onNewReservation,
|
||||
}) => {
|
||||
const currentLocale = useLocale()
|
||||
|
||||
return (
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
|
||||
<div className="p-4 border-b border-gray-200 dark:border-gray-700">
|
||||
|
|
@ -42,8 +46,8 @@ const ActiveReservations: React.FC<ActiveReservationsProps> = ({
|
|||
</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-600 dark:text-gray-400">
|
||||
{dayjs(reservation.startDate).format('DD MMM HH:mm')} -{' '}
|
||||
{dayjs(reservation.endDate).format('HH:mm')}
|
||||
{currentLocalDate(reservation.startDate, currentLocale || 'tr')} -{' '}
|
||||
{currentLocalDate(reservation.endDate, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import React from 'react'
|
|||
import { FaClipboardCheck, FaQuestionCircle, FaUsers, FaClock, FaArrowRight } from 'react-icons/fa'
|
||||
import dayjs from 'dayjs'
|
||||
import { SurveyDto } from '@/proxy/intranet/models'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
// import { mockSurveys } from '../../../mocks/mockIntranet'
|
||||
|
||||
interface ActiveSurveysProps {
|
||||
|
|
@ -10,6 +12,8 @@ interface ActiveSurveysProps {
|
|||
}
|
||||
|
||||
const ActiveSurveys: React.FC<ActiveSurveysProps> = ({ surveys, onTakeSurvey }) => {
|
||||
const currentLocale = useLocale()
|
||||
|
||||
return (
|
||||
<div className="bg-gradient-to-br from-white to-gray-50 dark:from-gray-800 dark:to-gray-850 rounded-xl shadow-lg border border-gray-200/50 dark:border-gray-700/50 overflow-hidden">
|
||||
{/* Header with gradient */}
|
||||
|
|
@ -110,7 +114,7 @@ const ActiveSurveys: React.FC<ActiveSurveysProps> = ({ surveys, onTakeSurvey })
|
|||
{/* Deadline */}
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400 mb-4">
|
||||
<FaClock className="inline w-3 h-3 mr-1" />
|
||||
Son tarih: {dayjs(survey.deadline).format('DD MMMM YYYY')}
|
||||
Son tarih: {currentLocalDate(survey.deadline, currentLocale || 'tr')}
|
||||
</p>
|
||||
|
||||
{/* Action Button */}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { FaCalendarAlt, FaPlus } from 'react-icons/fa'
|
|||
import dayjs from 'dayjs'
|
||||
import { LeaveStatusEnum, LeaveTypeEnum } from '../../../types/hr'
|
||||
import { LeaveDto } from '@/proxy/intranet/models'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
interface LeaveManagementProps {
|
||||
leaves: LeaveDto[]
|
||||
|
|
@ -10,6 +12,8 @@ interface LeaveManagementProps {
|
|||
}
|
||||
|
||||
const LeaveManagement: React.FC<LeaveManagementProps> = ({ leaves, onNewLeave }) => {
|
||||
const currentLocale = useLocale()
|
||||
|
||||
return (
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
|
||||
<div className="p-4 border-b border-gray-200 dark:border-gray-700">
|
||||
|
|
@ -66,7 +70,7 @@ const LeaveManagement: React.FC<LeaveManagementProps> = ({ leaves, onNewLeave })
|
|||
</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-600 dark:text-gray-400">
|
||||
{dayjs(leave.startDate).format('DD MMM')} - {dayjs(leave.endDate).format('DD MMM')}{' '}
|
||||
{currentLocalDate(leave.startDate, currentLocale || 'tr')} - {currentLocalDate(leave.endDate, currentLocale || 'tr')}{' '}
|
||||
({leave.totalDays} gün)
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,10 +4,14 @@ import dayjs from 'dayjs'
|
|||
import isBetween from 'dayjs/plugin/isBetween'
|
||||
import { Badge } from '@/components/ui'
|
||||
import { MealDto } from '@/proxy/intranet/models'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
dayjs.extend(isBetween)
|
||||
|
||||
const MealWeeklyMenu: React.FC<{ meals: MealDto[] }> = ({ meals }) => {
|
||||
const currentLocale = useLocale()
|
||||
|
||||
return (
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
|
||||
<div className="p-4 border-b border-gray-200 dark:border-gray-700">
|
||||
|
|
@ -32,7 +36,7 @@ const MealWeeklyMenu: React.FC<{ meals: MealDto[] }> = ({ meals }) => {
|
|||
<div className="flex items-center justify-between mb-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<h3 className="text-sm font-semibold text-gray-900 dark:text-white">
|
||||
{dayjs(menu.date).format('DD MMMM')} {dayjs(menu.date).format('dddd')}
|
||||
{currentLocalDate(menu.date, currentLocale || 'tr')} {dayjs(menu.date).format('dddd')}
|
||||
</h3>
|
||||
{isToday && (
|
||||
<span className="text-xs bg-orange-500 text-white px-2 py-0.5 rounded-full">
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { FaClock, FaPlus } from 'react-icons/fa'
|
|||
import dayjs from 'dayjs'
|
||||
import { LeaveStatusEnum } from '../../../types/hr'
|
||||
import { OvertimeDto } from '@/proxy/intranet/models'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
interface OvertimeManagementProps {
|
||||
overtimes: OvertimeDto[]
|
||||
|
|
@ -10,6 +12,8 @@ interface OvertimeManagementProps {
|
|||
}
|
||||
|
||||
const OvertimeManagement: React.FC<OvertimeManagementProps> = ({ overtimes, onNewOvertime }) => {
|
||||
const currentLocale = useLocale()
|
||||
|
||||
return (
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
|
||||
<div className="p-4 border-b border-gray-200 dark:border-gray-700">
|
||||
|
|
@ -54,7 +58,7 @@ const OvertimeManagement: React.FC<OvertimeManagementProps> = ({ overtimes, onNe
|
|||
</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-600 dark:text-gray-400">
|
||||
{dayjs(overtime.date).format('DD MMM YYYY')}
|
||||
{currentLocalDate(overtime.date, currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ import dayjs from 'dayjs'
|
|||
import { mockProjectTasks } from '../../../mocks/mockProjectTasks'
|
||||
import { PriorityEnum } from '../../../types/common'
|
||||
import { TaskStatusEnum } from '../../../types/ps'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
const PriorityTasks: React.FC = () => {
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const priorityTasks = mockProjectTasks
|
||||
.filter((t) => t.priority === PriorityEnum.High || t.priority === PriorityEnum.Urgent)
|
||||
.slice(0, 3)
|
||||
|
|
@ -58,7 +62,7 @@ const PriorityTasks: React.FC = () => {
|
|||
<div className="flex items-center gap-3 text-xs text-gray-500">
|
||||
<span className="flex items-center gap-1">
|
||||
<FaClock className="w-3 h-3" />
|
||||
{dayjs(task.endDate).format('DD MMM')}
|
||||
{currentLocalDate(task.endDate, currentLocale || 'tr')}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<FaUser className="w-3 h-3" />
|
||||
|
|
|
|||
|
|
@ -2,8 +2,12 @@ import React from 'react'
|
|||
import { FaCalendarAlt } from 'react-icons/fa'
|
||||
import dayjs from 'dayjs'
|
||||
import { EventDto } from '@/proxy/intranet/models'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
const UpcomingEvents: React.FC<{ events: EventDto[] }> = ({ events }) => {
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const upcomingEvents = events.filter(
|
||||
(event) =>
|
||||
event.isPublished &&
|
||||
|
|
@ -28,7 +32,7 @@ const UpcomingEvents: React.FC<{ events: EventDto[] }> = ({ events }) => {
|
|||
>
|
||||
<h4 className="text-sm font-medium text-gray-900 dark:text-white">{event.name}</h4>
|
||||
<p className="text-xs text-gray-600 dark:text-gray-400 mt-1">
|
||||
{dayjs(event.date).format('DD MMMM YYYY')} - {event.place}
|
||||
{currentLocalDate(event.date, currentLocale || 'tr')} - {event.place}
|
||||
</p>
|
||||
</div>
|
||||
))
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import React from 'react'
|
||||
import { FaGraduationCap } from 'react-icons/fa'
|
||||
import dayjs from 'dayjs'
|
||||
import { TrainingDto } from '@/proxy/intranet/models'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
|
||||
const UpcomingTrainings: React.FC<{ trainings: TrainingDto[] }> = ({ trainings }) => {
|
||||
const currentLocale = useLocale()
|
||||
|
||||
return (
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
|
||||
<div className="p-4 border-b border-gray-200 dark:border-gray-700">
|
||||
|
|
@ -29,8 +32,8 @@ const UpcomingTrainings: React.FC<{ trainings: TrainingDto[] }> = ({ trainings }
|
|||
</p>
|
||||
<div className="flex items-center justify-between text-xs">
|
||||
<span className="text-gray-500 dark:text-gray-400">
|
||||
{dayjs(training.startDate).format('DD MMM')} -{' '}
|
||||
{dayjs(training.endDate).format('DD MMM')}
|
||||
{currentLocalDate(training.startDate, currentLocale || 'tr', 'DD MMM')} -{' '}
|
||||
{currentLocalDate(training.endDate, currentLocale || 'tr', 'DD MMM')}
|
||||
</span>
|
||||
<span className="text-blue-600 dark:text-blue-400 font-medium">
|
||||
{training.enrolled}/{training.maxParticipants}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,15 @@ import {
|
|||
} from '../../../utils/erp'
|
||||
import { Container } from '@/components/shared'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
const WorkCenterList: React.FC = () => {
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
const [filterStatus, setFilterStatus] = useState('all')
|
||||
const [filterCriticality, setFilterCriticality] = useState('all')
|
||||
const [showFilters, setShowFilters] = useState(false)
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const {
|
||||
data: workCenter,
|
||||
|
|
@ -330,11 +333,11 @@ const WorkCenterList: React.FC = () => {
|
|||
<div className="space-y-1">
|
||||
<div className="flex items-center text-sm text-gray-900">
|
||||
<FaCalendar size={14} className="mr-1" />
|
||||
{dayjs(eq.installationDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(eq.installationDate, currentLocale || 'tr')}
|
||||
</div>
|
||||
{eq.warrantyExpiry && (
|
||||
<div className="text-sm text-gray-500">
|
||||
Garanti: {dayjs(eq.warrantyExpiry).format('DD.MM.YYYY')}
|
||||
Garanti: {currentLocalDate(eq.warrantyExpiry, currentLocale || 'tr')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ import {
|
|||
import { WorkOrderStatusEnum } from '../../../types/pm'
|
||||
import { Container } from '@/components/shared'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
const ProductionOrderList: React.FC = () => {
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
|
|
@ -49,6 +51,7 @@ const ProductionOrderList: React.FC = () => {
|
|||
const [filterMaterial, setFilterMaterial] = useState('')
|
||||
const [filterOrderNumber, setFilterOrderNumber] = useState('')
|
||||
const [filterCustomer, setFilterCustomer] = useState('')
|
||||
const currentLocale = useLocale()
|
||||
|
||||
// Modal states
|
||||
const [showCreateModal, setShowCreateModal] = useState(false)
|
||||
|
|
@ -881,14 +884,14 @@ const ProductionOrderList: React.FC = () => {
|
|||
<div className="space-y-1">
|
||||
<div className="flex items-center text-sm text-gray-900">
|
||||
<FaCalendar size={14} className="mr-1" />
|
||||
{dayjs(order.plannedStartDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(order.plannedStartDate, currentLocale || 'tr')}
|
||||
</div>
|
||||
<div className="text-sm text-gray-500">
|
||||
Bitiş: {dayjs(order.plannedEndDate).format('DD.MM.YYYY')}
|
||||
Bitiş: {currentLocalDate(order.plannedEndDate, currentLocale || 'tr')}
|
||||
</div>
|
||||
{order.actualStartDate && (
|
||||
<div className="text-xs text-blue-600">
|
||||
Başladı: {dayjs(order.actualStartDate).format('DD.MM.YYYY')}
|
||||
Başladı: {currentLocalDate(order.actualStartDate, currentLocale || 'tr')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ import { Container } from '@/components/shared'
|
|||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import { mockCurrencies } from '@/mocks/mockCurrencies'
|
||||
import { EmployeeDto } from '@/proxy/intranet/models'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
// Custom styles for the slider
|
||||
const sliderStyles = `
|
||||
|
|
@ -109,6 +111,7 @@ const ProjectForm: React.FC = () => {
|
|||
const navigate = useNavigate()
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const isEdit = Boolean(id)
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [saving, setSaving] = useState(false)
|
||||
|
|
@ -707,8 +710,8 @@ const ProjectForm: React.FC = () => {
|
|||
</div>
|
||||
<h3 className="text-sm font-medium text-gray-600 mb-1">Süre (Gün)</h3>
|
||||
<div className="text-xs text-gray-500">
|
||||
{dayjs(formData.startDate).format('DD.MM.YYYY')} -{' '}
|
||||
{dayjs(formData.endDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(formData.startDate, currentLocale || 'tr')} -{' '}
|
||||
{currentLocalDate(formData.endDate, currentLocale || 'tr')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -1419,9 +1422,9 @@ const ProjectForm: React.FC = () => {
|
|||
<p className="text-sm text-gray-600 mb-1.5">{phase.description}</p>
|
||||
<div className="flex items-center space-x-4 text-xs text-gray-500">
|
||||
<span>
|
||||
Başlangıç: {dayjs(phase.startDate).format('DD.MM.YYYY')}
|
||||
Başlangıç: {currentLocalDate(phase.startDate, currentLocale || 'tr')}
|
||||
</span>
|
||||
<span>Bitiş: {dayjs(phase.endDate).format('DD.MM.YYYY')}</span>
|
||||
<span>Bitiş: {currentLocalDate(phase.endDate, currentLocale || 'tr')}</span>
|
||||
<span>Bütçe: ₺{phase.budget.toLocaleString()}</span>
|
||||
<span>İlerleme: %{phase.progress}</span>
|
||||
</div>
|
||||
|
|
@ -1581,7 +1584,7 @@ const ProjectForm: React.FC = () => {
|
|||
<div className="flex items-center space-x-3 text-xs text-gray-500 mt-1">
|
||||
<span>{doc.documentType}</span>
|
||||
<span>{doc.fileSize} MB</span>
|
||||
<span>{dayjs(doc.uploadedAt).format('DD.MM.YYYY')}</span>
|
||||
<span>{currentLocalDate(new Date(doc.uploadedAt), currentLocale || 'tr')}</span>
|
||||
<span>Yükleyen: {doc.uploadedBy}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ import {
|
|||
} from '../../../utils/erp'
|
||||
import { Container } from '@/components/shared'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
const ProjectList: React.FC = () => {
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
|
|
@ -44,6 +46,7 @@ const ProjectList: React.FC = () => {
|
|||
const [filterPriority, setFilterPriority] = useState('all')
|
||||
const [showFilters, setShowFilters] = useState(false)
|
||||
const [viewMode, setViewMode] = useState<'card' | 'list'>('list')
|
||||
const currentLocale = useLocale()
|
||||
|
||||
// Modal states
|
||||
const [phasesModalOpen, setPhasesModalOpen] = useState(false)
|
||||
|
|
@ -365,10 +368,10 @@ const ProjectList: React.FC = () => {
|
|||
<div className="space-y-1">
|
||||
<div className="flex items-center text-sm text-gray-900">
|
||||
<FaCalendar size={14} className="mr-1" />
|
||||
{dayjs(project.startDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(project.startDate), currentLocale || 'tr')}
|
||||
</div>
|
||||
<div className="text-sm text-gray-500">
|
||||
Bitiş: {dayjs(project.endDate).format('DD.MM.YYYY')}
|
||||
Bitiş: {currentLocalDate(new Date(project.endDate), currentLocale || 'tr')}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -547,13 +550,13 @@ const ProjectList: React.FC = () => {
|
|||
Başlangıç
|
||||
</span>
|
||||
<span className="font-medium">
|
||||
{dayjs(project.startDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(project.startDate), currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<span className="text-gray-500">Bitiş</span>
|
||||
<span className="font-medium">
|
||||
{dayjs(project.endDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(project.endDate), currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -36,11 +36,14 @@ import {
|
|||
} from '../../../utils/erp'
|
||||
import { Container } from '@/components/shared'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
const ProjectView: React.FC = () => {
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const navigate = useNavigate()
|
||||
const [activeTab, setActiveTab] = useState('overview')
|
||||
const currentLocale = useLocale()
|
||||
|
||||
// Find the project by ID
|
||||
const project = mockProjects.find((p) => p.id === id)
|
||||
|
|
@ -258,20 +261,20 @@ const ProjectView: React.FC = () => {
|
|||
<div className="flex justify-between items-center">
|
||||
<span className="text-gray-600">Başlangıç Tarihi:</span>
|
||||
<span className="font-medium text-gray-900">
|
||||
{dayjs(project.startDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(project.startDate), currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-gray-600">Bitiş Tarihi:</span>
|
||||
<span className="font-medium text-gray-900">
|
||||
{dayjs(project.endDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(project.endDate), currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-gray-600">Gerçek Başlangıç:</span>
|
||||
<span className="font-medium text-gray-900">
|
||||
{project.actualStartDate
|
||||
? dayjs(project.actualStartDate).format('DD.MM.YYYY')
|
||||
? currentLocalDate(new Date(project.actualStartDate), currentLocale || 'tr')
|
||||
: 'Henüz başlamadı'}
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -397,13 +400,13 @@ const ProjectView: React.FC = () => {
|
|||
<div>
|
||||
<p className="text-xs font-medium text-gray-700">Başlangıç</p>
|
||||
<p className="text-xs text-gray-600">
|
||||
{dayjs(phase.startDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(phase.startDate), currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs font-medium text-gray-700">Bitiş</p>
|
||||
<p className="text-xs text-gray-600">
|
||||
{dayjs(phase.endDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(phase.endDate), currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -508,13 +511,13 @@ const ProjectView: React.FC = () => {
|
|||
<div>
|
||||
<p className="text-xs font-medium text-gray-700">Başlangıç</p>
|
||||
<p className="text-xs text-gray-600">
|
||||
{dayjs(task.startDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(task.startDate), currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs font-medium text-gray-700">Bitiş</p>
|
||||
<p className="text-xs text-gray-600">
|
||||
{dayjs(task.endDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(task.endDate), currentLocale || 'tr')}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -589,7 +592,7 @@ const ProjectView: React.FC = () => {
|
|||
<div className="flex items-center space-x-3 text-xs text-gray-500 mt-1">
|
||||
<span>{doc.documentType}</span>
|
||||
<span>{doc.fileSize} MB</span>
|
||||
<span>{dayjs(doc.uploadedAt).format('DD.MM.YYYY')}</span>
|
||||
<span>{currentLocalDate(new Date(doc.uploadedAt), currentLocale || 'tr')}</span>
|
||||
<span>Yükleyen: {doc.uploadedBy}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -651,7 +654,7 @@ const ProjectView: React.FC = () => {
|
|||
<div className="flex items-center space-x-3 text-xs text-gray-500">
|
||||
<span>Risk Kodu: {risk.riskCode}</span>
|
||||
<span>
|
||||
Tanımlama: {dayjs(risk.identifiedDate).format('DD.MM.YYYY')}
|
||||
Tanımlama: {currentLocalDate(new Date(risk.identifiedDate), currentLocale || 'tr')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,12 +29,15 @@ import {
|
|||
} from '../../../utils/erp'
|
||||
import { Container } from '@/components/shared'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import useLocale from '@/utils/hooks/useLocale'
|
||||
import { currentLocalDate } from '@/utils/dateUtils'
|
||||
|
||||
const PurchaseRequisitionList: React.FC = () => {
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
const [filterStatus, setFilterStatus] = useState('all')
|
||||
const [filterPriority, setFilterPriority] = useState('all')
|
||||
const [showFilters, setShowFilters] = useState(false)
|
||||
const currentLocale = useLocale()
|
||||
|
||||
const {
|
||||
data: requisitions,
|
||||
|
|
@ -325,10 +328,10 @@ const PurchaseRequisitionList: React.FC = () => {
|
|||
<div className="space-y-1">
|
||||
<div className="flex items-center text-sm text-gray-900">
|
||||
<FaCalendar size={14} className="mr-1" />
|
||||
{dayjs(requisition.requestDate).format('DD.MM.YYYY')}
|
||||
{currentLocalDate(new Date(requisition.requestDate), currentLocale || 'tr')}
|
||||
</div>
|
||||
<div className="text-sm text-gray-500">
|
||||
İhtiyaç: {dayjs(requisition.requiredDate).format('DD.MM.YYYY')}
|
||||
İhtiyaç: {currentLocalDate(new Date(requisition.requiredDate), currentLocale || 'tr')}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Reference in a new issue