first comit

This commit is contained in:
2024-02-23 10:30:02 +00:00
commit ddeb07d0ba
12482 changed files with 1857507 additions and 0 deletions

1
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1 @@
{}

0
accounts/__init__.py Executable file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
accounts/admin.py Executable file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
accounts/apps.py Executable file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class AccountsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'accounts'

94
accounts/forms.py Normal file
View File

@@ -0,0 +1,94 @@
from django import forms
from django.core.exceptions import ValidationError
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, UsernameField, PasswordResetForm, SetPasswordForm, UserChangeForm
from django.utils.translation import gettext_lazy as _
from django.conf import settings
class RegistrationForm(UserCreationForm):
def validate_email_domain(email):
for domain in settings.ALLOWED_EMAIL_DOMAINS:
#if "@rawcut.tv" in email or "@tomos.tv" in email or "@themainframe.co.uk" in email:
if domain in email:
break
else:
raise ValidationError(
_('%(email)s - %(domain)s not allowed'),
params={'email': email, 'domain':domain},
)
password1 = forms.CharField(
label=_("Password"),
widget=forms.PasswordInput(attrs={'class': 'form-control form-control-user', 'placeholder': 'Password'}),
)
password2 = forms.CharField(
label=_("Confirm Password"),
widget=forms.PasswordInput(attrs={
'class': 'form-control form-control-user', 'placeholder': 'Confirm Password'
}),
)
username= forms.CharField(
widget=forms.TextInput(attrs={
'class': 'form-control form-control-user',
'placeholder': 'Username'
}),
)
email= forms.EmailField(required=True, validators=[validate_email_domain],
widget=forms.EmailInput(attrs={
'class': 'form-control form-control-user',
'placeholder': 'Email',
'name': 'email'
})
)
def save(self, commit=True):
user = super(RegistrationForm, self).save(commit=False)
user.email = self.cleaned_data['email']
if commit:
user.save()
return user
def delete(self):
user = super(RegistrationForm, self).save(commit=False)
user.delete()
return 'User deleted'
class LoginForm(AuthenticationForm):
username = forms.EmailField(widget=forms.EmailInput(attrs={
'class': 'form-control form-control-user',
'placeholder': 'Email',
"autocomplete": "email"
}))
password = forms.CharField(
label=_("Your Password"),
strip=False,
widget=forms.PasswordInput(attrs={
"class": "form-control form-control-user",
"placeholder": "Password",
"autocomplete":"current-password"
}))
class UserPasswordResetForm(PasswordResetForm):
email = forms.EmailField(widget=forms.EmailInput(attrs={
'class': 'form-control form-control-user',
'placeholder': 'Email'
}))
class UserSetPasswordForm(SetPasswordForm):
new_password1 = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
'class': 'form-control form-control-user', 'placeholder': 'New Password'
}), label="New Password")
new_password2 = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
'class': 'form-control form-control-user', 'placeholder': 'Confirm New Password'
}), label="Confirm New Password")
class UserPasswordChangeForm(PasswordChangeForm):
old_password = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
'class': 'form-control form-control-user', 'placeholder': 'Old Password'
}), label='Old Password')
new_password1 = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
'class': 'form-control form-control-user', 'placeholder': 'New Password'
}), label="New Password")
new_password2 = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
'class': 'form-control form-control-user', 'placeholder': 'Confirm New Password'
}), label="Confirm New Password")

20
accounts/middleware.py Normal file
View File

@@ -0,0 +1,20 @@
from django.shortcuts import redirect
from hrm.models import employee
class permissionEnforceMiddleware():
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
if request.path.startswith('/manager'):
user = employee.objects.get(employee__id=request.user.id)
groups = user.groups.all()
for group in groups:
adminGroups = ['manager', 'hr', 'smt']
if any(grp in group.name.lower() for grp in adminGroups):
response = self.get_response(request)
return response
return redirect('403')
else:
response = self.get_response(request)
return response

View File

3
accounts/models.py Executable file
View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
accounts/tests.py Executable file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

13
accounts/urls.py Normal file
View File

@@ -0,0 +1,13 @@
from django.urls import path
from accounts import views
app_name = 'accounts'
urlpatterns = [
#path('', views.index, name='index'),
path('sign_in', views.sign_in, name='sign_in'),
path('sign_up', views.sign_up, name='sign_up'),
path('user_sign_up', views.user_sign_up, name='user_sign_up'),
path('logout', views.logout_view, name='logout'),
]

63
accounts/views.py Executable file
View File

@@ -0,0 +1,63 @@
from django.shortcuts import render, redirect
from django.urls import reverse
from accounts.forms import *
import json
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.contrib.auth.hashers import make_password
from django.contrib.auth import logout,login,authenticate
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
from django.conf import settings
from custom_user.models import User
def create_session(request, username):
print("logging in")
print(username)
user=User.objects.get(email=username)
login(request, user)
return HttpResponseRedirect(reverse('index'))
def logout_view(request):
logout(request)
return redirect(reverse('accounts:sign_in'))
def sign_in(request):
if request.method == 'POST':
form = LoginForm(request, data=request.POST)
context={'form':form, 'invalid': True}
if form.is_valid():
username=form.cleaned_data.get('username')
password=form.cleaned_data.get('password')
user=authenticate(username=username,password=password)
if user:
return create_session(request,user.email)
else:
print(f"form is invalid, {form.errors}")
return render(request, 'sign-in.html', {'form': LoginForm})
def sign_up(request):
if request.user.is_authenticated:
return redirect(reverse('index'))
return render(request, 'sign-up.html', {'form': LoginForm})
def user_sign_up(request):
if request.method == 'POST':
data = json.loads(request.POST.get('data', ''))
try:
validate_email(data['email'])
except ValidationError as e:
print("bad email, details:", e)
message = 'Email Validation error'
messageTitle = 'Error!'
messageStatus = 'text-bg-danger'
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response
password = make_password(data['password'])
user = User.objects.create(email = data['email'], password=password)
login(request, user)
return JsonResponse({'no_errors':True})
else:
return render(request, 'sign-up.html', {'form': LoginForm})

0
api/__init__.py Executable file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
api/admin.py Executable file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
api/apps.py Executable file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class ApiConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'api'

0
api/migrations/__init__.py Executable file
View File

3
api/models.py Executable file
View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
api/tests.py Executable file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

13
api/urls.py Normal file
View File

@@ -0,0 +1,13 @@
from django.contrib import admin
from django.urls import path, include
from api import views
app_name="api"
urlpatterns = [
path("get_existing_holidays", views.get_existing_holidays, name="get_existing_holidays"),
path('toggle_link', views.toggle_link, name='toggle_link'),
path('get_links', views.get_links, name='get_links'),
path('add_homepage_link', views.add_homepage_link, name='add_homepage_link'),
path('delete_link', views.delete_link, name='delete_link'),
]

123
api/views.py Executable file
View File

