Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1 Enhancements #373

Merged
merged 7 commits into from
Mar 12, 2024
Merged
5 changes: 1 addition & 4 deletions client/src/components/AddUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<v-text-field v-model="address" label="Address" density="comfortable" :rules="addressRules"></v-text-field>
<v-text-field v-model="social_insurance_number" label="Social Insurance Number" type="number"
density="comfortable" :rules="socialInsuranceRules"></v-text-field>
density="comfortable"></v-text-field>
</v-col>
<v-col cols="6">
<v-text-field v-model="telegram_link" label="Telegram" density="comfortable"
Expand Down Expand Up @@ -83,14 +83,12 @@ import {
mobileRules,
jobRules,
addressRules,
socialInsuranceRules,
telegramRules,
requiredStringRules,
requiredRules
} from '@/utils'
import { formatDate } from '@/utils'
import { useAsyncState } from '@vueuse/core'
import { ApiClientBase } from '@/clients/api/base'

export default {
name: 'AddUser',
Expand Down Expand Up @@ -254,7 +252,6 @@ export default {
mobileRules,
jobRules,
addressRules,
socialInsuranceRules,
telegramRules,
requiredStringRules,
requiredRules,
Expand Down
4 changes: 1 addition & 3 deletions client/src/components/UpdateUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<v-text-field v-model="selectedUser.address" label="Address" density="comfortable"
:rules="addressRules"></v-text-field>
<v-text-field v-model="selectedUser.social_insurance_number" label="Social Insurance Number" type="number"
density="comfortable" :rules="socialInsuranceRules"></v-text-field>
density="comfortable"></v-text-field>
</v-col>
<v-col cols="6" v-if="selectedUser">
<v-text-field v-model="selectedUser.telegram_link" label="Telegram" density="comfortable"
Expand Down Expand Up @@ -110,7 +110,6 @@ import {
mobileRules,
jobRules,
addressRules,
socialInsuranceRules,
telegramRules,
requiredStringRules,
requiredRules,
Expand Down Expand Up @@ -282,7 +281,6 @@ export default {
addressRules,
supervisorPage,
supervisorCount,
socialInsuranceRules,
telegramRules,
requiredStringRules,
requiredRules,
Expand Down
6 changes: 4 additions & 2 deletions client/src/components/cards/birthdayCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
<span class="mx-2 font-weight-regular">{{ birthday.team ? birthday.team : '--' }}</span>
</v-col>
<v-col cols="4">
<b>Email :</b>
<span class="mx-2 font-weight-regular">{{ birthday.email }}</span>
<b>Telegram :</b>
<span class="mx-2 font-weight-regular">
<a class="text-primary text-decoration-none" target="_blank" :href="`https://t.me/${birthday.telegram_link.replace('@', '')}/`">{{ birthday.telegram_link }}</a>
</span>
</v-col>
</v-row>
</v-card>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/cards/holidayCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<p class="pa-5">
<b>{{ holiday.holiday_date }}</b> is a public holiday in
<b class="text-error">{{ holiday.location.country }}</b
>, 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 <b class="text-error">{{ holiday.location.country }}</b
>, will be closed on this date. Thank you!
</p>
Expand Down
12 changes: 6 additions & 6 deletions client/src/utils/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
7 changes: 3 additions & 4 deletions client/src/views/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
</v-card-title>

<v-card-text>
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.
</v-card-text>
<v-card-subtitle class="text-white"> Powered by CodeScalers Egypt. </v-card-subtitle>
</div>
Expand Down
18 changes: 18 additions & 0 deletions server/cshr/migrations/0005_alter_user_social_insurance_number.py
Original file line number Diff line number Diff line change
@@ -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),
),
]
2 changes: 1 addition & 1 deletion server/cshr/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions server/cshr/serializers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class Meta:
"job_title",
"user_certificates",
"is_active",
"telegram_link",
"location"
]

Expand Down
2 changes: 1 addition & 1 deletion server/cshr/services/office.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
5 changes: 4 additions & 1 deletion server/cshr/utils/vacation_balance_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading