This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
"""
|
|
views.py
|
|
|
|
This module is used to map url patterns with request and approve methods in Dashboard.
|
|
"""
|
|
|
|
import json
|
|
|
|
from django.apps import apps
|
|
from django.core.paginator import Paginator
|
|
from django.db.models import Q
|
|
from django.shortcuts import render
|
|
|
|
from base.methods import filtersubordinates
|
|
from base.models import ShiftRequest, WorkTypeRequest
|
|
from horilla.decorators import login_required
|
|
|
|
|
|
def paginator_qry(qryset, page_number):
|
|
"""
|
|
This method is used to paginate query set
|
|
"""
|
|
paginator = Paginator(qryset, 10)
|
|
qryset = paginator.get_page(page_number)
|
|
return qryset
|
|
|
|
|
|
@login_required
|
|
def dashboard_shift_request(request):
|
|
requests = ShiftRequest.objects.filter(
|
|
approved=False, canceled=False, employee_id__is_active=True
|
|
)
|
|
requests = filtersubordinates(request, requests, "base.add_shiftrequest")
|
|
requests_ids = json.dumps([instance.id for instance in requests])
|
|
return render(
|
|
request,
|
|
"request_and_approve/shift_request.html",
|
|
{
|
|
"requests": requests,
|
|
"requests_ids": requests_ids,
|
|
},
|
|
)
|
|
|
|
|
|
@login_required
|
|
def dashboard_work_type_request(request):
|
|
requests = WorkTypeRequest.objects.filter(
|
|
approved=False, canceled=False, employee_id__is_active=True
|
|
)
|
|
requests = filtersubordinates(request, requests, "base.add_worktyperequest")
|
|
requests_ids = json.dumps([instance.id for instance in requests])
|
|
return render(
|
|
request,
|
|
"request_and_approve/work_type_request.html",
|
|
{
|
|
"requests": requests,
|
|
"requests_ids": requests_ids,
|
|
},
|
|
)
|