@@ -0,0 +1,123 @@
from django.shortcuts import render
from django.template.loader import render_to_string
from django.http import HttpResponse, StreamingHttpResponse, JsonResponse
from django.core.mail import EmailMessage
from django.conf import settings
import logging
import json
from hrm.models import *
logger = logging.getLogger(__name__)
def sendMail(subject, message, to_email, employee, absence_days, file):
logger.info('Sending Mail')
subject = subject
emailMessage = render_to_string('email/email_base.html', {'title': subject, 'message': message, 'employee': employee, "absence_days": absence_days})
from_mail = settings.DEFAULT_FROM_EMAIL
msg = EmailMessage(subject, emailMessage, from_mail, [to_email])
if file:
if type(file) == list:
for f in file:
msg.attach_file(f)
else:
msg.attach_file(file)
msg.content_subtype='html'
msg.send()
def get_existing_holidays(request):
try:
employee_id = request.GET.get('employee_id')
emp = employee.objects.get(id=employee_id)
dept_emp = employee.objects.filter(department__name=emp.department)
existing = []
for e in dept_emp:
ext = absence_days.objects.filter(taken_by=e)
for ex in ext:
name = f"{ex.taken_by.employee.first_name} {ex.taken_by.employee.last_name}"
existing.append({"title": name, "start": str(ex.date_from), "end":str(ex.date_to)})
response = JsonResponse(existing, safe=False)
return response
except Exception as e:
logger.error(repr(e))
messageTitle = "Oops!"
messageStatus = 'text-bg-danger'
message = str(repr(e))
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response
def toggle_link(request):
try:
data = json.loads(request.POST.get('data', ''))
print(f"link_id={data['link_id']}")
link = homepage_links.objects.get(id=data['link_id'])
if data['checked'] == True:
link.enabled=True
elif data['checked'] == False:
link.enabled=False
link.save()
messageTitle = "Success"
messageStatus = 'text-bg-success'
message = f"{link.name} has been toggled"
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response
except Exception as e:
logger.error(repr(e))
messageTitle = "Oops!"
messageStatus = 'text-bg-danger'
message = str(repr(e))
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response
def get_links(request):
try:
links=[]
for link in homepage_links.objects.all():
links.append({'id': link.id, 'name': link.name, 'link': link.link, 'enabled': link.enabled})
response = JsonResponse({'links':links})
return response
except Exception as e:
logger.error(repr(e))
messageTitle = "Oops!"
messageStatus = 'text-bg-danger'
message = str(repr(e))
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response
def add_homepage_link(request):
try:
data = json.loads(request.POST.get('data', ''))
link = homepage_links.objects.create(
name=data['name'],
link=data['link'],
enabled=data['enabled']
)
messageTitle = "Success"
messageStatus = 'text-bg-success'
message = f"{link.name} has been created"
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response
except Exception as e:
logger.error(repr(e))
messageTitle = "Oops!"
messageStatus = 'text-bg-danger'
message = str(repr(e))
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response
def delete_link(request):
try:
data = json.loads(request.POST.get('data', ''))
link = homepage_links.objects.get(id = data['link_id'])
link.delete()
messageTitle = "Success"
messageStatus = 'text-bg-warning'
message = f"{link.name} has been deleted"
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response
except Exception as e:
logger.error(repr(e))
messageTitle = "Oops!"
messageStatus = 'text-bg-danger'
message = str(repr(e))
response = JsonResponse({'messageTitle':messageTitle, 'message': message, 'messageStatus':messageStatus})
return response

0
custom_user/__init__.py Executable file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

6
custom_user/admin.py Executable file
View File

@@ -0,0 +1,6 @@
from django.contrib import admin
from django_use_email_as_username.admin import BaseUserAdmin
from .models import User
admin.site.register(User, BaseUserAdmin)

6
custom_user/apps.py Executable file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class CustomUserConfig(AppConfig):
name = 'custom_user'
verbose_name = 'Custom User Management'

View File

@@ -0,0 +1,40 @@
# Generated by Django 5.0.2 on 2024-02-19 17:31
import django.utils.timezone
import django_use_email_as_username.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
],
options={
'abstract': False,
},
managers=[
('objects', django_use_email_as_username.models.BaseUserManager()),
],
),
]

View File

5
custom_user/models.py Executable file
View File

@@ -0,0 +1,5 @@
from django_use_email_as_username.models import BaseUser, BaseUserManager
class User(BaseUser):
objects = BaseUserManager()

BIN
db.sqlite3 Normal file

Binary file not shown.

0
hrm/__init__.py Executable file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

22
hrm/admin.py Executable file
View File

