diff --git a/lib/data/core/utils/date_formatter.dart b/lib/data/core/utils/date_formatter.dart index f4946e3c..7d653d50 100644 --- a/lib/data/core/utils/date_formatter.dart +++ b/lib/data/core/utils/date_formatter.dart @@ -97,10 +97,12 @@ class DateFormatter { String showAnniversaries({required DateTime dateTime,required String name, int? number}){ final today = DateTime.now().dateOnly; + final difference= dateTime.difference(today); + int yearDifference= (difference.inDays/365).floor(); if(dateTime.dateOnly.isAtSameMomentAs(today)){ - return _localization.present_birthday_text(name); + return _localization.present_anniversary_text(name, yearDifference); }else{ - return "${_localization.upcoming_birthday_text(name)} ${getDateRepresentation(dateTime)}🎉"; + return "${_localization.upcoming_anniversary_text(name, yearDifference)} ${getDateRepresentation(dateTime)}🎉"; } } diff --git a/lib/data/l10n/app_en.arb b/lib/data/l10n/app_en.arb index d679c438..0975b8a2 100644 --- a/lib/data/l10n/app_en.arb +++ b/lib/data/l10n/app_en.arb @@ -287,7 +287,7 @@ } } }, - "present_anniversary_text":"Congratulations on {years} with us {name}! Keep up the good work! ", + "present_anniversary_text":"Congratulations on {years} with us {name} 💐💐! Keep up the good work! ", "@present_anniversary_text":{ "placeholders":{ "name":{ diff --git a/lib/data/model/employee/employee.g.dart b/lib/data/model/employee/employee.g.dart index d5d9f78c..1212711b 100644 --- a/lib/data/model/employee/employee.g.dart +++ b/lib/data/model/employee/employee.g.dart @@ -10,8 +10,7 @@ Employee _$EmployeeFromJson(Map json) => Employee( uid: json['uid'] as String, name: json['name'] as String, email: json['email'] as String, - role: Role.admin, - //role: $enumDecode(_$RoleEnumMap, json['role']), + role: $enumDecode(_$RoleEnumMap, json['role']), employeeId: json['employee_id'] as String?, designation: json['designation'] as String?, phone: json['phone'] as String?, diff --git a/lib/ui/shared/events/model/event.dart b/lib/ui/shared/events/model/event.dart index 095683ab..dd662051 100644 --- a/lib/ui/shared/events/model/event.dart +++ b/lib/ui/shared/events/model/event.dart @@ -1,7 +1,11 @@ -class Event{ +import 'package:flutter/material.dart'; + +class Event { final String name; final String? imageUrl; - final DateTime dateTime; + DateTime dateTime; - Event({required this.name,required this.dateTime,this.imageUrl}); -} \ No newline at end of file + Event({required this.name, required this.dateTime, this.imageUrl}) { + dateTime = DateUtils.dateOnly(dateTime); + } +}