[IMP] Remove inter module dependency (#274)

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
This commit is contained in:
Horilla
2024-08-05 14:22:44 +05:30
committed by GitHub
parent 746272d801
commit 2fee7c18bb
308 changed files with 12414 additions and 9577 deletions

View File

@@ -1,7 +1,7 @@
{% load static %}
{% load i18n %}
{% load attendancefilters %}
{% load horillafilters %}
<!DOCTYPE html>
<html>
{% get_current_language_bidi as LANGUAGE_BIDI %}
@@ -53,6 +53,7 @@
<div class="triple-spinner"></div>
</div> {% endcomment %}
{% comment %} </div> {% endcomment %}
<div hidden id="statiUrl" data-url='{% static "" %}'></div>
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<span class="logged-in" data-user-id="{{request.user.id}}"></span>
<div id="reloadMessages">
@@ -173,39 +174,41 @@
</a>
</div>
<div class="oh-navbar__systray">
<div id="attendance-activity-container">
{% if request.user.employee_get %}
{% if request.session.selected_company == "all" or request.user.employee_get.employee_work_info.company_id.id == request.session.selected_company|default:"-1"|add:"0" %}
{% if "attendance"|app_installed %}
<div id="attendance-activity-container">
{% if request.user.employee_get %}
{% if request.session.selected_company == "all" or request.user.employee_get.employee_work_info.company_id.id == request.session.selected_company|default:"-1"|add:"0" %}
<!-- "CHEKING WETHER ITS IS THE CURRENT EMPLOYEES COMPANY OR ALL COMPANY, THEN ONLY SHOWS THE CHECK-IN, CHECK-OUT BUTTON" -->
{% if request.user|is_clocked_in %}
<button class="oh-btn oh-btn--warning-outline mr-2" {% if enabled_timerunner %} onmouseenter="$(this).find('span').show();$(this).find('.time-runner').hide();" onmouseleave="$(this).find('span').hide();$(this).find('.time-runner').show();" {% endif %} hx-get="{% url 'clock-out' %}" hx-target='#attendance-activity-container' hx-swap='innerHTML'><ion-icon class="oh-navbar__clock-icon mr-2 text-warning" name="exit-outline"></ion-icon>
<span class="hr-Check-In-out-text" {% if enabled_timerunner %} style="display: none;" {% endif %}>{% trans "Check-Out" %}</span>
<div class="time-runner"></div>
</button>
<script>
run = 1
</script>
{% else %}
<button{% if enabled_timerunner %} onmouseenter="$(this).find('span').show();$(this).find('.at-work-seconds').hide();" onmouseleave="$(this).find('span').hide();$(this).find('.at-work-seconds').show();" {% endif %}
class="oh-btn oh-btn--success-outline mr-2" hx-get="{% url 'clock-in' %}" hx-target='#attendance-activity-container' hx-swap='innerHTML'
>
<ion-icon class="oh-navbar__clock-icon mr-2 text-success" name="enter-outline"></ion-icon>
<span class="hr-Check-In-out-text" {% if enabled_timerunner %} style="display: none;" {% endif %}>{% trans "Check-In" %}</span>
<div class="at-work-seconds"></div>
</button>
{% if enabled_timerunner %}
<script>
$(document).ready(function () {
$('.at-work-seconds').html(secondsToDuration({{request.user.employee_get.get_forecasted_at_work.forecasted_at_work_seconds}}))
});
run = 0
</script>
<!-- "CHEKING WETHER ITS IS THE CURRENT EMPLOYEES COMPANY OR ALL COMPANY, THEN ONLY SHOWS THE CHECK-IN, CHECK-OUT BUTTON" -->
{% if request.user|is_clocked_in %}
<button class="oh-btn oh-btn--warning-outline mr-2" {% if enabled_timerunner %} onmouseenter="$(this).find('span').show();$(this).find('.time-runner').hide();" onmouseleave="$(this).find('span').hide();$(this).find('.time-runner').show();" {% endif %} hx-get="{% url 'clock-out' %}" hx-target='#attendance-activity-container' hx-swap='innerHTML'><ion-icon class="oh-navbar__clock-icon mr-2 text-warning" name="exit-outline"></ion-icon>
<span class="hr-Check-In-out-text" {% if enabled_timerunner %} style="display: none;" {% endif %}>{% trans "Check-Out" %}</span>
<div class="time-runner"></div>
</button>
<script>
run = 1
</script>
{% else %}
<button{% if enabled_timerunner %} onmouseenter="$(this).find('span').show();$(this).find('.at-work-seconds').hide();" onmouseleave="$(this).find('span').hide();$(this).find('.at-work-seconds').show();" {% endif %}
class="oh-btn oh-btn--success-outline mr-2" hx-get="{% url 'clock-in' %}" hx-target='#attendance-activity-container' hx-swap='innerHTML'
>
<ion-icon class="oh-navbar__clock-icon mr-2 text-success" name="enter-outline"></ion-icon>
<span class="hr-Check-In-out-text" {% if enabled_timerunner %} style="display: none;" {% endif %}>{% trans "Check-In" %}</span>
<div class="at-work-seconds"></div>
</button>
{% if enabled_timerunner %}
<script>
$(document).ready(function () {
$('.at-work-seconds').html(secondsToDuration({{request.user.employee_get.get_forecasted_at_work.forecasted_at_work_seconds}}))
});
run = 0
</script>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
{% if request.user|any_permission:'base' or perms.attendance.view_attendancevalidationcondition %}
<div class="oh-navbar__action-icons" title="Settings">
<a href="/settings/general-settings" id="settingsMenu" class="oh-navbar__action-icons-link">
@@ -226,8 +229,8 @@
<li class="oh-dropdown__item">
<a href="{% url 'set_language' %}" class="oh-dropdown__link"
onclick="event.preventDefault(); document.getElementById('language-form-{{ language.0 }}').submit();">
<img src="/static/images/ui/{{ language.0 }}.png" class="oh-dropdown__lang-icon"/>{{ language.1 }}{% if language.0 == LANGUAGE_CODE %}
<ion-icon name="checkmark-circle-outline" style="
<img src="{% static 'images/ui/' %}{{ language.0 }}.png" class="oh-dropdown__lang-icon"/>{{ language.1 }}{% if language.0 == LANGUAGE_CODE %}
<ion-icon name="checkmark-circle-outline" style="
position: relative;
top: 3.3px;
color: green;
@@ -406,32 +409,34 @@
}
}
function getAssignedLeave(employeeElement) {
var employeeId=employeeElement.val()
$.ajax({
type: "get",
url: "{% url "get-assigned-leaves" %}",
data: { "employeeId": employeeId },
dataType: "json",
success: function (response) {
let rows = ""
for (let index = 0; index < response.length; index++) {
const element = response[index];
rows = rows + `<tr class="toggle-highlight"><td>${element.leave_type_id__name
}</td><td>${element.available_days}</td><td>${element.carryforward_days}</td></tr>`
}
$("#availableTableBody").html($(rows))
let newLeaves = ""
for (let index = 0; index < response.length; index++) {
const leave = response[index];
newLeaves = newLeaves + `<option value="${leave.leave_type_id__id
}">${leave.leave_type_id__name}</option>`
}
$('#id_leave_type_id').html(newLeaves)
removeHighlight()
}
});
}
{% if "leave"|app_installed %}
function getAssignedLeave(employeeElement) {
var employeeId=employeeElement.val()
$.ajax({
type: "get",
url: "{% url "get-assigned-leaves" %}",
data: { "employeeId": employeeId },
dataType: "json",
success: function (response) {
let rows = ""
for (let index = 0; index < response.length; index++) {
const element = response[index];
rows = rows + `<tr class="toggle-highlight"><td>${element.leave_type_id__name
}</td><td>${element.available_days}</td><td>${element.carryforward_days}</td></tr>`
}
$("#availableTableBody").html($(rows))
let newLeaves = ""
for (let index = 0; index < response.length; index++) {
const leave = response[index];
newLeaves = newLeaves + `<option value="${leave.leave_type_id__id
}">${leave.leave_type_id__name}</option>`
}
$('#id_leave_type_id').html(newLeaves)
removeHighlight()
}
});
}
{% endif %}
function removeHighlight() {
setTimeout(function() {
$(".toggle-highlight").removeClass("toggle-highlight")
@@ -441,7 +446,7 @@
$(document).on("htmx:beforeRequest", function (event, data) {
var response = event.detail.xhr.response;
var target = $(event.detail.elt.getAttribute("hx-target"));
var avoid_target = ["BiometricDeviceTestFormTarget","reloadMessages", "infinite"];
var avoid_target = ["BiometricDeviceTestFormTarget","reloadMessages"];
if (!target.closest("form").length && avoid_target.indexOf(target.attr("id")) === -1) {
target.html(`<div class="animated-background"></div>`);
}
@@ -487,7 +492,9 @@
<script src="{% static '/base/time_formatting.js' %}"></script>
<script src="{% static '/base/time_settings.js' %}"></script>
<script src="{% static '/base/date_formatting.js' %}"></script>
<script src="{% static 'attendance/actions.js' %}"></script>
{% if "attendance"|app_installed %}
<script src="{% static 'attendance/actions.js' %}"></script>
{% endif %}
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<script src="{% static '/build/js/sweetAlert.js' %}"></script>
@@ -539,18 +546,18 @@
</script>
<script>
function addToSelectedId(newIds,key="selectedInstances"){
function addToSelectedId(newIds){
ids = JSON.parse(
$(`#${key}`).attr("data-ids") || "[]"
$("#selectedInstances").attr("data-ids") || "[]"
);
ids = [...ids,...newIds.map(String)]
ids = Array.from(new Set(ids));
$(`#${key}`).attr("data-ids",JSON.stringify(ids))
$("#selectedInstances").attr("data-ids",JSON.stringify(ids))
}
function selectSelected(viewId,key="selectedInstances"){
function selectSelected(viewId){
ids = JSON.parse(
$(`#${key}`).attr("data-ids") || "[]"
$("#selectedInstances").attr("data-ids") || "[]"
);
$.each(ids, function (indexInArray, valueOfElement) {
$(`${viewId} .oh-sticky-table__tbody .list-table-row[value=${valueOfElement}]`).prop("checked",true).change()
@@ -560,7 +567,7 @@
) {
id = $(this).val()
ids = JSON.parse(
$(`#${key}`).attr("data-ids") || "[]"
$("#selectedInstances").attr("data-ids") || "[]"
);
ids = Array.from(new Set(ids));
let index = ids.indexOf(id);
@@ -571,12 +578,14 @@
ids.splice(index, 1);
}
}
$(`#${key}`).attr("data-ids", JSON.stringify(ids));
$("#selectedInstances").attr("data-ids", JSON.stringify(ids));
}
);
reloadSelectedCount($('#count_{{view_id|safe}}'));
}
function reloadSelectedCount(targetElement,key="selectedInstances") {
count = JSON.parse($(`#${key}`).attr("data-ids") || "[]").length
function reloadSelectedCount(targetElement) {
count = JSON.parse($("#selectedInstances").attr("data-ids") || "[]").length
id =targetElement.attr("id")
if (id) {
id =id.split("count_")[1]
@@ -593,16 +602,16 @@
}
}
function removeId(element,key="selectedInstances"){
function removeId(element){
id = element.val();
viewId = element.attr("data-view-id")
ids = JSON.parse($(`#${key}`).attr("data-ids") || "[]")
ids = JSON.parse($("#selectedInstances").attr("data-ids") || "[]")
let elementToRemove = 5;
if (ids[ids.length - 1] === id) {
ids.pop();
}
ids = JSON.stringify(ids)
$(`#${key}`).attr("data-ids", ids);
$("#selectedInstances").attr("data-ids", ids);
}
function getCookie(name) {