@@ -0,0 +1,22 @@
from django.contrib import admin
# Register your models here.
from hrm.models import *
class employeeAdmin(admin.ModelAdmin):
list_display = ['employee', 'job_title', 'department', 'company']
class departmentAdmin(admin.ModelAdmin):
list_display = ['name', 'manager']
class companyAdmin(admin.ModelAdmin):
list_display = ['name']
class absenceAdmin(admin.ModelAdmin):
list_display = ['days_taken', 'date_from', 'date_to']
admin.site.register(employee, employeeAdmin)
admin.site.register(department, departmentAdmin)
admin.site.register(company,companyAdmin)
admin.site.register(absence_days, absenceAdmin)
admin.site.register(homepage_links)

6
hrm/apps.py Executable file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class HrmConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'hrm'

View File

@@ -0,0 +1,65 @@
# Generated by Django 5.0.2 on 2024-02-19 15:39
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='pay_structure',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=300, null=True)),
('rate', models.CharField(blank=True, max_length=300, null=True)),
],
),
migrations.CreateModel(
name='department',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=300, null=True)),
('manager', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='manager', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='employee',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('preferred_name', models.CharField(blank=True, max_length=150, null=True)),
('job_title', models.CharField(blank=True, max_length=100, null=True)),
('contact_number', models.CharField(blank=True, max_length=15, null=True)),
('address_street', models.CharField(blank=True, max_length=300, null=True)),
('address_city', models.CharField(blank=True, max_length=300, null=True)),
('address_country', models.CharField(blank=True, default='United Kingdom', max_length=300, null=True)),
('address_postcode', models.CharField(blank=True, max_length=300, null=True)),
('emergency_contact_name', models.CharField(blank=True, max_length=300, null=True)),
('emergency_contact_relationship', models.CharField(blank=True, max_length=300, null=True)),
('emergency_contact_address_street', models.CharField(blank=True, max_length=300, null=True)),
('emergency_contact_address_city', models.CharField(blank=True, max_length=300, null=True)),
('emergency_contact_address_country', models.CharField(blank=True, default='United Kingdom', max_length=300, null=True)),
('emergency_contact_address_postcode', models.CharField(blank=True, max_length=300, null=True)),
('emergency_contact_phone_number', models.CharField(blank=True, max_length=15, null=True)),
('emergency_contact_alternative_number', models.CharField(blank=True, max_length=15, null=True)),
('holiday_days_allocated', models.IntegerField(default=28)),
('holiday_days_remaining', models.IntegerField(default=28)),
('salary', models.CharField(blank=True, max_length=100, null=True)),
('contract_start_date', models.DateField(auto_now_add=True)),
('contract_end_date', models.DateField(blank=True, null=True)),
('employee_company', models.CharField(blank=True, max_length=150, null=True)),
('employee_vat_number', models.CharField(blank=True, max_length=150, null=True)),
('department', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='department', to=settings.AUTH_USER_MODEL)),
('employee', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='employee', to=settings.AUTH_USER_MODEL)),
('line_manager', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='line_manager', to=settings.AUTH_USER_MODEL)),
('pay_structure', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='pay_structure', to='hrm.pay_structure')),
],
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 5.0.2 on 2024-02-19 15:41
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='employee',
name='department',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='department', to='hrm.department'),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-19 15:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0002_alter_employee_department'),
]
operations = [
migrations.AlterField(
model_name='pay_structure',
name='rate',
field=models.CharField(blank=True, choices=[('Once', 'One Off'), ('Day', 'Daily'), ('Week', 'Monthly'), ('Month', 'Monthly')], max_length=300, null=True),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-19 15:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0003_alter_pay_structure_rate'),
]
operations = [
migrations.AlterField(
model_name='employee',
name='contract_start_date',
field=models.DateField(blank=True, null=True),
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 5.0.2 on 2024-02-19 15:48
import jsignature.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hrm', '0004_alter_employee_contract_start_date'),
]
operations = [
migrations.AddField(
model_name='employee',
name='signature',
field=jsignature.fields.JSignatureField(blank=True, null=True),
),
]

View File

@@ -0,0 +1,26 @@
# Generated by Django 5.0.2 on 2024-02-19 18:17
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0005_employee_signature'),
]
operations = [
migrations.CreateModel(
name='company',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=300, null=True)),
],
),
migrations.AddField(
model_name='employee',
name='company',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='company', to='hrm.company'),
),
]

