From 07b42bd4a313e885df1ff3e0be4329ee69cb0f43 Mon Sep 17 00:00:00 2001 From: Thunder Date: Tue, 12 Mar 2024 14:24:59 +0200 Subject: [PATCH] 1.1 Enhancements (#373) * Fix: make the social_insurance_number field optional. * Update: Replaced the Email in the birthday card with the telegram-handle * Enhancement: Fix typo in public holiday card * Enhancement: The login page description has been updated. * Fix: An issue in the get_office_by_id helper fixed. * Update: The vacation balance calculation is now calculated based on the user joining date, not the user created date. * Fix: make the social_insurance_number field optional. --- client/src/components/AddUser.vue | 5 +---- client/src/components/UpdateUser.vue | 4 +--- client/src/components/cards/birthdayCard.vue | 6 ++++-- client/src/components/cards/holidayCard.vue | 2 +- client/src/utils/validators.ts | 12 ++++++------ client/src/views/LoginView.vue | 7 +++---- .../0005_alter_user_social_insurance_number.py | 18 ++++++++++++++++++ server/cshr/models/users.py | 2 +- server/cshr/serializers/users.py | 1 + server/cshr/services/office.py | 2 +- server/cshr/utils/vacation_balance_helper.py | 5 ++++- 11 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 server/cshr/migrations/0005_alter_user_social_insurance_number.py diff --git a/client/src/components/AddUser.vue b/client/src/components/AddUser.vue index 3eca35540..dd3534f6a 100644 --- a/client/src/components/AddUser.vue +++ b/client/src/components/AddUser.vue @@ -14,7 +14,7 @@ + density="comfortable"> + density="comfortable"> {{ birthday.team ? birthday.team : '--' }} - Email : - {{ birthday.email }} + Telegram : + + {{ birthday.telegram_link }} + diff --git a/client/src/components/cards/holidayCard.vue b/client/src/components/cards/holidayCard.vue index b67a90c43..4681709bf 100644 --- a/client/src/components/cards/holidayCard.vue +++ b/client/src/components/cards/holidayCard.vue @@ -13,7 +13,7 @@

{{ holiday.holiday_date }} is a public holiday in {{ holiday.location.country }}, We hope you and your familys have a peaceful and enjoyable holiday. Please be aware + >, We hope you and your families have a peaceful and enjoyable holiday. Please be aware that our office in {{ holiday.location.country }}, will be closed on this date. Thank you!

diff --git a/client/src/utils/validators.ts b/client/src/utils/validators.ts index 1162d871c..2e9bf0b24 100644 --- a/client/src/utils/validators.ts +++ b/client/src/utils/validators.ts @@ -38,12 +38,12 @@ export const addressRules = [ (v: string) => (v && v.length >= 3 && v.length <= 50) || 'Address must be between 3 and 50 characters.' ] -export const socialInsuranceRules = [ - (v: string) => typeof v === 'string' || 'Social Number must be a string.', - (v: string) => !!v || 'Social Number is required.', - (v: string) => - (v && v.length >= 3 && v.length <= 50) || 'Social Number must be between 3 and 50 characters.' -] +// export const socialInsuranceRules = [ +// (v: string) => typeof v === 'string' || 'Social Number must be a string.', +// (v: string) => !!v || 'Social Number is required.', +// (v: string) => +// (v && v.length >= 3 && v.length <= 50) || 'Social Number must be between 3 and 50 characters.' +// ] export const telegramRules = [ (v: string) => typeof v === 'string' || 'Telegram must be a string.', (v: string) => !!v || 'Telegram is required.', diff --git a/client/src/views/LoginView.vue b/client/src/views/LoginView.vue index 9d66511c2..a6d3e20a7 100644 --- a/client/src/views/LoginView.vue +++ b/client/src/views/LoginView.vue @@ -10,10 +10,9 @@ - A versatile management system with vacation request submissions and seamless - integration with a global calendar. Users across offices can collectively view - approved Vacations, Birthdates, Events, Meetings, and Holidays, providing a - centralized overview for the entire organization. + Our internal HR system manages all team requests across offices. + For the first version, + will manage vacation requests, Birthdays, events, meetings, and public holidays so anyone in the team can have a collective overview of the entire organization calendar. Powered by CodeScalers Egypt. diff --git a/server/cshr/migrations/0005_alter_user_social_insurance_number.py b/server/cshr/migrations/0005_alter_user_social_insurance_number.py new file mode 100644 index 000000000..cdffb1ceb --- /dev/null +++ b/server/cshr/migrations/0005_alter_user_social_insurance_number.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.9 on 2024-03-12 11:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("cshr", "0004_remove_vacationbalance_actual_balance_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="user", + name="social_insurance_number", + field=models.CharField(blank=True, max_length=45, null=True), + ), + ] diff --git a/server/cshr/models/users.py b/server/cshr/models/users.py index 56d5529f6..c8ccdedc8 100644 --- a/server/cshr/models/users.py +++ b/server/cshr/models/users.py @@ -101,7 +101,7 @@ class User(AbstractBaseUser, TimeStamp): skills = models.ManyToManyField(UserSkills, related_name="skills", blank=True) user_type = models.CharField(max_length=20, choices=USER_TYPE.choices) gender = models.CharField(max_length=20, choices=GENDER_TYPE.choices) - social_insurance_number = models.CharField(max_length=45) + social_insurance_number = models.CharField(max_length=45, null=True, blank=True) address = models.CharField(max_length=150) job_title = models.CharField(max_length=150) USERNAME_FIELD = "email" diff --git a/server/cshr/serializers/users.py b/server/cshr/serializers/users.py index ba87718c5..0b099db65 100644 --- a/server/cshr/serializers/users.py +++ b/server/cshr/serializers/users.py @@ -332,6 +332,7 @@ class Meta: "job_title", "user_certificates", "is_active", + "telegram_link", "location" ] diff --git a/server/cshr/services/office.py b/server/cshr/services/office.py index 90781cba5..4096b3c6f 100644 --- a/server/cshr/services/office.py +++ b/server/cshr/services/office.py @@ -8,7 +8,7 @@ def get_office_by_id(id: str) -> Office: - if not id.isdigit(): + if not str(id).isdigit(): return None try: return Office.objects.get(id=int(id)) diff --git a/server/cshr/utils/vacation_balance_helper.py b/server/cshr/utils/vacation_balance_helper.py index 30e741998..cf2468738 100644 --- a/server/cshr/utils/vacation_balance_helper.py +++ b/server/cshr/utils/vacation_balance_helper.py @@ -34,7 +34,10 @@ def create_new_balance(self): if self.user is None or self.user.location.id is None: return None - month: int = 12 - self.user.created_at.month + month: int = 12 + if self.user.joining_at.month > 1: + month: int = 12 - self.user.joining_at.month + office_balance = OfficeVacationBalance.objects.get_or_create( year=datetime.datetime.now().year, location=self.user.location )[0]