From f20a59e95115d959eff3ae21e4efabaa5729a7b6 Mon Sep 17 00:00:00 2001 From: Horilla Date: Wed, 29 Oct 2025 17:51:28 +0530 Subject: [PATCH 1/2] Dev/v2.0 (#962) * [FIX] BASE: Fixed the permissions in the settings page and updated the payroll permission * [FIX] DOCKER: Issue with creating migration file for auth user model * [FIX] EMPLOYEE : Document request view toggle issue fixes * [FIX] ATTENDANCE: Fixed union of distinct querysets in attendance request * [FIX] PAYROLL: Fixed reimbursement form excluded field issue * [UPDT] WHATSAPP: Updated flow json version * [UPDT] WHATSAPP: Updated meta_token from charfield to text field * [UPDT] WHATSAPP: Updated whatsapp credential view url to CBV template view * [FIX] WHATSAPP: Fixed issues in sending messages and added exception message if request failed * [UPDT] RECRUITMENT: Formatted recruitment view page * [UPDT] RECRUITMENT: Updated linkedin to check for integration enabled * [FIX] SETTINGS: Fixed outlook issue on settings page * [FIX] SETTINGS: Fixed outlook error in settings page * [RMV] GENERAL: Remove unwanted console log messages * [UPDT] HORILLA_THEME: Updated permission for ldap and Gmeet in settings page * [RMV] GENERAL: Remove unwanted console log messages * [UPDT] BASE: Index page updation * [UPDT] WHATSAPP: Add whatsapp app to the installed_apps list --- .../accessibility/accessibility.html | 4 - .../attendance/attendance_empty.html | 1 - .../attendance/attendance_view.html | 1 - .../requests/attendance/view-requests.html | 1 - attendance/views/requests.py | 19 +- .../shift_request_bulk_actions.js | 2 - .../work_request_bulk_action.js | 1 - base/templates/cbv/mail_log_tab/iframe.html | 2 - .../forms/update_inherit.html | 1 - base/views.py | 24 +- employee/templates/documents/requests.html | 21 +- horilla/horilla_apps.py | 1 + .../templates/base/auth/group_accordion.html | 1 - .../templates/generic/quick_actions.html | 1 - .../helpdesk/ticket/ticket_detail.html | 1 - .../templates/report/pms_report.html | 2 - horilla_theme/templates/settings.html | 46 ++-- .../linkedin/linkedin_setting_section.html | 66 +++++ horilla_theme/templates/tabs/note_tab.html | 2 +- .../cbv/leave_requests/leave_requests.js | 2 - .../cbv/employee_individual/leave_tab.html | 1 - .../detail_action.html | 5 +- .../leave_requests/leave_requests_home.html | 1 - .../leave/leave_request/request_view.html | 1 - .../onboarding_candidates.html | 1 - .../templates/onboarding/candidate_task.html | 1 - payroll/forms/component_forms.py | 4 +- pms/static/cbv/360_feedback.js | 1 - pms/static/src/dashboard/pmsChart.js | 1 - .../cbv/dashboard/current_value.html | 1 - .../okr/objective_detailed_view_activity.html | 2 - .../templates/task_all/task_all_overall.html | 1 - recruitment/cbv/recruitment_view.py | 16 +- recruitment/views/linkedin.py | 20 +- report/templates/report/pms_report.html | 2 - templates/settings.html | 4 + whatsapp/cbv/whatsapp.py | 41 ++- whatsapp/flows.py | 16 +- whatsapp/models.py | 2 +- .../templates/whatsapp/credentials_view.html | 77 +++--- .../templates/whatsapp/option_buttons.html | 7 +- whatsapp/urls.py | 13 +- whatsapp/utils.py | 223 +++++++++------- whatsapp/views.py | 238 ++++++++++++------ 44 files changed, 558 insertions(+), 320 deletions(-) create mode 100644 horilla_theme/templates/settings/linkedin/linkedin_setting_section.html diff --git a/accessibility/templates/accessibility/accessibility.html b/accessibility/templates/accessibility/accessibility.html index 7e7254cf6..5baaae1d5 100644 --- a/accessibility/templates/accessibility/accessibility.html +++ b/accessibility/templates/accessibility/accessibility.html @@ -85,12 +85,9 @@ $(this).closest('form').find('input[type=submit]').click(); value = $(this).is(':checked'); container = $('#{{accessibility}}formcontainer') - console.log(typeof value) if (value=='true') { container.hide(); }else{ - console.log('false'); - $(container).show(); } "> @@ -120,7 +117,6 @@ $.ajax({ url: "{% url 'get-initial-accessibility-data' %}?feature={{accessibility}}", success: function (response) { - console.log(response) for (let key in response) { if (response.hasOwnProperty(key)) { let values = response[key]; diff --git a/attendance/templates/attendance/attendance/attendance_empty.html b/attendance/templates/attendance/attendance/attendance_empty.html index c6a7f054a..1086dd6bc 100644 --- a/attendance/templates/attendance/attendance/attendance_empty.html +++ b/attendance/templates/attendance/attendance/attendance_empty.html @@ -134,7 +134,6 @@ // Batch title change function batchTitleChange(element) { - console.log(element) title = $(element).val() batchId = $(element).data('id') $('#updateTitleSpan').attr("hx-vals", `{"batch_id":"${batchId}","title":"${title}"}`) diff --git a/attendance/templates/attendance/attendance/attendance_view.html b/attendance/templates/attendance/attendance/attendance_view.html index 45d0f934c..9678c919f 100644 --- a/attendance/templates/attendance/attendance/attendance_view.html +++ b/attendance/templates/attendance/attendance/attendance_view.html @@ -96,7 +96,6 @@ // Batch title change function batchTitleChange(element){ - console.log(element) title = $(element).val() batchId = $(element).data('id') $('#updateTitleSpan').attr("hx-vals",`{"batch_id":"${batchId}","title":"${title}"}`) diff --git a/attendance/templates/requests/attendance/view-requests.html b/attendance/templates/requests/attendance/view-requests.html index 6beb9c756..6c25fae73 100644 --- a/attendance/templates/requests/attendance/view-requests.html +++ b/attendance/templates/requests/attendance/view-requests.html @@ -164,7 +164,6 @@ // Batch title change function batchTitleChange(element){ - console.log(element) title = $(element).val() batchId = $(element).data('id') $('#updateTitleSpan').attr("hx-vals",`{"batch_id":"${batchId}","title":"${title}"}`) diff --git a/attendance/views/requests.py b/attendance/views/requests.py index 8214866fe..3ad5b7b16 100644 --- a/attendance/views/requests.py +++ b/attendance/views/requests.py @@ -10,7 +10,7 @@ from datetime import date, datetime, time from urllib.parse import parse_qs from django.contrib import messages -from django.db.models import ProtectedError +from django.db.models import ProtectedError, Q from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.shortcuts import redirect, render from django.template.loader import render_to_string @@ -178,10 +178,12 @@ def request_new(request): else: form = NewRequestForm() form = choosesubordinates(request, form, "attendance.change_attendance") - form.fields["employee_id"].queryset = form.fields[ - "employee_id" - ].queryset | Employee.objects.filter(employee_user_id=request.user) + employees_qs = Employee.objects.filter( + Q(id__in=form.fields["employee_id"].queryset.values_list("id", flat=True)) + | Q(employee_user_id=request.user) + ) + form.fields["employee_id"].queryset = employees_qs.distinct() form.fields["employee_id"].initial = request.user.employee_get.id if request.GET.get("emp_id"): emp_id = request.GET.get("emp_id") @@ -189,10 +191,11 @@ def request_new(request): form.fields["employee_id"].initial = emp_id if request.method == "POST": form = NewRequestForm(request.POST) - form = choosesubordinates(request, form, "attendance.change_attendance") - form.fields["employee_id"].queryset = form.fields[ - "employee_id" - ].queryset | Employee.objects.filter(employee_user_id=request.user) + employees_qs = Employee.objects.filter( + Q(id__in=form.fields["employee_id"].queryset.values_list("id", flat=True)) + | Q(employee_user_id=request.user) + ) + form.fields["employee_id"].queryset = employees_qs.distinct() if form.is_valid(): if form.new_instance is not None: form.new_instance.save() diff --git a/base/static/cbv/shift_request/shift_request_bulk_actions.js b/base/static/cbv/shift_request/shift_request_bulk_actions.js index 5f88b1372..38faf0c6c 100644 --- a/base/static/cbv/shift_request/shift_request_bulk_actions.js +++ b/base/static/cbv/shift_request/shift_request_bulk_actions.js @@ -152,8 +152,6 @@ function shiftRequestDelete() { // addIdsTab("allocatedselectedInstances"); ids.push($("#selectedInstances").attr("data-ids")); ids = JSON.parse($("#selectedInstances").attr("data-ids")); - console.log(ids) - console.log('__________________________________________________________________________') if (ids.length === 0) { Swal.fire({ text: i18nMessages.noRowsSelected, diff --git a/base/static/cbv/work_type_request/work_request_bulk_action.js b/base/static/cbv/work_type_request/work_request_bulk_action.js index 4de74dad6..8a4c3b351 100644 --- a/base/static/cbv/work_type_request/work_request_bulk_action.js +++ b/base/static/cbv/work_type_request/work_request_bulk_action.js @@ -101,7 +101,6 @@ function handleRejectRequestsClick() { cancelButtonText: i18nMessages.cancel, }).then(function (result) { if (result.isConfirmed) { - console.log("hello") ids = []; ids.push($("#selectedInstances").attr("data-ids")); ids = JSON.parse($("#selectedInstances").attr("data-ids")); diff --git a/base/templates/cbv/mail_log_tab/iframe.html b/base/templates/cbv/mail_log_tab/iframe.html index 998f1d520..d809a3e15 100644 --- a/base/templates/cbv/mail_log_tab/iframe.html +++ b/base/templates/cbv/mail_log_tab/iframe.html @@ -41,8 +41,6 @@ var logBody = "{{ log.body|escapejs }}"; var trimmedBody = logBody.trim(); var hasContent = trimmedBody.length > 0; - console.log(hasContent) - if (hasContent) { content = '
' + logBody + '
'; diff --git a/base/templates/cbv/rotating_work_type/forms/update_inherit.html b/base/templates/cbv/rotating_work_type/forms/update_inherit.html index f807f85ca..06c150381 100644 --- a/base/templates/cbv/rotating_work_type/forms/update_inherit.html +++ b/base/templates/cbv/rotating_work_type/forms/update_inherit.html @@ -44,7 +44,6 @@ $('.oh-modal__close--custom').on('click', function() { - console.log('Close button clicked'); //location.reload(); // Function to reload the record diff --git a/base/views.py b/base/views.py index aa61e677c..a7c9a44df 100644 --- a/base/views.py +++ b/base/views.py @@ -964,25 +964,19 @@ def home(request): today_weekday = today.weekday() first_day_of_week = today - timedelta(days=today_weekday) last_day_of_week = first_day_of_week + timedelta(days=6) - total_employees = Employee.objects.filter(is_active=True).count() - current_employee = request.user.employee_get - employee_charts = DashboardEmployeeCharts.objects.filter( - employee=current_employee - ).first() + employee_charts = DashboardEmployeeCharts.objects.get_or_create( + employee=request.user.employee_get + )[0] - chart_list = [chart[0] for chart in check_chart_permission(request, CHARTS)] - - if employee_charts and employee_charts.charts is not None: - chart_list = employee_charts.charts - - today = timezone.now().date() + user = request.user + today = timezone.now().date() # Get today's date is_birthday = None - if current_employee.dob != None: + if user.employee_get.dob != None: is_birthday = ( - current_employee.dob.month == today.month - and current_employee.dob.day == today.day + user.employee_get.dob.month == today.month + and user.employee_get.dob.day == today.day ) show_section = any( @@ -1008,7 +1002,7 @@ def home(request): context = { "first_day_of_week": first_day_of_week.strftime("%Y-%m-%d"), "last_day_of_week": last_day_of_week.strftime("%Y-%m-%d"), - "charts": chart_list, + "charts": employee_charts.charts, "is_birthday": is_birthday, "total_employees": total_employees, "show_section": show_section, diff --git a/employee/templates/documents/requests.html b/employee/templates/documents/requests.html index 0d2ff8051..861b8aac3 100644 --- a/employee/templates/documents/requests.html +++ b/employee/templates/documents/requests.html @@ -307,8 +307,25 @@ {% endif %} diff --git a/horilla/horilla_apps.py b/horilla/horilla_apps.py index cb5ab9b9c..ef9c9b48c 100644 --- a/horilla/horilla_apps.py +++ b/horilla/horilla_apps.py @@ -24,6 +24,7 @@ INSTALLED_APPS.append("horilla_backup") INSTALLED_APPS.append("project") INSTALLED_APPS.append("horilla_meet") INSTALLED_APPS.append("report") +INSTALLED_APPS.append("whatsapp") if settings.env("AWS_ACCESS_KEY_ID", default=None) and "storages" not in INSTALLED_APPS: INSTALLED_APPS.append("storages") diff --git a/horilla_theme/templates/base/auth/group_accordion.html b/horilla_theme/templates/base/auth/group_accordion.html index db66a2f25..6350ba166 100644 --- a/horilla_theme/templates/base/auth/group_accordion.html +++ b/horilla_theme/templates/base/auth/group_accordion.html @@ -110,7 +110,6 @@ function updateGroupPermissions(elem) { var groupId = elem.attr("data-group-id"); - console.log(groupId) var name = elem.attr("data-group-name"); var permissions = []; var panel = $(`#groupPanel${groupId}`); // or use a container class/id that wraps your entire permission section diff --git a/horilla_theme/templates/generic/quick_actions.html b/horilla_theme/templates/generic/quick_actions.html index 7169646ba..6483eeef5 100644 --- a/horilla_theme/templates/generic/quick_actions.html +++ b/horilla_theme/templates/generic/quick_actions.html @@ -55,7 +55,6 @@ {% if filter_selected %} {% trans 'Filter' %} (0) diff --git a/horilla_theme/templates/helpdesk/ticket/ticket_detail.html b/horilla_theme/templates/helpdesk/ticket/ticket_detail.html index f66cd00cd..373278b23 100644 --- a/horilla_theme/templates/helpdesk/ticket/ticket_detail.html +++ b/horilla_theme/templates/helpdesk/ticket/ticket_detail.html @@ -660,7 +660,6 @@ function validateComment(event) { var comment = $(".comment-form [name='comment']").val().trim(); var fileInput = $(".comment-form [name='file']")[0]; - console.log(fileInput); var filesSelected = fileInput.files && fileInput.files.length > 0; if (comment === '' && !filesSelected) { diff --git a/horilla_theme/templates/report/pms_report.html b/horilla_theme/templates/report/pms_report.html index 58423bc4f..2a75bf144 100644 --- a/horilla_theme/templates/report/pms_report.html +++ b/horilla_theme/templates/report/pms_report.html @@ -301,8 +301,6 @@ $.getJSON(`pms-pivot?model=${selectedModel}&${formData}`, function (data) { - console.log("Filtered data:", data); - const plotlyRenderers = $.pivotUtilities.plotly_renderers; $("#" + containerId).pivotUI(data, { diff --git a/horilla_theme/templates/settings.html b/horilla_theme/templates/settings.html index f82c5fcff..cf1711af4 100644 --- a/horilla_theme/templates/settings.html +++ b/horilla_theme/templates/settings.html @@ -92,7 +92,7 @@ >{% trans "Mail Server" %} - {% else %} + {% elif perms.base.view_dynamicemailconfiguratio and "outlook_auth"|app_installed %}
  • {% endif %} - {% comment %} {% if "whatsapp"|app_installed %} {% endcomment %}
  • {% endif %} + + {% if recruitment.view_linkedinaccount %}
  • {% trans "Linkedin" %}
  • + {% endif %} {% if "horilla_ldap"|app_installed %} + {% if perms.horilla_ldap.add_ldapsettings or perms.horilla_ldap.update_ldapsettings %}
  • {% trans "LDAP" %}
  • + {% endif %} {% endif %} -
  • - {% trans "Google Meet" %} -
  • - - {% if perms.whatsapp.add_whatsappcredentials %} + {% if "horilla_meet"|app_installed %} + {% if perms.horilla_meet.view_googlecloudcredential %}
  • {% trans "Whatsapp" %}{% trans "Google Meet" %}
  • + {% endif %} + {% endif %} + + {% if "whatsapp"|app_installed %} + {% if perms.whatsapp.add_whatsappcredentials %} +
  • + {% trans "Whatsapp" %} +
  • + {% endif %} {% endif %} - {% comment %} {% endif %} {% endcomment %} diff --git a/horilla_theme/templates/settings/linkedin/linkedin_setting_section.html b/horilla_theme/templates/settings/linkedin/linkedin_setting_section.html new file mode 100644 index 000000000..89a8394c0 --- /dev/null +++ b/horilla_theme/templates/settings/linkedin/linkedin_setting_section.html @@ -0,0 +1,66 @@ +{% extends 'settings.html' %} +{% load i18n horillafilters %} +{% block settings %} + +
    +

    + {% trans "LinkedIn Integration" %} +

    +
    +
    +
    +
    +
    +

    + {% trans "Enable Linkedin" %} +

    + +
    + +
    +
    +
    +
    +
    + {% if "linkedin"|integration_installed %} + + + +
    +
    +
    + +
    +
    +
    + {% endif %} +
    +
    + +{% endblock %} diff --git a/horilla_theme/templates/tabs/note_tab.html b/horilla_theme/templates/tabs/note_tab.html index f3445ea80..0276a6cdc 100644 --- a/horilla_theme/templates/tabs/note_tab.html +++ b/horilla_theme/templates/tabs/note_tab.html @@ -138,7 +138,7 @@ {% else %}
    + id="commentForm"> {% csrf_token %}
    diff --git a/leave/static/cbv/leave_requests/leave_requests.js b/leave/static/cbv/leave_requests/leave_requests.js index def1080aa..f7a2e0331 100644 --- a/leave/static/cbv/leave_requests/leave_requests.js +++ b/leave/static/cbv/leave_requests/leave_requests.js @@ -110,9 +110,7 @@ function bulkApproveLeaveRequests() { cancelButtonText: i18nMessages.cancel, }).then(function (result) { if (result.isConfirmed) { - console.log("worked") var hxVals = JSON.stringify(ids); - console.log(hxVals) $("#bulkApproveSpan").attr("hx-vals", `{"ids":${hxVals}}`); $("#bulkApproveSpan").click(); } diff --git a/leave/templates/cbv/employee_individual/leave_tab.html b/leave/templates/cbv/employee_individual/leave_tab.html index 738595711..87a266461 100644 --- a/leave/templates/cbv/employee_individual/leave_tab.html +++ b/leave/templates/cbv/employee_individual/leave_tab.html @@ -323,7 +323,6 @@ window.location.href = event.target.href; } else{ - console.log(target) console.log(event.target.href) } } else { diff --git a/leave/templates/cbv/leave_allocation_request/detail_action.html b/leave/templates/cbv/leave_allocation_request/detail_action.html index 6e04c2910..0e3216642 100644 --- a/leave/templates/cbv/leave_allocation_request/detail_action.html +++ b/leave/templates/cbv/leave_allocation_request/detail_action.html @@ -40,9 +40,8 @@
    {% if request.GET.deleted %} - + {% endif %} diff --git a/leave/templates/cbv/leave_requests/leave_requests_home.html b/leave/templates/cbv/leave_requests/leave_requests_home.html index 2371b9f88..60299da7b 100644 --- a/leave/templates/cbv/leave_requests/leave_requests_home.html +++ b/leave/templates/cbv/leave_requests/leave_requests_home.html @@ -260,7 +260,6 @@ window.location.href = event.target.href; } else{ - console.log(target) console.log(event.target.href) } } else { diff --git a/leave/templates/leave/leave_request/request_view.html b/leave/templates/leave/leave_request/request_view.html index 46713a3fe..28c3ca3bb 100644 --- a/leave/templates/leave/leave_request/request_view.html +++ b/leave/templates/leave/leave_request/request_view.html @@ -370,7 +370,6 @@ window.location.href = event.target.href; } else { - console.log(target) console.log(event.target.href) } } else { diff --git a/onboarding/templates/cbv/onboarding_candidates/onboarding_candidates.html b/onboarding/templates/cbv/onboarding_candidates/onboarding_candidates.html index cbbd12714..fdbc639b6 100644 --- a/onboarding/templates/cbv/onboarding_candidates/onboarding_candidates.html +++ b/onboarding/templates/cbv/onboarding_candidates/onboarding_candidates.html @@ -150,7 +150,6 @@ function dateJoining($element){ var candId = $element.attr("data-candidate-id"); - console.log(candId); var dateVal = $element.val(); $.ajax({ type: "POST", diff --git a/onboarding/templates/onboarding/candidate_task.html b/onboarding/templates/onboarding/candidate_task.html index 6ac774e73..f7397b243 100644 --- a/onboarding/templates/onboarding/candidate_task.html +++ b/onboarding/templates/onboarding/candidate_task.html @@ -106,7 +106,6 @@ function updateSingleStatus(selectElement,event) { var taskId = $(selectElement).data("task-id"); var candId = $(selectElement).data('candidate-id'); var status = $(selectElement).val(); - console.log(status) $.ajax({ type: "POST", url: "{% url 'candidate-task-update' 0 %}".replace('0', taskId), diff --git a/payroll/forms/component_forms.py b/payroll/forms/component_forms.py index 6eb73f439..dc82910be 100644 --- a/payroll/forms/component_forms.py +++ b/payroll/forms/component_forms.py @@ -868,7 +868,7 @@ class ReimbursementForm(ModelForm): self.fields["attachment"] = MultipleFileField(label="Attachments") self.fields["attachment"].widget.attrs["accept"] = ".jpg, .jpeg, .png, .pdf" - # self.exclude_fields_by_type(exclude_fields) + self.exclude_fields_by_type(exclude_fields) for field in exclude_fields: self.fields.pop(field, None) @@ -899,7 +899,7 @@ class ReimbursementForm(ModelForm): ) is_edit = self.instance and self.instance.pk - if type == "reimbursement" and is_edit: + if type == "reimbursement" and (is_edit or self.data): exclude_fields += [ "leave_type_id", "cfd_to_encash", diff --git a/pms/static/cbv/360_feedback.js b/pms/static/cbv/360_feedback.js index e913ed2b1..caaabcfe9 100644 --- a/pms/static/cbv/360_feedback.js +++ b/pms/static/cbv/360_feedback.js @@ -143,7 +143,6 @@ $(document).on('click', '#deleteFeedback', function (e) { e.preventDefault(); var ids = JSON.parse($("#selectedInstances").attr("data-ids")) || []; - console.log(ids) var announy_ids = JSON.parse($("#anounyselectedInstances").attr("data-ids")) || []; if (ids.length === 0 && announy_ids.length === 0) { diff --git a/pms/static/src/dashboard/pmsChart.js b/pms/static/src/dashboard/pmsChart.js index eb06702ca..9f51da15a 100644 --- a/pms/static/src/dashboard/pmsChart.js +++ b/pms/static/src/dashboard/pmsChart.js @@ -144,7 +144,6 @@ if (keyResultStatusChartCtx != null) { } function keyResultStatusDataUpdate(data) { - console.log('keyresult',data) keyResultStatusData.labels = data.key_result_label; keyResultStatusData.datasets[0].data = data.key_result_value; keyResultStatusData.message = data.message; diff --git a/pms/templates/cbv/dashboard/current_value.html b/pms/templates/cbv/dashboard/current_value.html index df1f73ea9..effdd007d 100644 --- a/pms/templates/cbv/dashboard/current_value.html +++ b/pms/templates/cbv/dashboard/current_value.html @@ -14,7 +14,6 @@ keyResultRow = $(element).closest('tr'); empKeyResultId = keyResultRow.attr("data-kr-id") var targetValue = keyResultRow.find('[data-value]').attr("data-value") - console.log(targetValue) // Extract only the numeric part using a regular expression var numericValue = parseFloat(targetValue.replace(/[^\d.]/g, '')); diff --git a/pms/templates/okr/objective_detailed_view_activity.html b/pms/templates/okr/objective_detailed_view_activity.html index 73aa8b16f..079229e24 100644 --- a/pms/templates/okr/objective_detailed_view_activity.html +++ b/pms/templates/okr/objective_detailed_view_activity.html @@ -174,8 +174,6 @@ } }) - console.log($("#commentEditor .note-btn-group.send-group").parent()) - // ✅ Align last group to right $(document).ready(function () { $('.note-toolbar .note-btn-group').last().addClass('send-group') diff --git a/project/templates/task_all/task_all_overall.html b/project/templates/task_all/task_all_overall.html index 15745b3e4..45e025075 100644 --- a/project/templates/task_all/task_all_overall.html +++ b/project/templates/task_all/task_all_overall.html @@ -112,7 +112,6 @@ newURL = currentURL + separator + "view="+view; } history.pushState({}, "", newURL); - console.log(view) $("#taskAllFilterForm").attr("hx-vals", `{"view":"${view}"}`); $('#filter-task-all').attr("hx-vals", `{"view":"${view}"}`); } diff --git a/recruitment/cbv/recruitment_view.py b/recruitment/cbv/recruitment_view.py index a7419d360..b560e51dd 100644 --- a/recruitment/cbv/recruitment_view.py +++ b/recruitment/cbv/recruitment_view.py @@ -11,6 +11,7 @@ from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ +from base.models import IntegrationApps from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, @@ -79,9 +80,8 @@ class RecruitmentList(HorillaListView): action_method = "rec_actions" header_attrs = { - "recruitment_column": """ - style="width : 200px !important" - """ + "recruitment_column": 'style="width : 200px !important"', + "action": 'style="width : 300px !important"', } row_status_indications = [ @@ -209,6 +209,14 @@ class RecruitmentCreationFormExtended(RecruitmentCreationForm): "optional_resume": _("Optional Resume?"), } + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + if not IntegrationApps.objects.filter( + app_label="linkedin", is_enabled=True + ).exists(): + self.fields["publish_in_linkedin"].widget = forms.HiddenInput() + self.fields["linkedin_account_id"].widget = forms.HiddenInput() + class RecruitmentNewSkillForm(HorillaFormView): """ @@ -242,7 +250,7 @@ class RecruitmentForm(HorillaFormView): form_class = RecruitmentCreationFormExtended new_display_title = _("Add Recruitment") dynamic_create_fields = [("skills", RecruitmentNewSkillForm)] - template_name = "cbv/recruitment/recruitment_form.html" + # template_name = "cbv/recruitment/recruitment_form.html" def get_context_data(self, **kwargs): """ diff --git a/recruitment/views/linkedin.py b/recruitment/views/linkedin.py index c7368788b..31fc2d2fb 100644 --- a/recruitment/views/linkedin.py +++ b/recruitment/views/linkedin.py @@ -1,24 +1,18 @@ import json import logging -import os -import re - -import requests -from django.contrib import messages -from django.shortcuts import redirect, render -from django.urls import reverse - -logger = logging.getLogger(__name__) -import json import requests from bs4 import BeautifulSoup -from django.conf import settings +from django.contrib import messages from django.http import HttpResponse, JsonResponse +from django.shortcuts import redirect +from django.urls import reverse from django.utils.translation import gettext_lazy as _ from horilla_views.cbv_methods import login_required, permission_required -from recruitment.models import LinkedInAccount, Recruitment +from recruitment.models import LinkedInAccount + +logger = logging.getLogger(__name__) @login_required @@ -99,7 +93,6 @@ def html_to_text(html): ) -@login_required def post_recruitment_in_linkedin( request, recruitment, linkedin_acc, feed_type="feed", group_id=None ): @@ -152,7 +145,6 @@ def post_recruitment_in_linkedin( recruitment.save() -@login_required def delete_post(recruitment): """Delete recruitment post from LinkedIn""" linkedin_post_id = recruitment.linkedin_post_id diff --git a/report/templates/report/pms_report.html b/report/templates/report/pms_report.html index 6f77c6f44..d0ee193e2 100644 --- a/report/templates/report/pms_report.html +++ b/report/templates/report/pms_report.html @@ -292,8 +292,6 @@ $.getJSON(`pms-pivot?model=${selectedModel}&${formData}`, function (data) { - console.log("Filtered data:", data); - const plotlyRenderers = $.pivotUtilities.plotly_renderers; $("#" + containerId).pivotUI(data, { diff --git a/templates/settings.html b/templates/settings.html index 02cefc245..ecdb9ee18 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -158,6 +158,8 @@ >{% trans "Mail Server" %}
    + {% elif perms.base.view_dynamicemailconfiguratio and "outlook_auth"|app_installed %} +
    {% else %} {% comment %} + {% endif %}
    {% endcomment %} {% endif %}
    diff --git a/whatsapp/cbv/whatsapp.py b/whatsapp/cbv/whatsapp.py index 15162a310..5072ae781 100644 --- a/whatsapp/cbv/whatsapp.py +++ b/whatsapp/cbv/whatsapp.py @@ -4,8 +4,10 @@ from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse +from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _trans +from horilla.decorators import check_integration_enabled, permission_required from horilla_views.generic.cbv.views import ( HorillaFormView, HorillaListView, @@ -17,7 +19,14 @@ from whatsapp.models import WhatsappCredientials from whatsapp.utils import send_text_message +@method_decorator(check_integration_enabled(app_name="whatsapp"), name="dispatch") +@method_decorator( + permission_required("whatsapp.view_whatsappcredentials"), name="dispatch" +) class CredentialListView(HorillaListView): + """ + List view for Whatsapp credential settings view + """ model = WhatsappCredientials filter_class = CredentialsViewFilter @@ -82,7 +91,14 @@ class CredentialListView(HorillaListView): """ +@method_decorator(check_integration_enabled(app_name="whatsapp"), name="dispatch") +@method_decorator( + permission_required("whatsapp.view_whatsappcredentials"), name="dispatch" +) class CredentialNav(HorillaNavView): + """ + Nav view for Whatsapp credential settings view + """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -99,7 +115,15 @@ class CredentialNav(HorillaNavView): filter_instance = CredentialsViewFilter() +@method_decorator(check_integration_enabled(app_name="whatsapp"), name="dispatch") +@method_decorator( + permission_required("whatsapp.add_whatsappcredentials"), name="dispatch" +) class CredentialForm(HorillaFormView): + """ + Form view for Whatsapp credential settings view + """ + model = WhatsappCredientials form_class = WhatsappForm new_display_title = "Create whatsapp" @@ -121,7 +145,15 @@ class CredentialForm(HorillaFormView): return super().form_valid(form) +@check_integration_enabled(app_name="whatsapp") +@method_decorator( + permission_required("whatsapp.delete_whatsappcredentials"), name="dispatch" +) def delete_credentials(request): + """ + delete for Whatsapp credential settings view + """ + id = request.GET.get("id") crediential = WhatsappCredientials.objects.filter(id=id).first() count = WhatsappCredientials.objects.count() @@ -132,12 +164,19 @@ def delete_credentials(request): return HttpResponse("") +@check_integration_enabled(app_name="whatsapp") +@method_decorator( + permission_required("whatsapp.view_whatsappcredentials"), name="dispatch" +) def send_test_message(request): + """ + Test message from Whatsapp credential settings view + """ + message = "This is a test message" if request.method == "POST": number = request.POST.get("number") response = send_text_message(number, message) - print(response) if response: messages.success(request, "Message sent successfully") else: diff --git a/whatsapp/flows.py b/whatsapp/flows.py index 7ba125bca..59e296be2 100644 --- a/whatsapp/flows.py +++ b/whatsapp/flows.py @@ -10,7 +10,7 @@ from leave.models import LeaveType def get_asset_category_flow_json(): flow_json = { - "version": "5.0", + "version": "7.3", "screens": [ { "id": "screen_one", @@ -79,7 +79,7 @@ def get_asset_category_flow_json(): def get_attendance_request_json(): flow_json = { - "version": "5.0", + "version": "7.3", "screens": [ { "id": "screen_one", @@ -267,7 +267,7 @@ def get_attendance_request_json(): def get_shift_request_json(): flow_json = { - "version": "5.0", + "version": "7.3", "screens": [ { "id": "screen_one", @@ -358,7 +358,7 @@ def get_shift_request_json(): def get_work_type_request_json(): flow_json = { - "version": "5.0", + "version": "7.3", "screens": [ { "id": "screen_one", @@ -448,7 +448,7 @@ def get_work_type_request_json(): def get_leave_request_json(): flow_json = { - "version": "5.0", + "version": "7.3", "screens": [ { "id": "screen_one", @@ -565,7 +565,7 @@ def get_leave_request_json(): def get_reimbursement_request_json(): flow_json = { - "version": "5.0", + "version": "7.3", "screens": [ { "id": "screen_one", @@ -642,7 +642,7 @@ def get_reimbursement_request_json(): def get_bonus_point_json(): flow_json = { - "version": "5.0", + "version": "7.3", "screens": [ { "id": "screen_one", @@ -744,7 +744,7 @@ def get_ticket_json(): tags_data = [{"id": str(tag.id), "title": tag.title} for tag in Tags.objects.all()] flow_json = { - "version": "5.0", + "version": "7.3", "screens": [ { "id": "screen_one", diff --git a/whatsapp/models.py b/whatsapp/models.py index 74630694e..53dfdabab 100644 --- a/whatsapp/models.py +++ b/whatsapp/models.py @@ -8,7 +8,7 @@ from horilla_views.cbv_methods import render_template class WhatsappCredientials(HorillaModel): - meta_token = models.CharField(max_length=255) + meta_token = models.TextField() meta_business_id = models.CharField(max_length=255) meta_phone_number_id = models.CharField(max_length=255) meta_phone_number = models.CharField(max_length=20) diff --git a/whatsapp/templates/whatsapp/credentials_view.html b/whatsapp/templates/whatsapp/credentials_view.html index 1ebc85503..45c727e8e 100644 --- a/whatsapp/templates/whatsapp/credentials_view.html +++ b/whatsapp/templates/whatsapp/credentials_view.html @@ -1,38 +1,57 @@ {% extends 'settings.html' %} -{% load i18n static %} +{% load i18n horillafilters %} +{% load i18n static %} {% block settings %} -{% for path in style_path %} - -{% endfor %} -{% for path in script_static_paths %} - -{% endfor %} +
    +

    + {% trans "Whatsapp Integration" %} +

    +
    +
    +
    +
    +
    +

    {% trans "Enable Whatsapp" %}

    + +
    +
    +
    +
    + {% if "whatsapp"|integration_installed %} +
    +
    +
    +
    + +
    +
    +
    {% endif %} -
    - -
    -
    -
    -
    - {% endif %} +