View File

@@ -0,0 +1,43 @@
# Generated by Django 5.0.2 on 2024-02-19 18:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0006_company_employee_company'),
]
operations = [
migrations.AddField(
model_name='company',
name='address_city',
field=models.CharField(blank=True, max_length=300, null=True),
),
migrations.AddField(
model_name='company',
name='address_country',
field=models.CharField(blank=True, default='United Kingdom', max_length=300, null=True),
),
migrations.AddField(
model_name='company',
name='address_postcode',
field=models.CharField(blank=True, max_length=300, null=True),
),
migrations.AddField(
model_name='company',
name='address_street',
field=models.CharField(blank=True, max_length=300, null=True),
),
migrations.AddField(
model_name='company',
name='contact_number',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AddField(
model_name='company',
name='vat_number',
field=models.CharField(blank=True, max_length=300, null=True),
),
]

View File

@@ -0,0 +1,22 @@
# Generated by Django 5.0.2 on 2024-02-21 10:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0007_company_address_city_company_address_country_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='company',
options={'verbose_name_plural': 'Companies'},
),
migrations.AddField(
model_name='employee',
name='email',
field=models.EmailField(blank=True, max_length=254, null=True),
),
]

View File

@@ -0,0 +1,26 @@
# Generated by Django 5.0.2 on 2024-02-21 13:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0008_alter_company_options_employee_email'),
]
operations = [
migrations.AlterField(
model_name='employee',
name='pay_structure',
field=models.CharField(blank=True, choices=[('Once', 'One Off'), ('Day', 'Daily'), ('Week', 'Monthly'), ('Month', 'Monthly'), ('Invoice', 'Invoice')], max_length=300, null=True),
),
migrations.AddField(
model_name='employee',
name='pay_rate',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.DeleteModel(
name='pay_structure',
),
]

View File

@@ -0,0 +1,24 @@
# Generated by Django 5.0.2 on 2024-02-21 14:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
('hrm', '0009_alter_employee_pay_structure_employee_pay_rate_and_more'),
]
operations = [
migrations.AddField(
model_name='employee',
name='groups',
field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='employee_set', related_query_name='employee', to='auth.group', verbose_name='groups'),
),
migrations.AlterField(
model_name='employee',
name='pay_structure',
field=models.CharField(blank=True, choices=[('Once', 'One Off'), ('Daily', 'Daily'), ('Weekly', 'Weekly'), ('Monthly', 'Monthly'), ('Invoice', 'Invoice')], max_length=300, null=True),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-21 18:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0010_employee_groups_alter_employee_pay_structure'),
]
operations = [
migrations.AddField(
model_name='employee',
name='sick_days_taken',
field=models.IntegerField(default=0),
),
]

View File

@@ -0,0 +1,31 @@
# Generated by Django 5.0.2 on 2024-02-21 18:14
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0011_employee_sick_days_taken'),
]
operations = [
migrations.RenameField(
model_name='employee',
old_name='sick_days_taken',
new_name='days_absent',
),
migrations.CreateModel(
name='absence_days',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('days_taken', models.IntegerField(default=0)),
('date_from', models.DateField(blank=True, null=True)),
('date_to', models.DateField(blank=True, null=True)),
('authorised', models.BooleanField(default=False)),
('authorised_by', models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='authorised_by', to='hrm.employee')),
('taken_by', models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='taken_by', to='hrm.employee')),
],
),
]

View File

@@ -0,0 +1,27 @@
# Generated by Django 5.0.2 on 2024-02-21 18:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0012_rename_sick_days_taken_employee_days_absent_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='absence_days',
options={'verbose_name_plural': 'Absence Days'},
),
migrations.RenameField(
model_name='employee',
old_name='days_absent',
new_name='days_absent_authorised',
),
migrations.AddField(
model_name='employee',
name='days_absent_unauthorised',
field=models.IntegerField(default=0),
),
]

View File

@@ -0,0 +1,31 @@
# Generated by Django 5.0.2 on 2024-02-21 18:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0013_alter_absence_days_options_and_more'),
]
operations = [
migrations.RemoveField(
model_name='absence_days',
name='authorised_by',
),
migrations.RemoveField(
model_name='absence_days',
name='taken_by',
),
migrations.AddField(
model_name='absence_days',
name='authorised_by',
field=models.ManyToManyField(blank=True, default=None, null=True, related_name='authorised_by', to='hrm.employee'),
),
migrations.AddField(
model_name='absence_days',
name='taken_by',
field=models.ManyToManyField(blank=True, default=None, null=True, related_name='taken_by', to='hrm.employee'),
),
]

View File

@@ -0,0 +1,32 @@
# Generated by Django 5.0.2 on 2024-02-21 18:34
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0014_remove_absence_days_authorised_by_and_more'),
]
operations = [
migrations.RemoveField(
model_name='absence_days',
name='authorised_by',
),
migrations.RemoveField(
model_name='absence_days',
name='taken_by',
),
migrations.AddField(
model_name='absence_days',
name='authorised_by',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='authorised_by', to='hrm.employee'),
),
migrations.AddField(
model_name='absence_days',
name='taken_by',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='taken_by', to='hrm.employee'),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-22 09:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0015_remove_absence_days_authorised_by_and_more'),
]
operations = [
migrations.AddField(
model_name='company',
name='departments',
field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='department_set', related_query_name='departments', to='hrm.department', verbose_name='departments'),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-22 10:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0016_company_departments'),
]
operations = [
migrations.AlterField(
model_name='company',
name='name',
field=models.CharField(blank=True, max_length=300, null=True, unique=True),
),
]

View File

@@ -0,0 +1,23 @@
# Generated by Django 5.0.2 on 2024-02-22 11:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0017_alter_company_name'),
]
operations = [
migrations.AddField(
model_name='absence_days',
name='is_holiday',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='absence_days',
name='is_request',
field=models.BooleanField(default=False),
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 5.0.2 on 2024-02-22 11:49
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0018_absence_days_is_holiday_absence_days_is_request_and_more'),
]
operations = [
migrations.AddField(
model_name='company',
name='year_start_date',
field=models.DateField(default=datetime.date(1971, 1, 1)),
),
]

View File

@@ -0,0 +1,22 @@
# Generated by Django 5.0.2 on 2024-02-22 11:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0019_company_year_start_date'),
]
operations = [
migrations.RemoveField(
model_name='absence_days',
name='is_holiday',
),
migrations.AddField(
model_name='absence_days',
name='reason',
field=models.CharField(blank=True, choices=[('hol', 'Holiday'), ('sick', 'Sick'), ('mat', 'Maternity'), ('pat', 'Paternity'), ('other', 'Other')], max_length=50, null=True),
),
]

View File

@@ -0,0 +1,21 @@
# Generated by Django 5.0.2 on 2024-02-22 15:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0020_remove_absence_days_is_holiday_absence_days_reason'),
]
operations = [
migrations.CreateModel(
name='homepage_links',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, default=None, help_text='This is the text that will appear on the homepage.', max_length=100, null=True)),
('link', models.URLField()),
],
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-22 15:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0021_homepage_links'),
]
operations = [
migrations.AddField(
model_name='homepage_links',
name='enabled',
field=models.BooleanField(default=False),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-22 15:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0022_homepage_links_enabled'),
]
operations = [
migrations.AlterField(
model_name='homepage_links',
name='link',
field=models.CharField(blank=True, max_length=200, null=True),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-22 18:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hrm', '0023_alter_homepage_links_link'),
]
operations = [
migrations.AlterField(
model_name='company',
name='departments',
field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='company_set', related_query_name='company', to='hrm.department', verbose_name='departments'),
),
]

0
hrm/migrations/__init__.py Executable file
View File

Some files were not shown because too many files have changed in this diff Show More