From baeb14ecd79abcccdd5e545cf03524b4647595e9 Mon Sep 17 00:00:00 2001 From: Horilla Date: Wed, 11 Jun 2025 15:04:41 +0530 Subject: [PATCH] [UPDT] HORILLA V2-BETA: Horilla V2-Beta - Pylint Updates --- asset/cbv/accessibility.py | 11 +- asset/cbv/asset_batch_no.py | 21 ++- asset/cbv/asset_category.py | 25 ++-- asset/cbv/asset_history.py | 56 ++++---- asset/cbv/asset_tab.py | 19 +-- asset/cbv/dashboard.py | 15 +- asset/cbv/request_and_allocation.py | 69 ++++----- .../templates/cbv/asset_batch_no/actions.html | 4 +- .../cbv/asset_batch_no/asset_batch_no.html | 10 +- .../cbv/asset_batch_no/assets_col.html | 4 +- .../asset_category/detail_view_action.html | 8 +- .../templates/cbv/asset_category/filter.html | 2 +- .../asset_history/asset_history_filter.html | 2 +- .../cbv/asset_history/asset_history_home.html | 16 +-- .../asset_allocation_action.html | 2 +- .../asset_detail_action.html | 2 +- .../asset_request_detail_action.html | 2 +- .../detail_action_asset_allocation.html | 2 +- .../cbv/request_and_allocation/filter.html | 2 +- .../forms/allo_form.html | 4 +- .../forms/asset_approve_form.html | 6 +- .../forms/req_form.html | 2 +- .../request_and_allocation.html | 24 ++-- .../cbv/request_and_allocation/status.html | 2 +- attendance/cbv/accessibility.py | 29 ++-- attendance/cbv/attendance_activity.py | 23 ++- attendance/cbv/attendance_request.py | 17 +-- attendance/cbv/attendance_tab.py | 23 +-- attendance/cbv/attendances.py | 35 +++-- attendance/cbv/break_point.py | 10 +- attendance/cbv/check_in_check_out.py | 16 +-- attendance/cbv/dashboard.py | 28 ++-- attendance/cbv/dashboard_offline_online.py | 9 +- attendance/cbv/grace_time.py | 35 +++-- attendance/cbv/hour_account.py | 30 ++-- attendance/cbv/late_come_and_early_out.py | 24 ++-- attendance/cbv/my_attendances.py | 19 ++- .../static/cbv/attendance/hour_account.js | 19 ++- attendance/static/cbv/attendance_activity.js | 30 ++-- .../attendance_activity_home.html | 16 +-- .../attendance_activity/delete_action.html | 3 - .../attendance_activity/delete_inherit.html | 2 +- .../detail_delete_action.html | 1 - .../cbv/attendance_activity/filter.html | 2 +- .../attendance_request.html | 16 +-- .../attendance_request_tab.html | 32 ++--- .../cbv/attendance_request/comment.html | 2 +- .../attendance_request/request_actions.html | 4 +- .../cbv/attendance_request/status.html | 6 +- .../cbv/attendances/attendance_actions.html | 2 +- .../cbv/attendances/attendance_view_page.html | 4 +- .../attendances/attendances_filter_page.html | 4 +- .../cbv/attendances/validate_button.html | 6 +- .../cbv/attendances/validate_tab_action.html | 2 +- .../cbv/hour_account/hour_account.html | 26 ++-- .../cbv/hour_account/hour_account_main.html | 2 +- .../cbv/hour_account/hour_actions.html | 4 - .../cbv/hour_account/hour_detail_action.html | 12 +- .../cbv/hour_account/hour_export.html | 2 +- .../cbv/hour_account/nav_hour_account.html | 6 +- .../actions_column.html | 2 +- .../detail_action.html | 6 +- .../late_come_and_early_out.html | 18 +-- .../cbv/late_come_and_early_out/penality.html | 2 +- .../cbv/my_attendances/my_attendances.html | 14 +- .../settings/applicable_on_clock_in_col.html | 2 +- .../settings/applicable_on_clock_out_col.html | 2 +- .../cbv/settings/break_point_action.html | 2 +- .../cbv/settings/check_in_check_out_col.html | 4 +- .../settings/grace_time_default_action.html | 6 +- .../cbv/settings/grace_time_shift.html | 2 +- .../settings/is_active_col_grace_time.html | 2 +- base/cbv/announcement_cbv.py | 34 ++--- base/cbv/company.py | 8 +- base/cbv/company_leaves.py | 33 ++--- base/cbv/dashboard/dashboard.py | 16 +-- base/cbv/employee_shift.py | 7 +- base/cbv/employee_shift_shedule.py | 8 +- base/cbv/employee_type.py | 4 +- base/cbv/holidays.py | 39 +++-- base/cbv/job_position.py | 11 +- base/cbv/job_role.py | 14 +- base/cbv/mail_log_tab.py | 9 +- base/cbv/mail_server.py | 12 +- base/cbv/mail_template.py | 22 ++- base/cbv/multiple_approval_condition.py | 11 +- base/cbv/penalty.py | 11 +- base/cbv/rotating_shift.py | 9 +- base/cbv/rotating_shift_assign.py | 27 ++-- base/cbv/rotating_work_type.py | 11 +- base/cbv/settings_rotatingwork.py | 2 + base/cbv/settings_work_type.py | 2 + base/cbv/shift_request.py | 20 +-- base/cbv/work_shift_tab.py | 34 +++-- base/cbv/work_type_request.py | 28 ++-- base/shift_decorators.py | 7 +- base/static/cbv/deleteFunc.js | 2 +- .../shift_request_bulk_actions.js | 49 ++++--- .../work_request_bulk_action.js | 33 +++-- .../company_leaves/company_leave_actions.html | 2 +- .../company_leaves/company_leave_filter.html | 2 +- .../company_leaves/company_leave_home.html | 12 +- .../company_leaves/detail_view_actions.html | 9 +- .../cbv/dashboard/announcement_title.html | 2 +- .../cbv/dashboard/announcement_viewed_by.html | 2 +- .../cbv/dashboard/job_position_field.html | 4 +- .../cbv/dashboard/job_role_field.html | 4 +- .../cbv/holidays/detail_view_actions.html | 11 +- .../cbv/holidays/holiday_filter.html | 2 +- .../templates/cbv/holidays/holidays_home.html | 12 +- base/templates/cbv/mail_log_tab/iframe.html | 11 +- .../cbv/mail_template/form_inherit.html | 6 +- .../multiple_approval_condition/actions.html | 2 +- .../approval_managers.html | 4 +- .../detail_action.html | 2 +- .../cbv/multiple_approval_condition/form.html | 14 +- .../form_edit.html | 32 ++--- .../multiple_approval_condition.html | 2 +- .../cbv/multiple_approval_condition/test.html | 2 +- .../rotating_shift/actions_rotaing_shift.html | 4 +- .../extended_rotating_shift.html | 4 +- .../cbv/rotating_shift/rot_shift_form.html | 18 +-- .../cbv/rotating_shift/rotating_column.html | 3 +- .../cbv/rotating_shift/rotating_shift.html | 2 +- .../rotating_shift_detail_actions.html | 3 +- .../rotating_shift/rotating_shift_filter.html | 1 - .../cbv/rotating_shift/rshift_export.html | 2 +- .../extended_rotating_work.html | 4 +- .../filter_work_rotate.html | 7 +- .../cbv/rotating_work_type/forms/inherit.html | 17 ++- .../forms/update_inherit.html | 21 ++- .../rotate_detail_view_actions.html | 12 +- .../rotating_action_export.html | 10 +- .../rotating_work_home.html | 2 +- .../cbv/rotating_work_type/rotation_col.html | 2 +- .../work_rotate_actions.html | 6 +- .../cbv/settings/company_bulk_update.html | 2 +- .../cbv/settings/company_inherit.html | 4 +- .../employee_shift_schedule_action.html | 2 +- ...employee_shift_schedule_detail_action.html | 2 +- .../employee_shift_schedule_form.html | 2 +- .../cbv/settings/extended_mail_server.html | 2 +- .../job_position_col_in_job_role.html | 1 - base/templates/cbv/settings/job_role.html | 6 +- .../cbv/settings/mail_server_action.html | 4 +- .../settings/position_in_job_position.html | 8 +- .../shift_request/actions_shift_requst.html | 4 +- base/templates/cbv/shift_request/comment.html | 2 +- .../cbv/shift_request/confirm_allocated.html | 2 +- .../cbv/shift_request/export_shift.html | 1 - .../cbv/shift_request/extended_shift.html | 4 +- base/templates/cbv/shift_request/filter.html | 12 +- .../shift_request/shift_deatil_actions.html | 4 +- .../cbv/shift_request/shift_request.html | 2 +- .../cbv/shift_request/shift_request_form.html | 3 +- .../work_shift_tab/extended_work-shift.html | 4 +- .../cbv/work_type_request/actions.html | 2 +- .../cbv/work_type_request/confirmation.html | 2 +- .../detail_view_actions.html | 10 +- .../cbv/work_type_request/filter.html | 4 +- .../cbv/work_type_request/form/form.html | 3 +- .../templates/cbv/work_type_request/note.html | 2 +- .../cbv/work_type_request/work_export.html | 2 +- .../cbv/work_type_request/work_type_home.html | 2 +- base/views copy.py | 12 +- base/widgets.py | 8 +- base/work_type_decorators.py | 3 +- biometric/cbv/biometric.py | 94 ++++++------ .../templates/cbv/biometric_card_actions.html | 2 +- biometric/templates/cbv/biometric_form.html | 8 +- employee/cbv/accessibility.py | 2 + employee/cbv/action_type.py | 11 +- employee/cbv/allocations.py | 70 ++++----- employee/cbv/disciplinary_actions.py | 8 +- employee/cbv/document_request.py | 55 ++++--- employee/cbv/employee_profile.py | 17 +-- employee/cbv/employee_tags.py | 20 ++- employee/cbv/policy_cbv.py | 9 +- .../management/commands/import_ldap_users.py | 47 +++--- employee/static/cbv/employee_view/actions.js | 72 +++++----- .../cbv/allocations/allocations.html | 2 +- .../allocations/asset/allocation_status.html | 2 +- .../cbv/allocations/asset/assets.html | 16 +-- .../cbv/allocations/asset/return_form.html | 2 +- .../cbv/allocations/auth/groups.html | 8 +- .../templates/cbv/allocations/auth/perm.html | 8 +- .../allocations/employee/form_structure.html | 2 +- .../cbv/allocations/employee/forms.html | 2 +- .../payroll/allowance/allowance_view.html | 3 +- .../payroll/deduction/deduction_view.html | 3 +- .../templates/cbv/allocations/summary.html | 2 +- .../disciplinary_actions/action_taken.html | 2 +- .../cbv/disciplinary_actions/actions.html | 2 +- .../cbv/disciplinary_actions/attachments.html | 1 - .../disciplinary_actions/detail_action.html | 6 +- .../disciplinary_actions.html | 2 +- .../disciplinary_actions/employee_col.html | 2 +- .../cbv/disciplinary_actions/filters.html | 2 +- .../forms/create_form.html | 2 +- .../cbv/disciplinary_actions/main_dis.html | 4 +- .../templates/cbv/document/notify_field.html | 2 +- .../templates/cbv/documents/inherit_form.html | 4 +- .../cbv/employees_view/bulk_update_page.html | 33 ++--- .../cbv/employees_view/employee_actions.html | 8 +- .../cbv/employees_view/filter_employee.html | 6 +- .../cbv/employees_view/offline_online.html | 4 +- .../cbv/employees_view/view_employees.html | 22 +-- .../templates/cbv/profile/profile_view.html | 1 - employee/templates/tabs/main_asset_tab.html | 2 +- employee/templates/tabs/main_note_tab.html | 2 +- helpdesk/cbv/department_managers.py | 18 +-- helpdesk/cbv/faq.py | 29 ++-- helpdesk/cbv/pipeline.py | 28 ++-- helpdesk/cbv/tags.py | 49 +++---- helpdesk/cbv/ticket_type.py | 50 ++++--- .../templates/cbv/pipeline/empty_list.html | 2 +- .../cbv/pipeline/pipeline_action_col.html | 8 +- .../templates/cbv/tickets/inherit_form.html | 2 +- horilla/settings.py | 28 ++-- horilla_audit/cbv/audit.py | 22 ++- horilla_audit/filters.py | 10 +- horilla_theme/apps.py | 4 +- .../horilla_theme/assets/css/global.css | 2 +- .../horilla_theme/assets/css/v1_styles.css | 2 +- .../static/horilla_theme/assets/icons/a1.svg | 2 +- .../static/horilla_theme/assets/icons/a2.svg | 2 +- .../static/horilla_theme/assets/icons/a3.svg | 2 +- .../static/horilla_theme/assets/icons/a4.svg | 2 +- .../horilla_theme/assets/icons/add1.svg | 2 +- .../horilla_theme/assets/icons/addmore.svg | 2 +- .../horilla_theme/assets/icons/addmore1.svg | 2 +- .../horilla_theme/assets/icons/assignment.svg | 2 +- .../horilla_theme/assets/icons/auto.svg | 2 +- .../horilla_theme/assets/icons/base.svg | 2 +- .../horilla_theme/assets/icons/birthday.svg | 2 +- .../horilla_theme/assets/icons/campaign.svg | 2 +- .../horilla_theme/assets/icons/case.svg | 2 +- .../horilla_theme/assets/icons/chat.svg | 2 +- .../horilla_theme/assets/icons/comment.svg | 2 +- .../horilla_theme/assets/icons/completed.svg | 2 +- .../horilla_theme/assets/icons/copy.svg | 2 +- .../horilla_theme/assets/icons/customer.svg | 2 +- .../assets/icons/data-analytics.svg | 2 +- .../horilla_theme/assets/icons/data.svg | 2 +- .../horilla_theme/assets/icons/dislike.svg | 2 +- .../horilla_theme/assets/icons/down.svg | 2 +- .../horilla_theme/assets/icons/download.svg | 2 +- .../horilla_theme/assets/icons/events1.svg | 2 +- .../horilla_theme/assets/icons/eye1.svg | 2 +- .../horilla_theme/assets/icons/filter1.svg | 2 +- .../horilla_theme/assets/icons/forecast.svg | 2 +- .../horilla_theme/assets/icons/general.svg | 2 +- .../horilla_theme/assets/icons/home.svg | 2 +- .../static/horilla_theme/assets/icons/l1.svg | 2 +- .../static/horilla_theme/assets/icons/l2.svg | 2 +- .../static/horilla_theme/assets/icons/l3.svg | 2 +- .../static/horilla_theme/assets/icons/l4.svg | 2 +- .../static/horilla_theme/assets/icons/l5.svg | 2 +- .../horilla_theme/assets/icons/lead1.svg | 2 +- .../horilla_theme/assets/icons/leads.svg | 2 +- .../horilla_theme/assets/icons/like.svg | 2 +- .../horilla_theme/assets/icons/link.svg | 2 +- .../horilla_theme/assets/icons/next.svg | 2 +- .../horilla_theme/assets/icons/oppor.svg | 2 +- .../assets/icons/opportunities.svg | 2 +- .../horilla_theme/assets/icons/pending.svg | 2 +- .../horilla_theme/assets/icons/pin-r.svg | 2 +- .../static/horilla_theme/assets/icons/pin.svg | 2 +- .../horilla_theme/assets/icons/prev.svg | 2 +- .../horilla_theme/assets/icons/progress.svg | 2 +- .../horilla_theme/assets/icons/right1.svg | 2 +- .../horilla_theme/assets/icons/sales.svg | 2 +- .../horilla_theme/assets/icons/share1.svg | 2 +- .../horilla_theme/assets/icons/spinner.svg | 2 +- .../horilla_theme/assets/icons/task.svg | 2 +- .../horilla_theme/assets/icons/tasks1.svg | 2 +- .../horilla_theme/assets/icons/technical.svg | 2 +- .../horilla_theme/assets/icons/tri1-first.svg | 2 +- .../horilla_theme/assets/icons/tri1.svg | 2 +- .../horilla_theme/assets/icons/tri2-b.svg | 2 +- .../horilla_theme/assets/icons/tri2-g.svg | 2 +- .../horilla_theme/assets/icons/tri2-p.svg | 2 +- .../horilla_theme/assets/icons/tri2.svg | 2 +- .../horilla_theme/assets/icons/tri3-b.svg | 2 +- .../horilla_theme/assets/icons/tri3-g.svg | 2 +- .../horilla_theme/assets/icons/tri3-p.svg | 2 +- .../horilla_theme/assets/icons/tri3.svg | 2 +- .../horilla_theme/assets/icons/up-arrow.svg | 2 +- .../horilla_theme/assets/icons/users.svg | 2 +- .../horilla_theme/assets/icons/usersearch.svg | 2 +- .../horilla_theme/assets/img/icons/absent.svg | 2 +- .../assets/img/icons/add-user.svg | 2 +- .../horilla_theme/assets/img/icons/adjust.svg | 2 +- .../assets/img/icons/bar-chart.svg | 2 +- .../assets/img/icons/building.svg | 2 +- .../assets/img/icons/calendar.svg | 2 +- .../horilla_theme/assets/img/icons/exit.svg | 2 +- .../horilla_theme/assets/img/icons/home.svg | 2 +- .../assets/img/icons/joining.svg | 2 +- .../horilla_theme/assets/img/icons/more.svg | 2 +- .../assets/img/icons/setting.svg | 2 +- .../horilla_theme/assets/img/icons/sort.svg | 2 +- .../assets/img/icons/strenth.svg | 2 +- .../horilla_theme/assets/img/icons/users.svg | 2 +- .../assets/img/icons/usersearch.svg | 2 +- .../horilla_theme/assets/img/not-found.svg | 2 +- .../horilla_theme/assets/js/timeRunner.js | 2 +- .../templates/generic/horilla_nav.html | 16 +-- .../templates/generic/quick_actions.html | 1 - .../horilla_theme/components/header.html | 2 +- .../components/header_scripts.html | 2 +- .../horilla_theme/components/sidebar.html | 2 +- horilla_theme/templates/index.html | 4 +- .../templates/generic/components.html | 2 + .../templates/generic/import_block.html | 6 +- .../templates/generic/pipeline/kanban.html | 136 +++++++++--------- leave/cbv/accessibility.py | 22 +-- leave/cbv/assigned_leave.py | 26 ++-- leave/cbv/compensatory_leave_request.py | 22 +-- leave/cbv/dashboard.py | 36 +++-- leave/cbv/leave_allocation_request.py | 20 +-- leave/cbv/leave_requests.py | 100 +++++++------ leave/cbv/leave_tab.py | 4 +- leave/cbv/leave_types.py | 39 +++-- leave/cbv/restricted_days.py | 20 ++- .../cbv/assigned_leave/assigned_leave.js | 2 +- .../compensatory_leave/compensatory_leave.js | 12 +- leave/static/cbv/holidays/holiday_action.js | 14 +- .../cbv/leave_requests/leave_requests.js | 8 +- .../cbv/my_leave_request/my_leave_request.js | 2 - .../cbv/assigned_leave/assigned_filter.html | 2 +- .../assigned_leave_actions.html | 12 +- .../assigned_leave_detail_actions.html | 1 - .../assigned_leave/assigned_leave_export.html | 2 - .../assigned_leave/assigned_leave_home.html | 4 +- .../cbv/assigned_leave/nav_fixed_filter.html | 2 +- .../compensatory_actions.html | 16 +-- .../compensatory_comment.html | 1 - .../compensatory_confirmation.html | 10 +- .../compensatory_detail_actions.html | 11 +- .../compensatory_leave/compensatory_home.html | 14 +- .../compensatory_leave_filter.html | 2 +- .../cbv/compensatory_leave/custom_date.html | 2 +- .../detail_reject_reason.html | 2 +- .../cbv/compensatory_leave/inherit_class.html | 2 +- .../my_compensatory_detail_action.html | 12 +- .../cbv/employee_individual/leave_tab.html | 24 ++-- .../action_column.html | 2 +- .../leave_allocation_request/attachment.html | 2 +- .../cbv/leave_allocation_request/comment.html | 2 +- .../confirmations.html | 2 +- .../detail_action.html | 4 +- .../cbv/leave_allocation_request/filter.html | 2 +- .../cbv/leave_allocation_request/history.html | 8 +- .../leave_allocation_request.html | 18 +-- .../leave_detail_action.html | 2 +- .../cbv/leave_allocation_request/reject.html | 2 +- .../cbv/leave_requests/actions_col.html | 6 +- .../cbv/leave_requests/clashed_due_to.html | 3 - .../cbv/leave_requests/comment_action.html | 2 +- .../cbv/leave_requests/confirmation.html | 38 ++--- .../cbv/leave_requests/custom_status_col.html | 2 +- .../templates/cbv/leave_requests/filter.html | 6 +- .../cbv/leave_requests/form/inherit.html | 6 +- .../cbv/leave_requests/leave_clash.html | 1 - .../leave_request_detail_actions.html | 4 +- .../leave_requests/leave_request_emp_col.html | 2 +- .../leave_requests/leave_requests_export.html | 1 - .../multiple_approval_action.html | 2 - .../cbv/leave_types/detail_actions.html | 6 +- leave/templates/cbv/leave_types/inherit.html | 2 +- .../leave_detail_carryforward.html | 2 +- .../cbv/leave_types/leave_detail_reset.html | 2 +- .../cbv/leave_types/leave_type_home.html | 10 +- .../leave_types/leave_type_list_actions.html | 10 +- .../my_leave_request/attachment_action.html | 3 +- .../my_leave_request/cancelled_action.html | 5 +- .../cbv/my_leave_request/comment.html | 2 +- .../cbv/my_leave_request/confirm_cancel.html | 4 +- .../detail_leave_actions.html | 12 +- .../cbv/my_leave_request/filter.html | 2 +- .../cbv/my_leave_request/form/inherit.html | 6 +- .../cbv/my_leave_request/leave_actions.html | 2 +- .../cbv/my_leave_request/leave_type_col.html | 4 +- .../cbv/my_leave_request/rejected_action.html | 9 +- .../cbv/restricted_days/actions.html | 2 +- .../cbv/restricted_days/detail_action.html | 4 +- .../cbv/restricted_days/job_position.html | 2 +- .../cbv/restricted_days/restricted_days.html | 12 +- offboarding/cbv/accessibility.py | 5 +- offboarding/cbv/exit_process.py | 47 +++--- offboarding/cbv/resignation.py | 71 ++++++--- offboarding/cbv/resignation_tab.py | 9 +- offboarding/cbv_decorators.py | 6 +- .../cbv/exit_process/detail_view_tasks.html | 4 +- .../cbv/exit_process/detailed_page_empty.html | 2 +- .../cbv/exit_process/pipeline_action_col.html | 4 +- .../cbv/exit_process/pipeline_filter.html | 2 +- .../cbv/exit_process/pipeline_stage_col.html | 2 +- .../cbv/exit_process/stage_order.html | 2 +- .../cbv/exit_process/tasks_cols.html | 10 +- .../templates/cbv/resignation/actions.html | 2 +- .../cbv/resignation/description.html | 19 +-- .../cbv/resignation/detail_description.html | 4 +- .../cbv/resignation/detail_view.html | 3 - .../templates/cbv/resignation/filter.html | 2 +- .../templates/cbv/resignation/options.html | 1 - .../cbv/resignation/resignation.html | 20 +-- .../employees/extended_detailed_view.html | 7 +- onboarding/cbv/accessibility.py | 2 +- onboarding/cbv/dashboard.py | 20 +-- onboarding/cbv/onboarding_candidates.py | 14 +- onboarding/cbv/onboarding_view.py | 16 ++- onboarding/cbv/pipeline.py | 46 +++--- onboarding/cbv_decorators.py | 5 +- .../cbv/dashboard/my_onboarding_task.html | 2 +- .../templates/cbv/dashboard/status.html | 2 +- .../cbv/onboarding_candidates/actions.html | 10 +- .../cbv/onboarding_candidates/cand_email.html | 2 +- .../date_of_joining.html | 1 - .../cbv/onboarding_candidates/filter.html | 2 +- .../onboarding_candidates/offer_letter.html | 2 +- .../onboarding_candidates.html | 38 ++--- .../onboarding_candidates/probation_date.html | 2 +- .../cbv/onboarding_view/detail_view.html | 2 +- .../templates/cbv/onboarding_view/status.html | 2 +- .../templates/cbv/onboarding_view/task.html | 2 +- .../cbv/pipeline/onboarding/pipeline.html | 14 +- .../pipeline/onboarding/stage_drop_down.html | 2 +- .../templates/onboarding/empty_task.html | 2 +- payroll/cbv/accessibility.py | 31 +++- payroll/cbv/allowance_deduction.py | 58 ++++---- payroll/cbv/allowances.py | 110 ++++++-------- payroll/cbv/asset_fine.py | 14 +- payroll/cbv/contracts.py | 25 ++-- payroll/cbv/dashboard.py | 25 ++-- payroll/cbv/deduction.py | 86 ++++++----- payroll/cbv/federal_tax.py | 39 ++--- payroll/cbv/loan_advance_salary.py | 16 +-- payroll/cbv/payslip.py | 29 ++-- payroll/cbv/payslip_automation.py | 12 +- payroll/cbv/reimbursements.py | 23 +-- payroll/static/cbv/actions.js | 23 ++- payroll/static/cbv/payslip.js | 24 ++-- .../allowance/custom_amount.html | 2 +- .../allowance/detail_view_actions.html | 2 +- .../allowance/max_limit_col.html | 2 +- .../allowance_deduction/allowance_action.html | 6 +- .../allowance_deduction.html | 2 +- .../deductions/amount.html | 2 +- .../deductions/deductions_actions.html | 6 +- .../deductions/has_maximum_limit.html | 2 +- .../cbv/allowances/allowance_filter.html | 2 +- .../cbv/allowances/allowances_home.html | 16 +-- payroll/templates/cbv/contracts/actions.html | 2 +- .../cbv/contracts/cal_leave_amount.html | 2 +- .../templates/cbv/contracts/contracts.html | 18 +-- .../cbv/contracts/detail_action.html | 10 +- payroll/templates/cbv/contracts/document.html | 2 +- payroll/templates/cbv/contracts/export.html | 2 +- payroll/templates/cbv/contracts/note.html | 2 +- payroll/templates/cbv/contracts/status.html | 2 +- .../cbv/dashboard/contract_ending.html | 4 +- .../cbv/dashboard/contract_expired.html | 4 +- .../templates/cbv/deduction/deduction.html | 22 +-- payroll/templates/cbv/deduction/filter.html | 2 +- .../cbv/federal_tax/form_inherit.html | 8 +- .../cbv/federal_tax/tax_bracket.html | 2 +- payroll/templates/cbv/loan/loan_actions.html | 2 +- payroll/templates/cbv/loan/loan_card.html | 11 +- .../templates/cbv/loan/loan_detail_view.html | 4 +- payroll/templates/cbv/loan/loan_filter.html | 2 +- payroll/templates/cbv/loan/loan_main.html | 8 +- .../cbv/payslip/payslip_actions.html | 1 - .../cbv/payslip/payslip_download_tab.html | 2 +- .../templates/cbv/payslip/payslip_filter.html | 2 +- .../templates/cbv/payslip/payslip_home.html | 10 +- .../cbv/payslip/payslip_inherit_form.html | 4 +- .../cbv/payslip/payslip_status_col.html | 2 +- .../templates/cbv/reimbursements/actions.html | 2 +- .../templates/cbv/reimbursements/amount.html | 2 +- .../cbv/reimbursements/attachments.html | 2 +- .../templates/cbv/reimbursements/comment.html | 2 +- .../cbv/reimbursements/detail_actions.html | 1 - .../templates/cbv/reimbursements/filter.html | 2 +- .../templates/cbv/reimbursements/forms.html | 4 +- .../templates/cbv/reimbursements/options.html | 2 +- .../cbv/reimbursements/reimbursements.html | 24 ++-- .../templates/cbv/settings/is_active_col.html | 1 - pms/cbv/accessibility.py | 2 +- pms/cbv/dashboard.py | 35 ++--- pms/cbv/feedback.py | 30 ++-- pms/cbv/key_result.py | 4 +- pms/cbv/meetings.py | 23 ++- pms/cbv/period.py | 25 ++-- pms/cbv/question_template.py | 21 +-- pms/static/cbv/360_feedback.js | 55 ++++--- .../cbv/360_feedback/anonymous_action.html | 4 +- .../cbv/360_feedback/custom_actions.html | 4 - .../cbv/360_feedback/custom_status_col.html | 6 +- .../cbv/360_feedback/due_in_col.html | 2 +- .../cbv/360_feedback/feedback_filter.html | 22 ++- .../cbv/360_feedback/feedback_home.html | 22 +-- .../cbv/360_feedback/form/form_inherit.html | 6 +- pms/templates/cbv/360_feedback/inherit.html | 10 +- pms/templates/cbv/dashboard/actions.html | 2 +- .../cbv/dashboard/current_value.html | 2 +- pms/templates/cbv/key_results/actions.html | 1 - .../cbv/key_results/detail_view_actions.html | 4 +- .../cbv/key_results/key_result_filter.html | 1 - .../cbv/key_results/key_result_home.html | 12 +- pms/templates/cbv/meetings/actions.html | 6 +- pms/templates/cbv/meetings/date.html | 2 +- pms/templates/cbv/meetings/employees.html | 2 +- .../cbv/meetings/forms/meet_create.html | 1 - pms/templates/cbv/meetings/managers.html | 2 +- pms/templates/cbv/meetings/meetings.html | 10 +- pms/templates/cbv/objectives/actions.html | 8 +- pms/templates/cbv/objectives/assignees.html | 2 +- .../cbv/objectives/emp_obj_actions.html | 2 +- .../objectives/employee_objective_status.html | 2 +- .../cbv/objectives/extended_objectives.html | 4 +- pms/templates/cbv/objectives/filter.html | 2 +- pms/templates/cbv/objectives/form.html | 10 +- pms/templates/cbv/objectives/key_results.html | 4 +- pms/templates/cbv/objectives/manager.html | 2 +- pms/templates/cbv/objectives/objectives.html | 16 +-- .../cbv/objectives/self_key_results.html | 4 +- .../cbv/objectives/self_objective_action.html | 2 +- pms/templates/cbv/objectives/title.html | 4 - pms/templates/cbv/period/actions.html | 4 +- .../cbv/period/detail_view_actions.html | 11 +- pms/templates/cbv/period/period.html | 10 +- pms/templates/cbv/question_template/main.html | 2 +- .../question_template/question_template.html | 16 +-- recruitment/cbv/accessibility.py | 19 ++- recruitment/cbv/candidate_mail_log.py | 8 +- recruitment/cbv/candidate_profile.py | 17 +-- recruitment/cbv/candidate_reject_reason.py | 16 ++- recruitment/cbv/candidates.py | 94 ++++++------ recruitment/cbv/dashboard.py | 20 +-- recruitment/cbv/interview.py | 2 +- recruitment/cbv/pipeline.py | 16 ++- recruitment/cbv/recruitment_survey.py | 69 +++++---- recruitment/cbv/recruitment_view.py | 52 ++++--- recruitment/cbv/skill_zone.py | 16 +-- recruitment/cbv/skills.py | 16 ++- recruitment/cbv/stage_view.py | 10 +- recruitment/cbv_decorators.py | 5 +- .../templates/cbv/candidates/candidates.html | 16 +-- .../templates/cbv/candidates/export.html | 2 +- .../templates/cbv/candidates/filter.html | 2 +- .../templates/cbv/candidates/option.html | 8 +- .../cbv/candidates/profile_interview_tab.html | 4 +- .../cbv/candidates/profile_notes_tab.html | 2 +- .../candidates/profile_onboarding_tab.html | 2 +- .../cbv/candidates/profile_resume_tab.html | 1 - .../cbv/candidates/profile_survey_tab.html | 2 +- .../templates/cbv/candidates/rating.html | 2 +- .../templates/cbv/candidates/resume.html | 2 +- .../cbv/interview/candidate_custom_col.html | 2 - .../cbv/interview/detail_view_actions.html | 11 +- .../cbv/interview/forms/form_hx.html | 2 +- .../cbv/interview/inherit_script.html | 2 +- .../cbv/interview/interview_home_view.html | 16 +-- .../cbv/interview/interviewer_custom_col.html | 2 - .../cbv/interview/status_custom_col.html | 2 +- .../cbv/pipeline/candidate_column.html | 6 +- .../cbv/pipeline/count_of_interviews.html | 2 +- recruitment/templates/cbv/pipeline/empty.html | 2 +- .../templates/cbv/pipeline/pipeline.html | 14 +- .../templates/cbv/pipeline/rating.html | 2 +- .../cbv/pipeline/recruitment_tabs.html | 6 +- .../templates/cbv/pipeline/stages.html | 9 +- .../templates/cbv/recruitment/actions.html | 6 +- .../cbv/recruitment/detail_action.html | 8 +- .../cbv/recruitment/managers_col.html | 4 +- .../templates/cbv/recruitment/open_jobs.html | 2 +- .../templates/cbv/recruitment/rec_main.html | 3 +- .../cbv/recruitment/recruitment.html | 16 +-- .../cbv/recruitment/recruitment_col.html | 8 -- .../cbv/recruitment/recruitment_form.html | 2 +- .../cbv/recruitment/total_hires.html | 2 +- .../cbv/recruitment_survey/survey_form.html | 21 ++- recruitment/templates/cbv/stages/actions.html | 2 +- recruitment/templates/cbv/stages/filter.html | 2 +- .../templates/cbv/stages/managers.html | 1 - .../templates/cbv/stages/stage_main.html | 8 +- recruitment/templates/cbv/stages/stages.html | 28 ++-- recruitment/templates/cbv/stages/title.html | 11 +- templates/filter_country.js | 4 +- whatsapp/admin.py | 2 +- whatsapp/apps.py | 7 +- whatsapp/cbv/whatsapp.py | 9 +- whatsapp/encryption.py | 60 ++++---- whatsapp/filters.py | 5 +- whatsapp/flows.py | 3 +- whatsapp/forms.py | 14 +- .../templates/whatsapp/credentials_view.html | 10 +- .../whatsapp/send_test_message_form.html | 2 +- whatsapp/urls.py | 5 +- whatsapp/utils.py | 20 +-- whatsapp/views.py | 24 ++-- 603 files changed, 2952 insertions(+), 2917 deletions(-) diff --git a/asset/cbv/accessibility.py b/asset/cbv/accessibility.py index b141027bf..2efb6ff10 100644 --- a/asset/cbv/accessibility.py +++ b/asset/cbv/accessibility.py @@ -1,16 +1,19 @@ - from django.contrib.auth.context_processors import PermWrapper + from base.methods import check_manager from employee.models import Employee -def asset_accessibility(request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs) -> bool: +def asset_accessibility( + request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs +) -> bool: """ accessibility for asset tab """ employee = Employee.objects.get(id=instance.pk) if ( - request.user.has_perm("asset.view_asset") or check_manager(request.user.employee_get, instance) + request.user.has_perm("asset.view_asset") + or check_manager(request.user.employee_get, instance) or request.user == employee.employee_user_id ): return True @@ -22,4 +25,4 @@ def create_asset_request_accessibility( ) -> bool: if request.user.has_perm("asset.add_assetrequest"): return True - return False \ No newline at end of file + return False diff --git a/asset/cbv/asset_batch_no.py b/asset/cbv/asset_batch_no.py index 8b8fc6943..b7bd59f2d 100644 --- a/asset/cbv/asset_batch_no.py +++ b/asset/cbv/asset_batch_no.py @@ -3,11 +3,13 @@ this page is handling the cbv methods for asset batch no """ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse -from django.contrib import messages from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ + from asset.filters import AssetBatchNoFilter from asset.forms import AssetBatchForm from asset.models import AssetLot @@ -49,12 +51,11 @@ class AssetBatchNoListView(HorillaListView): columns = [ (_("Batch Number"), "lot_number"), (_("Description"), "lot_description"), - (_("Assets"),"assets_column") + (_("Assets"), "assets_column"), ] - header_attrs = { - "action" : """ + "action": """ style = "width:180px !important" """ } @@ -151,16 +152,11 @@ class AssetBatchDetailView(HorillaDetailedView): model = AssetLot header = False - cols = { - "assets_column":12, - "lot_description":12, - "lot_number":12 - } + cols = {"assets_column": 12, "lot_description": 12, "lot_number": 12} body = { - (_("Assets"),"assets_column"), + (_("Assets"), "assets_column"), (_("Description"), "lot_description"), (_("Batch Number"), "lot_number"), - } actions = [ @@ -178,12 +174,11 @@ class AssetBatchDetailView(HorillaDetailedView): { "action": _("Delete"), "icon": "trash-outline", - "attrs": """ class="oh-btn oh-btn--danger w-100" hx-confirm="Do you want to delete this batch number?" hx-post="{get_delete_url}?instance_ids={ordered_ids}" hx-target="#AssetBatchList" - """ + """, }, ] diff --git a/asset/cbv/asset_category.py b/asset/cbv/asset_category.py index 7aa58db28..d3079cb18 100644 --- a/asset/cbv/asset_category.py +++ b/asset/cbv/asset_category.py @@ -3,22 +3,24 @@ Asset category forms """ from typing import Any + from django import forms from django.contrib import messages from django.http import HttpResponse from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ + from asset.cbv.asset_batch_no import DynamicCreateBatchNo from asset.filters import AssetCategoryFilter, AssetFilter, CustomAssetFilter from asset.forms import AssetCategoryForm, AssetForm, AssetReportForm from asset.models import Asset, AssetCategory, AssetDocuments, AssetReport +from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, HorillaFormView, HorillaNavView, ) -from horilla_views.cbv_methods import login_required, permission_required @method_decorator(login_required, name="dispatch") @@ -130,7 +132,7 @@ class AssetCategoryDuplicateFormView(HorillaFormView): @method_decorator(permission_required("asset.view_asset"), name="dispatch") class AssetDuplicateFormView(HorillaFormView): """ - form view for create duplicate for asset + form view for create duplicate for asset """ form_class = AssetForm @@ -166,7 +168,8 @@ class AssetDuplicateFormView(HorillaFormView): "" ) return super().form_valid(form) - + + class AssetReportFormView(HorillaFormView): """ form view for create button @@ -180,7 +183,7 @@ class AssetReportFormView(HorillaFormView): initial = super().get_initial() initial["asset_id"] = self.kwargs.get("asset_id") return initial - + def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) asset_id = self.kwargs.get("asset_id") @@ -192,7 +195,7 @@ class AssetReportFormView(HorillaFormView): if form.is_valid(): message = _("Asset report added successfully.") asset = form.save() - uploaded_files = form.cleaned_data.get('files') + uploaded_files = form.cleaned_data.get("files") if uploaded_files: for file in uploaded_files: AssetDocuments.objects.create(asset_report=asset, file=file) @@ -249,15 +252,11 @@ class AssetCategoryNav(HorillaNavView): search_swap_target = "#assetCategoryList" - - class AssetCategoryDetailView(HorillaDetailedView): """ Detail view of the page """ - - def get_context_data(self, **kwargs: Any): """ Return context data with the title set to the contract's name. @@ -269,7 +268,7 @@ class AssetCategoryDetailView(HorillaDetailedView): return context model = Asset - header = False + header = False template_name = "cbv/asset_category/detail_view_action.html" body = [ (_("Tracking Id"), "asset_tracking_id"), @@ -295,15 +294,11 @@ class AssetCategoryDetailView(HorillaDetailedView): { "action": _("Delete"), "icon": "trash-outline", - "attrs": """ class="oh-btn oh-btn--danger w-100" hx-confirm="Do you want to delete this asset?" hx-post="{get_delete_url}?instance_ids={ordered_ids}" hx-target="#genericModalBody" - """ + """, }, ] - - - diff --git a/asset/cbv/asset_history.py b/asset/cbv/asset_history.py index fb606eef0..6f0ecd569 100644 --- a/asset/cbv/asset_history.py +++ b/asset/cbv/asset_history.py @@ -3,19 +3,20 @@ this page is handling the cbv methods of asset history page """ from typing import Any + from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ + from asset.filters import AssetHistoryFilter from asset.models import AssetAssignment +from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, - TemplateView, HorillaListView, HorillaNavView, + TemplateView, ) -from horilla_views.cbv_methods import login_required, permission_required - @method_decorator(login_required, name="dispatch") @@ -43,20 +44,20 @@ class AssetHistorylistView(HorillaListView): self.search_url = reverse("asset-history-list") columns = [ - (_("Asset"),"asset_id__asset_name", "get_avatar"), - (_("Employee"),"assigned_to_employee_id"), - (_("Assigned Date"),"assigned_date"), - (_("Returned Date"),"return_date"), - (_("Return Status"),"return_status") + (_("Asset"), "asset_id__asset_name", "get_avatar"), + (_("Employee"), "assigned_to_employee_id"), + (_("Assigned Date"), "assigned_date"), + (_("Returned Date"), "return_date"), + (_("Return Status"), "return_status"), ] records_per_page = 5 sortby_mapping = [ - ("Asset","asset_id__asset_name", "get_avatar"), - ("Employee","assigned_to_employee_id"), - ("Assigned Date","assigned_date"), - ("Returned Date","return_date"), + ("Asset", "asset_id__asset_name", "get_avatar"), + ("Employee", "assigned_to_employee_id"), + ("Assigned Date", "assigned_date"), + ("Returned Date", "return_date"), ] row_attrs = """ @@ -85,11 +86,10 @@ class AssetHistoryNavView(HorillaNavView): search_swap_target = "#listContainer" group_by_fields = [ - ("asset_id__asset_name",_("Asset")), - ("assigned_to_employee_id",_("Employee")), - ("assigned_date",_("Assigned Date")), - ("return_date",_("Returned Date")), - + ("asset_id__asset_name", _("Asset")), + ("assigned_to_employee_id", _("Employee")), + ("assigned_date", _("Assigned Date")), + ("return_date", _("Returned Date")), ] @@ -103,17 +103,17 @@ class AssetHistoryDetailView(HorillaDetailedView): model = AssetAssignment title = _("Asset Details") header = { - "title":"asset_id", - "subtitle":"asset_id__asset_category_id", - "avatar":"assigned_to_employee_id__get_avatar" + "title": "asset_id", + "subtitle": "asset_id__asset_category_id", + "avatar": "assigned_to_employee_id__get_avatar", } body = [ - (_("Allocated User"),"assigned_to_employee_id"), - (_("Returned Status"),"return_status"), - (_("Allocated Date"),"assigned_date"), - (_("Returned Date"),"return_date"), - (_("Asset"),"asset_id"), - (_("Return Description"),"return_condition"), - (_("Assign Condition Images"),"assign_condition_img",True), - (_("Return Condition Images"),"return_condition_img",True) + (_("Allocated User"), "assigned_to_employee_id"), + (_("Returned Status"), "return_status"), + (_("Allocated Date"), "assigned_date"), + (_("Returned Date"), "return_date"), + (_("Asset"), "asset_id"), + (_("Return Description"), "return_condition"), + (_("Assign Condition Images"), "assign_condition_img", True), + (_("Return Condition Images"), "return_condition_img", True), ] diff --git a/asset/cbv/asset_tab.py b/asset/cbv/asset_tab.py index 0f17821ed..6a92c1916 100644 --- a/asset/cbv/asset_tab.py +++ b/asset/cbv/asset_tab.py @@ -3,12 +3,14 @@ This page is handling the cbv methods of asset tab in profile page. """ from typing import Any -from django.utils.translation import gettext_lazy as _ + from django.urls import reverse +from django.utils.translation import gettext_lazy as _ + from asset.cbv.request_and_allocation import AllocationList, AssetRequestList +from employee.cbv.employee_profile import EmployeeProfileView from employee.models import Employee from horilla_views.generic.cbv.views import HorillaTabView -from employee.cbv.employee_profile import EmployeeProfileView class AssetTabListView(AllocationList): @@ -18,12 +20,10 @@ class AssetTabListView(AllocationList): def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) - pk = self.request.resolver_match.kwargs.get('pk') - self.search_url = reverse("assets-tab-list-view",kwargs= {'pk': pk} ) + pk = self.request.resolver_match.kwargs.get("pk") + self.search_url = reverse("assets-tab-list-view", kwargs={"pk": pk}) self.view_id = "asset-div" - - columns = AllocationList.columns + [ (_("Status"), "status_display"), (_("Assigned Date"), "assigned_date_display"), @@ -46,10 +46,11 @@ class AssetRequestTab(AssetRequestList): """ Asset request tab """ + def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) - pk = self.request.resolver_match.kwargs.get('pk') - self.search_url = reverse("asset-request-tab-list-view",kwargs= {'pk': pk} ) + pk = self.request.resolver_match.kwargs.get("pk") + self.search_url = reverse("asset-request-tab-list-view", kwargs={"pk": pk}) self.view_id = "asset-request-div" def get_queryset(self): @@ -93,7 +94,7 @@ class AssetTabView(HorillaTabView): "actions": [ { "action": "Create Request", - "accessibility" :"asset.cbv.accessibility.create_asset_request_accessibility", + "accessibility": "asset.cbv.accessibility.create_asset_request_accessibility", "attrs": f""" data-toggle="oh-modal-toggle" data-target="#genericModal" diff --git a/asset/cbv/dashboard.py b/asset/cbv/dashboard.py index 2bbb78ede..adf7c422c 100644 --- a/asset/cbv/dashboard.py +++ b/asset/cbv/dashboard.py @@ -1,13 +1,15 @@ from typing import Any + from django.urls import reverse from django.utils.decorators import method_decorator + from asset.cbv.request_and_allocation import AssetAllocationList, AssetRequestList from base.methods import filtersubordinates -from horilla_views.generic.cbv.views import HorillaListView from horilla_views.cbv_methods import login_required, permission_required +from horilla_views.generic.cbv.views import HorillaListView -@method_decorator(login_required,name="dispatch") +@method_decorator(login_required, name="dispatch") class AssetRequestToApprove(AssetRequestList): """ Asset request to approve in dashboard @@ -35,7 +37,7 @@ class AssetRequestToApprove(AssetRequestList): field="requested_employee_id", ) return queryset - + header_attrs = { "requested_employee_id": """ style ="width:100px !important" @@ -51,11 +53,12 @@ class AssetRequestToApprove(AssetRequestList): """, "action": """ style ="width:100px !important" - """ + """, } -@method_decorator(login_required,name="dispatch") -@method_decorator(permission_required("asset.view_assetcategory"),name="dispatch") + +@method_decorator(login_required, name="dispatch") +@method_decorator(permission_required("asset.view_assetcategory"), name="dispatch") class AllocatedAssetsList(AssetAllocationList): """ List of allocated assets in dashboard diff --git a/asset/cbv/request_and_allocation.py b/asset/cbv/request_and_allocation.py index d56572559..65e9a7510 100644 --- a/asset/cbv/request_and_allocation.py +++ b/asset/cbv/request_and_allocation.py @@ -3,18 +3,19 @@ Request and allocation page """ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator -from django.contrib import messages +from django.utils.translation import gettext_lazy as _ + from asset.filters import AssetAllocationFilter, AssetRequestFilter, CustomAssetFilter from asset.forms import AssetAllocationForm, AssetRequestForm from asset.models import Asset, AssetAssignment, AssetRequest, ReturnImages from base.methods import filtersubordinates from employee.models import Employee -from notifications.signals import notify from horilla.horilla_middlewares import _thread_locals from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( @@ -25,6 +26,7 @@ from horilla_views.generic.cbv.views import ( HorillaTabView, TemplateView, ) +from notifications.signals import notify @method_decorator(login_required, name="dispatch") @@ -44,9 +46,7 @@ class AllocationList(HorillaListView): # view_id = "view-container" - bulk_update_fields = [ - "asset_id__expiry_date" - ] + bulk_update_fields = ["asset_id__expiry_date"] model = AssetAssignment filter_class = AssetAllocationFilter @@ -61,25 +61,24 @@ class AllocationList(HorillaListView): (_("Expiry Date"), "asset_id__expiry_date"), ] - header_attrs = { - "action" : """ + "action": """ style = "width:180px !important" """, - "asset_id__asset_name" :""" + "asset_id__asset_name": """ style = "width:250px !important" """, - "asset_id__asset_category_id" : """ + "asset_id__asset_category_id": """ style = "width:250px !important" """, - "asset_id__expiry_date" : """ + "asset_id__expiry_date": """ style = "width:250px !important" """, } sortby_mapping = [ ("Category", "asset_id__asset_category_id__asset_category_name"), - ("Expiry Date", "asset_id__expiry_date") + ("Expiry Date", "asset_id__expiry_date"), ] action_method = "asset_action" @@ -112,8 +111,6 @@ class AssetList(AllocationList): return queryset selected_instances_key_id = "assetlistInstances" - - @method_decorator(login_required, name="dispatch") @@ -138,7 +135,7 @@ class AssetAllocationList(AllocationList): ] sortby_mapping = [ - ("Allocated User","assigned_to_employee_id__get_full_name"), + ("Allocated User", "assigned_to_employee_id__get_full_name"), ("Asset", "asset_id__asset_name"), ("Assigned Date", "assigned_date"), ("Return Date", "return_status_col"), @@ -198,13 +195,13 @@ class AssetRequestList(HorillaListView): ] header_attrs = { - "action" : """ + "action": """ style = "width:180px !important" """ } sortby_mapping = [ - ("Request User","requested_employee_id__get_full_name"), + ("Request User", "requested_employee_id__get_full_name"), ("Asset Category", "asset_category_id__asset_category_name"), ("Requested Date", "asset_request_date"), ("Status", "status_col"), @@ -402,10 +399,10 @@ class AssetRequestCreateForm(HorillaFormView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - if self.request.GET.get('pk'): - pk = self.request.GET.get('pk') - self.form.fields["requested_employee_id"].queryset = Employee.objects.filter( - id=pk + if self.request.GET.get("pk"): + pk = self.request.GET.get("pk") + self.form.fields["requested_employee_id"].queryset = ( + Employee.objects.filter(id=pk) ) self.form.fields["requested_employee_id"].initial = pk return context @@ -423,7 +420,7 @@ class AssetRequestCreateForm(HorillaFormView): @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required(perm="asset.add_asset"),name="dispatch") +@method_decorator(permission_required(perm="asset.add_asset"), name="dispatch") class AssetAllocationFormView(HorillaFormView): """ Create Asset Allocation @@ -434,8 +431,6 @@ class AssetAllocationFormView(HorillaFormView): template_name = "cbv/request_and_allocation/forms/allo_form.html" new_display_title = _("Asset Allocation") - - def form_valid(self, form: AssetAllocationForm) -> HttpResponse: """ form valid function @@ -459,7 +454,7 @@ class AssetAllocationFormView(HorillaFormView): messages.success(self.request, message) return self.HttpResponse() return super().form_valid(form) - + class AssetApproveFormView(HorillaFormView): """ @@ -473,15 +468,19 @@ class AssetApproveFormView(HorillaFormView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - req_id = self.kwargs.get('req_id') + req_id = self.kwargs.get("req_id") asset_request = AssetRequest.objects.filter(id=req_id).first() asset_category = asset_request.asset_category_id assets = asset_category.asset_set.filter(asset_status="Available") self.form.fields["asset_id"].queryset = assets - self.form.fields["assigned_to_employee_id"].initial = asset_request.requested_employee_id - self.form.fields["assigned_by_employee_id"].initial = self.request.user.employee_get + self.form.fields["assigned_to_employee_id"].initial = ( + asset_request.requested_employee_id + ) + self.form.fields["assigned_by_employee_id"].initial = ( + self.request.user.employee_get + ) return context - + def form_invalid(self, form: Any) -> HttpResponse: if not form.is_valid(): errors = form.errors.as_data() @@ -490,12 +489,11 @@ class AssetApproveFormView(HorillaFormView): ) return super().form_invalid(form) - def form_valid(self, form: AssetAllocationForm) -> HttpResponse: """ form valid function """ - req_id = self.kwargs.get('req_id') + req_id = self.kwargs.get("req_id") asset_request = AssetRequest.objects.filter(id=req_id).first() if form.is_valid(): asset = form.instance.asset_id.id @@ -533,12 +531,3 @@ class AssetApproveFormView(HorillaFormView): ) return HttpResponse("") return super().form_valid(form) - - - - - - - - - diff --git a/asset/templates/cbv/asset_batch_no/actions.html b/asset/templates/cbv/asset_batch_no/actions.html index c3f6600c1..01ff5e965 100644 --- a/asset/templates/cbv/asset_batch_no/actions.html +++ b/asset/templates/cbv/asset_batch_no/actions.html @@ -18,7 +18,7 @@ aria-label="create outline" > - {% endif %} + {% endif %} {% if perms.asset.delete_assetlot %}
- {% endif%} \ No newline at end of file + {% endif%} diff --git a/asset/templates/cbv/asset_batch_no/asset_batch_no.html b/asset/templates/cbv/asset_batch_no/asset_batch_no.html index e9211df61..28f852123 100644 --- a/asset/templates/cbv/asset_batch_no/asset_batch_no.html +++ b/asset/templates/cbv/asset_batch_no/asset_batch_no.html @@ -28,9 +28,9 @@ style="display: none" > - -
@@ -39,5 +39,5 @@ - -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/asset/templates/cbv/asset_batch_no/assets_col.html b/asset/templates/cbv/asset_batch_no/assets_col.html index 4a41b29f5..cdfad46fb 100644 --- a/asset/templates/cbv/asset_batch_no/assets_col.html +++ b/asset/templates/cbv/asset_batch_no/assets_col.html @@ -1,5 +1,5 @@ {% load i18n %} - {{instance.asset_set.count}} + {{instance.asset_set.count}} {% trans "Assets" %} - \ No newline at end of file + diff --git a/asset/templates/cbv/asset_category/detail_view_action.html b/asset/templates/cbv/asset_category/detail_view_action.html index 658811c57..9155e5237 100644 --- a/asset/templates/cbv/asset_category/detail_view_action.html +++ b/asset/templates/cbv/asset_category/detail_view_action.html @@ -9,11 +9,11 @@ {{ message }}
- + {%if message.tags == "oh-alert--success" %} - {% endif %} + hx-target="#assetCategory{{instance.asset_category_id.id}}"> + {% endif %} {% endfor %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/asset/templates/cbv/asset_category/filter.html b/asset/templates/cbv/asset_category/filter.html index fd2ac9588..6737c8ca9 100644 --- a/asset/templates/cbv/asset_category/filter.html +++ b/asset/templates/cbv/asset_category/filter.html @@ -50,4 +50,4 @@ {% comment %}
{% endcomment %} - \ No newline at end of file + diff --git a/asset/templates/cbv/asset_history/asset_history_filter.html b/asset/templates/cbv/asset_history/asset_history_filter.html index daeb6849e..b87d214c7 100644 --- a/asset/templates/cbv/asset_history/asset_history_filter.html +++ b/asset/templates/cbv/asset_history/asset_history_filter.html @@ -109,4 +109,4 @@ - \ No newline at end of file + diff --git a/asset/templates/cbv/asset_history/asset_history_home.html b/asset/templates/cbv/asset_history/asset_history_home.html index c38d5e27c..ac279f554 100644 --- a/asset/templates/cbv/asset_history/asset_history_home.html +++ b/asset/templates/cbv/asset_history/asset_history_home.html @@ -14,17 +14,17 @@ .approved-True{ border-left: 3.4px solid yellowgreen !important; border-radius: 4px 0 0 4px; - + } .canceled-True { - + border-left: 3.4px solid red !important; border-radius: 4px 0 0 4px; - + }
-
+ {% include "generic/components.html" %}
-
@@ -44,7 +44,7 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/asset/templates/cbv/request_and_allocation/asset_allocation_action.html b/asset/templates/cbv/request_and_allocation/asset_allocation_action.html index 7cac37ea8..cd1e72009 100644 --- a/asset/templates/cbv/request_and_allocation/asset_allocation_action.html +++ b/asset/templates/cbv/request_and_allocation/asset_allocation_action.html @@ -22,4 +22,4 @@ {% trans "Returned" %}
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/asset/templates/cbv/request_and_allocation/asset_detail_action.html b/asset/templates/cbv/request_and_allocation/asset_detail_action.html index 96ad86cc8..341fc7ae6 100644 --- a/asset/templates/cbv/request_and_allocation/asset_detail_action.html +++ b/asset/templates/cbv/request_and_allocation/asset_detail_action.html @@ -29,4 +29,4 @@ {% endif %} {% endif %} - \ No newline at end of file + diff --git a/asset/templates/cbv/request_and_allocation/asset_request_detail_action.html b/asset/templates/cbv/request_and_allocation/asset_request_detail_action.html index f076a5a7d..c3638a843 100644 --- a/asset/templates/cbv/request_and_allocation/asset_request_detail_action.html +++ b/asset/templates/cbv/request_and_allocation/asset_request_detail_action.html @@ -27,4 +27,4 @@ {% endif %} {% endif %} - \ No newline at end of file + diff --git a/asset/templates/cbv/request_and_allocation/detail_action_asset_allocation.html b/asset/templates/cbv/request_and_allocation/detail_action_asset_allocation.html index d22d59942..30cbfdf2e 100644 --- a/asset/templates/cbv/request_and_allocation/detail_action_asset_allocation.html +++ b/asset/templates/cbv/request_and_allocation/detail_action_asset_allocation.html @@ -12,4 +12,4 @@ {% trans "Return" %} {% endif %} - \ No newline at end of file + diff --git a/asset/templates/cbv/request_and_allocation/filter.html b/asset/templates/cbv/request_and_allocation/filter.html index 8e10f429c..bd7fc238e 100644 --- a/asset/templates/cbv/request_and_allocation/filter.html +++ b/asset/templates/cbv/request_and_allocation/filter.html @@ -141,4 +141,4 @@ {% endif %} - \ No newline at end of file + diff --git a/asset/templates/cbv/request_and_allocation/forms/allo_form.html b/asset/templates/cbv/request_and_allocation/forms/allo_form.html index f7a09219a..a02b4cd5f 100644 --- a/asset/templates/cbv/request_and_allocation/forms/allo_form.html +++ b/asset/templates/cbv/request_and_allocation/forms/allo_form.html @@ -7,5 +7,5 @@ $("label[for='id_assigned_to_employee_id']").text("Assigned To"); $("label[for='id_assigned_by_employee_id']").text("Assigned By"); $("label[for='id_assign_images']").text("Assign Condition Images"); - - \ No newline at end of file + + diff --git a/asset/templates/cbv/request_and_allocation/forms/asset_approve_form.html b/asset/templates/cbv/request_and_allocation/forms/asset_approve_form.html index a0feb33a6..951e326f4 100644 --- a/asset/templates/cbv/request_and_allocation/forms/asset_approve_form.html +++ b/asset/templates/cbv/request_and_allocation/forms/asset_approve_form.html @@ -4,8 +4,8 @@ \ No newline at end of file + + diff --git a/asset/templates/cbv/request_and_allocation/forms/req_form.html b/asset/templates/cbv/request_and_allocation/forms/req_form.html index 7828e3df3..243688ebe 100644 --- a/asset/templates/cbv/request_and_allocation/forms/req_form.html +++ b/asset/templates/cbv/request_and_allocation/forms/req_form.html @@ -5,4 +5,4 @@ $("#dynamic_field_asset_request_status").parent().hide(); $("label[for='id_requested_employee_id']").text("Requesting User"); $("label[for='id_asset_category_id']").text("Asset Category"); - \ No newline at end of file + diff --git a/asset/templates/cbv/request_and_allocation/request_and_allocation.html b/asset/templates/cbv/request_and_allocation/request_and_allocation.html index 5c264191d..1d589210e 100644 --- a/asset/templates/cbv/request_and_allocation/request_and_allocation.html +++ b/asset/templates/cbv/request_and_allocation/request_and_allocation.html @@ -23,7 +23,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -33,9 +33,9 @@ - -
@@ -90,11 +90,11 @@ aria-hidden="true" ") - return HttpResponse("") + return HttpResponse( + "" + ) + return HttpResponse( + "" + ) return super().form_valid(form) - EmployeeShiftListView.columns.append((_("Grace Time"), "get_grace_time")) EmployeeShiftListView.sortby_mapping.append(("Grace Time", "grace_time_id")) EmployeeShiftListView.bulk_update_fields.append("grace_time_id") - diff --git a/attendance/cbv/hour_account.py b/attendance/cbv/hour_account.py index e644d0bc9..2eba97b4c 100644 --- a/attendance/cbv/hour_account.py +++ b/attendance/cbv/hour_account.py @@ -3,12 +3,14 @@ Hour account page """ from typing import Any + from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ + from attendance.filters import AttendanceOverTimeFilter from attendance.forms import AttendanceOverTimeExportForm, AttendanceOverTimeForm from attendance.models import AttendanceOverTime @@ -32,6 +34,7 @@ class HourAccount(TemplateView): template_name = "cbv/hour_account/hour_account.html" + @method_decorator(login_required, name="dispatch") class HourAccountList(HorillaListView): """ @@ -46,9 +49,7 @@ class HourAccountList(HorillaListView): self.search_url = reverse("attendance-ot-search") self.view_id = "ot-table" - if self.request.user.has_perm( - "attendance.add_attendanceovertime" - ): + if self.request.user.has_perm("attendance.add_attendanceovertime"): self.action_method = "hour_actions" def get_queryset(self): @@ -72,15 +73,15 @@ class HourAccountList(HorillaListView): ] header_attrs = { - "employee_id" : """ + "employee_id": """ style='width:200px !important' """, - "not_approved_ot_hrs" : """ + "not_approved_ot_hrs": """ style='width:180px !important' """, - "action" : """ - style="width:160px !important" - """ + "action": """ + style="width:160px !important" + """, } row_attrs = """ @@ -98,6 +99,7 @@ class HourAccountList(HorillaListView): ] records_per_page = 20 + @method_decorator(login_required, name="dispatch") class HourAccountNav(HorillaNavView): """ @@ -165,7 +167,10 @@ class HourAccountNav(HorillaNavView): ("month", _("Month")), ("year", _("Year")), ("employee_id__country", _("Country")), - ("employee_id__employee_work_info__reporting_manager_id", _("Reporting Manager")), + ( + "employee_id__employee_work_info__reporting_manager_id", + _("Reporting Manager"), + ), ("employee_id__employee_work_info__shift_id", _("Shift")), ("employee_id__employee_work_info__work_type_id", _("Work Type")), ("employee_id__employee_work_info__department_id", _("Department")), @@ -174,6 +179,7 @@ class HourAccountNav(HorillaNavView): ("employee_id__employee_work_info__company_id", _("Company")), ] + @method_decorator(login_required, name="dispatch") class HourExportView(TemplateView): """ @@ -191,6 +197,7 @@ class HourExportView(TemplateView): context["export_obj"] = export_obj return context + @method_decorator(login_required, name="dispatch") class HourAccountDetailView(HorillaDetailedView): """ @@ -216,8 +223,11 @@ class HourAccountDetailView(HorillaDetailedView): action_method = "hour_detail_actions" + @method_decorator(login_required, name="dispatch") -@method_decorator(manager_can_enter("attendance.add_attendanceovertime"),name='dispatch') +@method_decorator( + manager_can_enter("attendance.add_attendanceovertime"), name="dispatch" +) class HourAccountFormView(HorillaFormView): """ Form View diff --git a/attendance/cbv/late_come_and_early_out.py b/attendance/cbv/late_come_and_early_out.py index eff1fb870..50d695ed7 100644 --- a/attendance/cbv/late_come_and_early_out.py +++ b/attendance/cbv/late_come_and_early_out.py @@ -1,10 +1,13 @@ """ Late come and early out page """ + from typing import Any + from django.urls import reverse -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from attendance.filters import LateComeEarlyOutFilter from attendance.forms import LateComeEarlyOutExportForm from attendance.models import AttendanceLateComeEarlyOut @@ -13,12 +16,13 @@ from base.methods import filtersubordinates, is_reportingmanager from base.models import PenaltyAccounts from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( + HorillaDetailedView, HorillaListView, HorillaNavView, TemplateView, - HorillaDetailedView, ) + @method_decorator(login_required, name="dispatch") class LateComeAndEarlyOut(TemplateView): """ @@ -27,15 +31,14 @@ class LateComeAndEarlyOut(TemplateView): template_name = "cbv/late_come_and_early_out/late_come_and_early_out.html" + @method_decorator(login_required, name="dispatch") class LateComeAndEarlyOutList(HorillaListView): """ List view """ - filter_keys_to_remove = [ - "late_early_id" - ] + filter_keys_to_remove = ["late_early_id"] def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) @@ -85,7 +88,7 @@ class LateComeAndEarlyOutList(HorillaListView): ] header_attrs = { - "penalities_column" :""" + "penalities_column": """ style ="width:170px !important" """ } @@ -100,9 +103,9 @@ class LateComeAndEarlyOutList(HorillaListView): ("Out Date", "attendance_id__attendance_clock_out_date"), ("At Work", "attendance_id__attendance_worked_hour"), ("Min Hour", "attendance_id__minimum_hour"), - ] + @method_decorator(login_required, name="dispatch") class LateComeAndEarlyOutListNav(HorillaNavView): """ @@ -172,7 +175,10 @@ class LateComeAndEarlyOutListNav(HorillaNavView): "attendance_id__employee_id__employee_work_info__reporting_manager_id", _("Reporting Manager"), ), - ("attendance_id__employee_id__employee_work_info__department_id", _("Department")), + ( + "attendance_id__employee_id__employee_work_info__department_id", + _("Department"), + ), ( "attendance_id__employee_id__employee_work_info__job_position_id", _("Job Position"), @@ -202,6 +208,7 @@ class LateEarlyExportView(TemplateView): context["export"] = export return context + @method_decorator(login_required, name="dispatch") class LateComeEarlyOutDetailView(HorillaDetailedView): """ @@ -233,4 +240,3 @@ class LateComeEarlyOutDetailView(HorillaDetailedView): ] action_method = "detail_actions" - diff --git a/attendance/cbv/my_attendances.py b/attendance/cbv/my_attendances.py index f699fd768..1b6de9d4b 100644 --- a/attendance/cbv/my_attendances.py +++ b/attendance/cbv/my_attendances.py @@ -5,16 +5,17 @@ My attendances from typing import Any from django.urls import reverse -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from attendance.filters import AttendanceFilters from attendance.models import Attendance from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( + HorillaDetailedView, HorillaListView, HorillaNavView, TemplateView, - HorillaDetailedView, ) @@ -26,9 +27,8 @@ class MyAttendances(TemplateView): template_name = "cbv/my_attendances/my_attendances.html" -class MyAttendancesListView(HorillaListView): - +class MyAttendancesListView(HorillaListView): model = Attendance filter_class = AttendanceFilters @@ -73,12 +73,12 @@ class MyAttendancesListView(HorillaListView): ] - @method_decorator(login_required, name="dispatch") class MyAttendanceList(MyAttendancesListView): """ List view """ + def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.search_url = reverse("my-attendance-list") @@ -93,7 +93,7 @@ class MyAttendanceList(MyAttendancesListView): $('[name=attendance_validated]').val('unknown').change(); $('[name=is_validate_request]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -106,7 +106,7 @@ class MyAttendanceList(MyAttendancesListView): $('[name=attendance_validated]').val('unknown').change(); $('[name=is_validate_request_approved]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -131,7 +131,7 @@ class MyAttendanceList(MyAttendancesListView): $('[name=is_validate_request]').val('unknown').change(); $('[name=is_validate_request_approved]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -145,9 +145,6 @@ class MyAttendanceList(MyAttendancesListView): queryset = queryset.filter(employee_id=employee) return queryset - - - @method_decorator(login_required, name="dispatch") class MyAttendancestNav(HorillaNavView): diff --git a/attendance/static/cbv/attendance/hour_account.js b/attendance/static/cbv/attendance/hour_account.js index e683b9796..40722fa19 100644 --- a/attendance/static/cbv/attendance/hour_account.js +++ b/attendance/static/cbv/attendance/hour_account.js @@ -84,7 +84,7 @@ var downloadMessages = { en: "Do you really want to approve all the selected attendance requests?", fr: "Voulez-vous vraiment approuver toutes les demandes de présence sélectionnées?", }; - + var reqAttendancRejectMessages = { ar: "هل ترغب حقًا في رفض جميع طلبات الحضور المحددة؟", de: "Möchten Sie wirklich alle ausgewählten Anwesenheitsanfragen ablehnen?", @@ -92,22 +92,22 @@ var downloadMessages = { en: "Do you really want to reject all the selected attendance requests?", fr: "Voulez-vous vraiment rejeter toutes les demandes de présence sélectionnées?", }; - + tickCheckboxes(); function makeListUnique(list) { return Array.from(new Set(list)); } - + tickactivityCheckboxes(); function makeactivityListUnique(list) { return Array.from(new Set(list)); } - + ticklatecomeCheckboxes(); function makelatecomeListUnique(list) { return Array.from(new Set(list)); } - + function getCurrentLanguageCode(callback) { var languageCode = $("#main-section-data").attr("data-lang"); var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"]; @@ -135,7 +135,7 @@ var downloadMessages = { function hourAccountbulkDelete() { - + var languageCode = null; getCurrentLanguageCode(function (code) { languageCode = code; @@ -184,7 +184,7 @@ var downloadMessages = { function lateComeBulkDelete() { - + var languageCode = null; getCurrentLanguageCode(function (code) { languageCode = code; @@ -276,7 +276,7 @@ var downloadMessages = { } }); }; - + function reqAttendanceBulkReject() { var languageCode = null; @@ -322,6 +322,3 @@ var downloadMessages = { } }); }; - - - \ No newline at end of file diff --git a/attendance/static/cbv/attendance_activity.js b/attendance/static/cbv/attendance_activity.js index 6728f1270..d4ac91a76 100644 --- a/attendance/static/cbv/attendance_activity.js +++ b/attendance/static/cbv/attendance_activity.js @@ -68,7 +68,7 @@ var downloadMessages = { en: "Do you really want to approve all the selected attendance requests?", fr: "Voulez-vous vraiment approuver toutes les demandes de présence sélectionnées?", }; - + var reqAttendanceApproveMessages = { ar: "هل ترغب حقًا في رفض جميع طلبات الحضور المحددة؟", de: "Möchten Sie wirklich alle ausgewählten Anwesenheitsanfragen ablehnen?", @@ -76,22 +76,22 @@ var downloadMessages = { en: "Do you really want to reject all the selected attendance requests?", fr: "Voulez-vous vraiment rejeter toutes les demandes de présence sélectionnées?", }; - + tickCheckboxes(); function makeListUnique(list) { return Array.from(new Set(list)); } - + tickactivityCheckboxes(); function makeactivityListUnique(list) { return Array.from(new Set(list)); } - + ticklatecomeCheckboxes(); function makelatecomeListUnique(list) { return Array.from(new Set(list)); } - + function getCurrentLanguageCode(callback) { var languageCode = $("#main-section-data").attr("data-lang"); var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"]; @@ -116,8 +116,8 @@ var downloadMessages = { }); } } - - + + function getCookie(name) { let cookieValue = null; if (document.cookie && document.cookie !== "") { @@ -134,9 +134,9 @@ var downloadMessages = { return cookieValue; } - - + + function deleteAttendanceNav() { var languageCode = null; getCurrentLanguageCode(function (code) { @@ -185,7 +185,7 @@ function deleteAttendanceNav() { } - function importAttendanceNav() { + function importAttendanceNav() { var languageCode = null; getCurrentLanguageCode(function (code) { languageCode = code; @@ -228,7 +228,7 @@ function deleteAttendanceNav() { - function importAttendanceActivity() { + function importAttendanceActivity() { var languageCode = null; getCurrentLanguageCode(function (code) { languageCode = code; @@ -317,7 +317,7 @@ function deleteAttendanceNav() { }); } - + function showApproveAlert(dataReqValue) { @@ -385,7 +385,7 @@ function deleteAttendanceNav() { } }); } - + function otBulkValidateTabAttendance(dataReqValue) { var languageCode = null; getCurrentLanguageCode(function (code) { @@ -414,7 +414,7 @@ function deleteAttendanceNav() { ids = []; ids.push($("#overtimeselectedInstances").attr("data-ids")); ids = JSON.parse($("#overtimeselectedInstances").attr("data-ids")); - + $.ajax({ type: "POST", url: "/attendance/approve-bulk-overtime", @@ -434,5 +434,3 @@ function deleteAttendanceNav() { } }); } - - \ No newline at end of file diff --git a/attendance/templates/cbv/attendance_activity/attendance_activity_home.html b/attendance/templates/cbv/attendance_activity/attendance_activity_home.html index 2c0eb254f..759e082ac 100644 --- a/attendance/templates/cbv/attendance_activity/attendance_activity_home.html +++ b/attendance/templates/cbv/attendance_activity/attendance_activity_home.html @@ -14,17 +14,17 @@ .approved-True{ border-left: 3.4px solid yellowgreen !important; border-radius: 4px 0 0 4px; - + } .canceled-True { - + border-left: 3.4px solid red !important; border-radius: 4px 0 0 4px; - + }
-
+
{% include "generic/components.html" %}
-
-
+
@@ -134,6 +134,6 @@ id="workTypeRequestUpdateModalBody" }); }); {% endcomment %} - -{% endblock content %} \ No newline at end of file + +{% endblock content %} diff --git a/attendance/templates/cbv/attendance_activity/delete_action.html b/attendance/templates/cbv/attendance_activity/delete_action.html index 271b30d09..bad7ea14e 100644 --- a/attendance/templates/cbv/attendance_activity/delete_action.html +++ b/attendance/templates/cbv/attendance_activity/delete_action.html @@ -8,6 +8,3 @@ - - - diff --git a/attendance/templates/cbv/attendance_activity/delete_inherit.html b/attendance/templates/cbv/attendance_activity/delete_inherit.html index 11c13c6fe..df19e774e 100644 --- a/attendance/templates/cbv/attendance_activity/delete_inherit.html +++ b/attendance/templates/cbv/attendance_activity/delete_inherit.html @@ -5,4 +5,4 @@ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/attendance/templates/cbv/attendance_activity/detail_delete_action.html b/attendance/templates/cbv/attendance_activity/detail_delete_action.html index 039c46121..35272bccf 100644 --- a/attendance/templates/cbv/attendance_activity/detail_delete_action.html +++ b/attendance/templates/cbv/attendance_activity/detail_delete_action.html @@ -17,4 +17,3 @@ $('.reload-record').click(); {% endif %} - diff --git a/attendance/templates/cbv/attendance_activity/filter.html b/attendance/templates/cbv/attendance_activity/filter.html index b75a994a9..894fd9551 100644 --- a/attendance/templates/cbv/attendance_activity/filter.html +++ b/attendance/templates/cbv/attendance_activity/filter.html @@ -105,4 +105,4 @@ - \ No newline at end of file + diff --git a/attendance/templates/cbv/attendance_request/attendance_request.html b/attendance/templates/cbv/attendance_request/attendance_request.html index c638263bf..1e72836cf 100644 --- a/attendance/templates/cbv/attendance_request/attendance_request.html +++ b/attendance/templates/cbv/attendance_request/attendance_request.html @@ -28,13 +28,13 @@ border-left: 3.4px solid rgba(128, 128, 128, 0.482) !important; border-radius: 4px 0 0 4px; - + } .bulk-request--dot { background-color:rgb(31 122 220 / 48%); - + } .diff-cell{ @@ -44,7 +44,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -60,8 +60,8 @@ style="display: none" > -
@@ -133,6 +133,6 @@
- - -{% endblock content %} \ No newline at end of file + + +{% endblock content %} diff --git a/attendance/templates/cbv/attendance_request/attendance_request_tab.html b/attendance/templates/cbv/attendance_request/attendance_request_tab.html index 432f9b031..14a1efec8 100644 --- a/attendance/templates/cbv/attendance_request/attendance_request_tab.html +++ b/attendance/templates/cbv/attendance_request/attendance_request_tab.html @@ -23,7 +23,7 @@ {% include "generic/quick_actions.html" %} {% endif %} - +
@@ -73,7 +73,7 @@ {% for cell in columns %} {% with cell_attr=header_attrs|get_item:cell.1 %} -
{% for instance in queryset %} - @@ -138,7 +138,7 @@ {% endif %} {% for cell in columns %} - {% with attribute=cell.1 index=forloop.counter %} + {% with attribute=cell.1 index=forloop.counter %} selectSelected("#{{view_id|safe}}",'{{selected_instances_key_id}}') - {% endif %} + {% endif %} {% endif %} - {% endif %} + {% endif %} {% endif %} -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/attendance/templates/cbv/hour_account/hour_account_main.html b/attendance/templates/cbv/hour_account/hour_account_main.html index 6ce9327b1..3c726089b 100644 --- a/attendance/templates/cbv/hour_account/hour_account_main.html +++ b/attendance/templates/cbv/hour_account/hour_account_main.html @@ -5,4 +5,4 @@ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/attendance/templates/cbv/hour_account/hour_actions.html b/attendance/templates/cbv/hour_account/hour_actions.html index 4de9247ea..b8ac9802d 100644 --- a/attendance/templates/cbv/hour_account/hour_actions.html +++ b/attendance/templates/cbv/hour_account/hour_actions.html @@ -17,7 +17,3 @@
{% endif %} - - - - \ No newline at end of file diff --git a/attendance/templates/cbv/hour_account/hour_detail_action.html b/attendance/templates/cbv/hour_account/hour_detail_action.html index 06e2fcd0a..ba045c92e 100644 --- a/attendance/templates/cbv/hour_account/hour_detail_action.html +++ b/attendance/templates/cbv/hour_account/hour_detail_action.html @@ -4,7 +4,7 @@ {% with dates=instance.month_days %} {% if perms.attendance.view_attendance or request.user|is_reportingmanager %} - -
\ No newline at end of file +
diff --git a/attendance/templates/cbv/hour_account/nav_hour_account.html b/attendance/templates/cbv/hour_account/nav_hour_account.html index eb46c58ca..f3be9b6d5 100644 --- a/attendance/templates/cbv/hour_account/nav_hour_account.html +++ b/attendance/templates/cbv/hour_account/nav_hour_account.html @@ -6,6 +6,6 @@ var currentYear = new Date().getFullYear(); $('#applyFilter').closest('form').find('[name=year]').val(currentYear); $('#applyFilter').closest('form').find('[name=field]').val('month'); - $('#applyFilter').click(); - - \ No newline at end of file + $('#applyFilter').click(); + + diff --git a/attendance/templates/cbv/late_come_and_early_out/actions_column.html b/attendance/templates/cbv/late_come_and_early_out/actions_column.html index 21e6d6c45..62acb9cc2 100644 --- a/attendance/templates/cbv/late_come_and_early_out/actions_column.html +++ b/attendance/templates/cbv/late_come_and_early_out/actions_column.html @@ -30,4 +30,4 @@ {% endif %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/attendance/templates/cbv/late_come_and_early_out/detail_action.html b/attendance/templates/cbv/late_come_and_early_out/detail_action.html index bf1ab8a0f..9b271d7d8 100644 --- a/attendance/templates/cbv/late_come_and_early_out/detail_action.html +++ b/attendance/templates/cbv/late_come_and_early_out/detail_action.html @@ -11,7 +11,7 @@ hx-get="{% url "cut-penalty" instance.id %}" style="width: 50%;" > - + {% trans "Penalty" %} @@ -33,11 +33,11 @@ >{% trans "Delete" %} {% endif %} - + {% endif %} {% if request.GET.deleted %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/attendance/templates/cbv/late_come_and_early_out/late_come_and_early_out.html b/attendance/templates/cbv/late_come_and_early_out/late_come_and_early_out.html index c974c91c6..547713f75 100644 --- a/attendance/templates/cbv/late_come_and_early_out/late_come_and_early_out.html +++ b/attendance/templates/cbv/late_come_and_early_out/late_come_and_early_out.html @@ -60,7 +60,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -76,9 +76,9 @@ style="display: none" > - -
@@ -130,7 +130,7 @@ onsubmit="event.stopPropagation();$(this).parents().find('.oh-modal--show').last().toggleClass('oh-modal--show');" id="attendanceExportForm" > - {% csrf_token %} + {% csrf_token %}
- + - - -{% endblock content %} \ No newline at end of file + + +{% endblock content %} diff --git a/attendance/templates/cbv/late_come_and_early_out/penality.html b/attendance/templates/cbv/late_come_and_early_out/penality.html index 8830f2253..55febe700 100644 --- a/attendance/templates/cbv/late_come_and_early_out/penality.html +++ b/attendance/templates/cbv/late_come_and_early_out/penality.html @@ -4,4 +4,4 @@
Penalties :{{instance.get_penalties_count}}
{% else %}
No Penalties
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/attendance/templates/cbv/my_attendances/my_attendances.html b/attendance/templates/cbv/my_attendances/my_attendances.html index 3566d4f0d..5bdc2b19e 100644 --- a/attendance/templates/cbv/my_attendances/my_attendances.html +++ b/attendance/templates/cbv/my_attendances/my_attendances.html @@ -61,7 +61,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -77,9 +77,9 @@ style="display: none" > - -
@@ -94,6 +94,6 @@ - - -{% endblock content %} \ No newline at end of file + + +{% endblock content %} diff --git a/attendance/templates/cbv/settings/applicable_on_clock_in_col.html b/attendance/templates/cbv/settings/applicable_on_clock_in_col.html index f1ca0c4ed..9ccee6c75 100644 --- a/attendance/templates/cbv/settings/applicable_on_clock_in_col.html +++ b/attendance/templates/cbv/settings/applicable_on_clock_in_col.html @@ -4,4 +4,4 @@ {% else %} {% endif %} -
\ No newline at end of file + diff --git a/attendance/templates/cbv/settings/applicable_on_clock_out_col.html b/attendance/templates/cbv/settings/applicable_on_clock_out_col.html index 1639b3482..f0c5a8fe1 100644 --- a/attendance/templates/cbv/settings/applicable_on_clock_out_col.html +++ b/attendance/templates/cbv/settings/applicable_on_clock_out_col.html @@ -4,4 +4,4 @@ {% else %} {% endif %} - \ No newline at end of file + diff --git a/attendance/templates/cbv/settings/break_point_action.html b/attendance/templates/cbv/settings/break_point_action.html index 931dba837..447232887 100644 --- a/attendance/templates/cbv/settings/break_point_action.html +++ b/attendance/templates/cbv/settings/break_point_action.html @@ -5,4 +5,4 @@ hx-target="#genericModalBody" type="button" class="oh-btn oh-btn--info" data-toggle="oh-modal-toggle" data-target="#genericModal">{% trans 'Edit' %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/attendance/templates/cbv/settings/check_in_check_out_col.html b/attendance/templates/cbv/settings/check_in_check_out_col.html index 5fe97eb05..fc5c66120 100644 --- a/attendance/templates/cbv/settings/check_in_check_out_col.html +++ b/attendance/templates/cbv/settings/check_in_check_out_col.html @@ -7,7 +7,7 @@ {% if perms.attendance.change_attendancegeneralsetting %} hx-post="{% url 'enable-disable-check-in' %}" hx-target="#attendance-activity-container" hx-trigger="change" hx-include="#companyId{{instance.id}}" hx-on-htmx-after-request="setTimeout(() => { reloadMessage(); }, 200);" - {% if request.session.selected_company == 'all' %} + {% if request.session.selected_company == 'all' %} {% if not instance.company_id %} hx-swap="innerHTML" {% else %} @@ -18,4 +18,4 @@ {% endif %} {% endif %} > - \ No newline at end of file + diff --git a/attendance/templates/cbv/settings/grace_time_default_action.html b/attendance/templates/cbv/settings/grace_time_default_action.html index 84cc5b1dc..ff1d10973 100644 --- a/attendance/templates/cbv/settings/grace_time_default_action.html +++ b/attendance/templates/cbv/settings/grace_time_default_action.html @@ -22,9 +22,9 @@ + {% endif %} @@ -30,4 +30,3 @@ style="display: contents;width:100%"> "" {% endif %} - diff --git a/base/templates/cbv/dashboard/announcement_title.html b/base/templates/cbv/dashboard/announcement_title.html index b936e347e..a1dcd14a7 100644 --- a/base/templates/cbv/dashboard/announcement_title.html +++ b/base/templates/cbv/dashboard/announcement_title.html @@ -20,4 +20,4 @@ {% endif %} - \ No newline at end of file + diff --git a/base/templates/cbv/dashboard/announcement_viewed_by.html b/base/templates/cbv/dashboard/announcement_viewed_by.html index 0b2a30ef4..188cb5ce6 100644 --- a/base/templates/cbv/dashboard/announcement_viewed_by.html +++ b/base/templates/cbv/dashboard/announcement_viewed_by.html @@ -7,4 +7,4 @@ {{instance.user.employee_get}} {{instance.created_at}} - \ No newline at end of file + diff --git a/base/templates/cbv/dashboard/job_position_field.html b/base/templates/cbv/dashboard/job_position_field.html index ca8d44ebb..4e54e8375 100644 --- a/base/templates/cbv/dashboard/job_position_field.html +++ b/base/templates/cbv/dashboard/job_position_field.html @@ -10,9 +10,9 @@ \ No newline at end of file + diff --git a/base/templates/cbv/dashboard/job_role_field.html b/base/templates/cbv/dashboard/job_role_field.html index 9327a83ae..c5ed4dc90 100644 --- a/base/templates/cbv/dashboard/job_role_field.html +++ b/base/templates/cbv/dashboard/job_role_field.html @@ -10,9 +10,9 @@ \ No newline at end of file + diff --git a/base/templates/cbv/holidays/detail_view_actions.html b/base/templates/cbv/holidays/detail_view_actions.html index ae34014b5..20d820dd1 100644 --- a/base/templates/cbv/holidays/detail_view_actions.html +++ b/base/templates/cbv/holidays/detail_view_actions.html @@ -1,10 +1,10 @@ {% load basefilters %} {% load i18n %} {% if perms.leave.change_holiday %} - @@ -19,9 +19,8 @@ style="display: contents;width:100%"> {% csrf_token %} + + - {% endif %} - diff --git a/base/templates/cbv/holidays/holiday_filter.html b/base/templates/cbv/holidays/holiday_filter.html index 6519530f5..ec3685017 100644 --- a/base/templates/cbv/holidays/holiday_filter.html +++ b/base/templates/cbv/holidays/holiday_filter.html @@ -25,4 +25,4 @@ - \ No newline at end of file + diff --git a/base/templates/cbv/holidays/holidays_home.html b/base/templates/cbv/holidays/holidays_home.html index 6821a826d..a3fbd0084 100644 --- a/base/templates/cbv/holidays/holidays_home.html +++ b/base/templates/cbv/holidays/holidays_home.html @@ -14,17 +14,17 @@ .approved-True{ border-left: 3.4px solid yellowgreen !important; border-radius: 4px 0 0 4px; - + } .canceled-True { - + border-left: 3.4px solid red !important; border-radius: 4px 0 0 4px; - + }
-
+ {% include "generic/components.html" %}
-
@@ -90,4 +90,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/base/templates/cbv/mail_log_tab/iframe.html b/base/templates/cbv/mail_log_tab/iframe.html index 2c4eba2f2..998f1d520 100644 --- a/base/templates/cbv/mail_log_tab/iframe.html +++ b/base/templates/cbv/mail_log_tab/iframe.html @@ -33,26 +33,25 @@ - \ No newline at end of file diff --git a/base/templates/cbv/mail_template/form_inherit.html b/base/templates/cbv/mail_template/form_inherit.html index 268068c04..f445a552f 100644 --- a/base/templates/cbv/mail_template/form_inherit.html +++ b/base/templates/cbv/mail_template/form_inherit.html @@ -2,14 +2,14 @@
{% include 'generic/horilla_form.html'%} -
+
\ No newline at end of file + diff --git a/base/templates/cbv/multiple_approval_condition/actions.html b/base/templates/cbv/multiple_approval_condition/actions.html index 1cbd62b23..6b501be6e 100644 --- a/base/templates/cbv/multiple_approval_condition/actions.html +++ b/base/templates/cbv/multiple_approval_condition/actions.html @@ -19,4 +19,4 @@ {% endif %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/base/templates/cbv/multiple_approval_condition/approval_managers.html b/base/templates/cbv/multiple_approval_condition/approval_managers.html index 3f87d5a6c..f4fb23893 100644 --- a/base/templates/cbv/multiple_approval_condition/approval_managers.html +++ b/base/templates/cbv/multiple_approval_condition/approval_managers.html @@ -1,6 +1,6 @@ {% load basefilters %}
- {% for manager in instance.approval_managers %} + {% for manager in instance.approval_managers %}
{{ forloop.counter}}. {{ manager|readable }}
{% endfor %} -
\ No newline at end of file + diff --git a/base/templates/cbv/multiple_approval_condition/detail_action.html b/base/templates/cbv/multiple_approval_condition/detail_action.html index 784c9c568..abca796f7 100644 --- a/base/templates/cbv/multiple_approval_condition/detail_action.html +++ b/base/templates/cbv/multiple_approval_condition/detail_action.html @@ -24,4 +24,4 @@ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/base/templates/cbv/multiple_approval_condition/form.html b/base/templates/cbv/multiple_approval_condition/form.html index e340c7420..7febbf6e1 100644 --- a/base/templates/cbv/multiple_approval_condition/form.html +++ b/base/templates/cbv/multiple_approval_condition/form.html @@ -17,8 +17,8 @@ diff --git a/base/templates/cbv/multiple_approval_condition/form_edit.html b/base/templates/cbv/multiple_approval_condition/form_edit.html index 2f337f015..9a256d785 100644 --- a/base/templates/cbv/multiple_approval_condition/form_edit.html +++ b/base/templates/cbv/multiple_approval_condition/form_edit.html @@ -16,8 +16,8 @@ diff --git a/base/templates/cbv/multiple_approval_condition/multiple_approval_condition.html b/base/templates/cbv/multiple_approval_condition/multiple_approval_condition.html index d0cce1a11..d2ba1f6ab 100644 --- a/base/templates/cbv/multiple_approval_condition/multiple_approval_condition.html +++ b/base/templates/cbv/multiple_approval_condition/multiple_approval_condition.html @@ -31,4 +31,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/base/templates/cbv/multiple_approval_condition/test.html b/base/templates/cbv/multiple_approval_condition/test.html index b3abc9b64..fc79bff8c 100644 --- a/base/templates/cbv/multiple_approval_condition/test.html +++ b/base/templates/cbv/multiple_approval_condition/test.html @@ -1,3 +1,3 @@
{% include "generic/horilla_list.html" %} -
\ No newline at end of file + diff --git a/base/templates/cbv/rotating_shift/actions_rotaing_shift.html b/base/templates/cbv/rotating_shift/actions_rotaing_shift.html index 0a4825c49..6202bca25 100644 --- a/base/templates/cbv/rotating_shift/actions_rotaing_shift.html +++ b/base/templates/cbv/rotating_shift/actions_rotaing_shift.html @@ -25,7 +25,7 @@ {% else %} - @@ -37,4 +37,4 @@ {% endif %} - \ No newline at end of file + diff --git a/base/templates/cbv/rotating_shift/extended_rotating_shift.html b/base/templates/cbv/rotating_shift/extended_rotating_shift.html index 80b193d54..ffad45c32 100644 --- a/base/templates/cbv/rotating_shift/extended_rotating_shift.html +++ b/base/templates/cbv/rotating_shift/extended_rotating_shift.html @@ -2,7 +2,7 @@ {% include "generic/horilla_list_table.html" %} {% if request.GET.deleted %} - -{% endif %} \ No newline at end of file +{% endif %} diff --git a/base/templates/cbv/rotating_shift/rot_shift_form.html b/base/templates/cbv/rotating_shift/rot_shift_form.html index b3bc5a25c..f81445243 100644 --- a/base/templates/cbv/rotating_shift/rot_shift_form.html +++ b/base/templates/cbv/rotating_shift/rot_shift_form.html @@ -3,8 +3,8 @@
{% include "generic/horilla_form.html" %} - - + + - - + +
\ No newline at end of file + + diff --git a/base/templates/cbv/rotating_shift/rotating_column.html b/base/templates/cbv/rotating_shift/rotating_column.html index f94021da6..6e844a65a 100644 --- a/base/templates/cbv/rotating_shift/rotating_column.html +++ b/base/templates/cbv/rotating_shift/rotating_column.html @@ -1,5 +1,5 @@ {% load i18n %} - + {% if instance.based_on == 'after' %} {% trans "Rotate after" %} {{instance.rotate_after_day}} {% trans "days" %} {% elif instance.based_on == "weekly" %} @@ -17,4 +17,3 @@ {% trans "Rotate every" %} {{instance.rotate_every}}{% trans "th day of month" %} {% endif %} {% endif %} - \ No newline at end of file diff --git a/base/templates/cbv/rotating_shift/rotating_shift.html b/base/templates/cbv/rotating_shift/rotating_shift.html index ddee3b68b..6f572e5f7 100644 --- a/base/templates/cbv/rotating_shift/rotating_shift.html +++ b/base/templates/cbv/rotating_shift/rotating_shift.html @@ -335,4 +335,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/base/templates/cbv/rotating_shift/rotating_shift_detail_actions.html b/base/templates/cbv/rotating_shift/rotating_shift_detail_actions.html index 904ff73c1..71c74c14a 100644 --- a/base/templates/cbv/rotating_shift/rotating_shift_detail_actions.html +++ b/base/templates/cbv/rotating_shift/rotating_shift_detail_actions.html @@ -73,9 +73,8 @@ {% if request.GET.detail %} - {% endif %} - \ No newline at end of file diff --git a/base/templates/cbv/rotating_shift/rotating_shift_filter.html b/base/templates/cbv/rotating_shift/rotating_shift_filter.html index 2ef9a5bf1..7686d6d81 100644 --- a/base/templates/cbv/rotating_shift/rotating_shift_filter.html +++ b/base/templates/cbv/rotating_shift/rotating_shift_filter.html @@ -85,4 +85,3 @@ - diff --git a/base/templates/cbv/rotating_shift/rshift_export.html b/base/templates/cbv/rotating_shift/rshift_export.html index b1b287ea4..9a2b917d0 100644 --- a/base/templates/cbv/rotating_shift/rshift_export.html +++ b/base/templates/cbv/rotating_shift/rshift_export.html @@ -27,4 +27,4 @@ - \ No newline at end of file + diff --git a/base/templates/cbv/rotating_work_type/extended_rotating_work.html b/base/templates/cbv/rotating_work_type/extended_rotating_work.html index 3a876c5eb..6c15cb543 100644 --- a/base/templates/cbv/rotating_work_type/extended_rotating_work.html +++ b/base/templates/cbv/rotating_work_type/extended_rotating_work.html @@ -3,6 +3,6 @@ {% if request.GET.deleted %} + {% endif %} - \ No newline at end of file + diff --git a/base/templates/cbv/rotating_work_type/filter_work_rotate.html b/base/templates/cbv/rotating_work_type/filter_work_rotate.html index ad74b6145..001b2f07f 100644 --- a/base/templates/cbv/rotating_work_type/filter_work_rotate.html +++ b/base/templates/cbv/rotating_work_type/filter_work_rotate.html @@ -33,7 +33,7 @@ - +
{% trans "Work Info" %}
@@ -68,7 +68,7 @@
- +
{% trans "Advanced" %}
@@ -82,8 +82,7 @@
- + - diff --git a/base/templates/cbv/rotating_work_type/forms/inherit.html b/base/templates/cbv/rotating_work_type/forms/inherit.html index bd24dd1ae..daca440a6 100644 --- a/base/templates/cbv/rotating_work_type/forms/inherit.html +++ b/base/templates/cbv/rotating_work_type/forms/inherit.html @@ -15,14 +15,14 @@ {% trans "Add more work types.." %} - + + 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 8d8bb6a5b..f807f85ca 100644 --- a/base/templates/cbv/rotating_work_type/forms/update_inherit.html +++ b/base/templates/cbv/rotating_work_type/forms/update_inherit.html @@ -15,8 +15,8 @@ {% trans "Add more work types.." %} - - + diff --git a/base/templates/cbv/rotating_work_type/rotate_detail_view_actions.html b/base/templates/cbv/rotating_work_type/rotate_detail_view_actions.html index ffc3e1595..701be0cce 100644 --- a/base/templates/cbv/rotating_work_type/rotate_detail_view_actions.html +++ b/base/templates/cbv/rotating_work_type/rotate_detail_view_actions.html @@ -1,8 +1,8 @@ {% load basefilters%} {% load i18n %} - - + + {% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %} $("#reloadMessagesButton").click() - + {% endif %} - - - - - - \ No newline at end of file diff --git a/base/templates/cbv/rotating_work_type/rotating_action_export.html b/base/templates/cbv/rotating_work_type/rotating_action_export.html index dcadd270b..78a913892 100644 --- a/base/templates/cbv/rotating_work_type/rotating_action_export.html +++ b/base/templates/cbv/rotating_work_type/rotating_action_export.html @@ -2,9 +2,9 @@ {% load basefilters%}
- +

- {% trans "Export Rotating Work Type Assigns" %} + {% trans "Export Rotating Work Type Assigns" %}

- \ No newline at end of file + diff --git a/base/templates/cbv/rotating_work_type/rotating_work_home.html b/base/templates/cbv/rotating_work_type/rotating_work_home.html index fafb99e16..761ef19b6 100644 --- a/base/templates/cbv/rotating_work_type/rotating_work_home.html +++ b/base/templates/cbv/rotating_work_type/rotating_work_home.html @@ -18,4 +18,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/base/templates/cbv/rotating_work_type/rotation_col.html b/base/templates/cbv/rotating_work_type/rotation_col.html index a3fb8d778..6e0c30e6b 100644 --- a/base/templates/cbv/rotating_work_type/rotation_col.html +++ b/base/templates/cbv/rotating_work_type/rotation_col.html @@ -17,4 +17,4 @@ {% else %} {% trans "Rotate every" %} {{instance.rotate_every}}{% trans "th day of month" %} {% endif %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/base/templates/cbv/rotating_work_type/work_rotate_actions.html b/base/templates/cbv/rotating_work_type/work_rotate_actions.html index 8adc82dcb..e350e7ac6 100644 --- a/base/templates/cbv/rotating_work_type/work_rotate_actions.html +++ b/base/templates/cbv/rotating_work_type/work_rotate_actions.html @@ -37,10 +37,10 @@ {% if perms.base.delete_rotatingworktypeassign or request.user|is_reportingmanager %}
- - + + {% endif %} - \ No newline at end of file + diff --git a/base/templates/cbv/settings/company_bulk_update.html b/base/templates/cbv/settings/company_bulk_update.html index 2c728199a..8c6350053 100644 --- a/base/templates/cbv/settings/company_bulk_update.html +++ b/base/templates/cbv/settings/company_bulk_update.html @@ -4,4 +4,4 @@ \ No newline at end of file + diff --git a/base/templates/cbv/settings/company_inherit.html b/base/templates/cbv/settings/company_inherit.html index 23f65826e..ff3bd4a69 100644 --- a/base/templates/cbv/settings/company_inherit.html +++ b/base/templates/cbv/settings/company_inherit.html @@ -4,7 +4,7 @@ \ No newline at end of file + diff --git a/base/templates/cbv/settings/employee_shift_schedule_action.html b/base/templates/cbv/settings/employee_shift_schedule_action.html index 237a5af7a..a9e0db5e9 100644 --- a/base/templates/cbv/settings/employee_shift_schedule_action.html +++ b/base/templates/cbv/settings/employee_shift_schedule_action.html @@ -15,4 +15,4 @@ {% endif %} - \ No newline at end of file + diff --git a/base/templates/cbv/settings/employee_shift_schedule_detail_action.html b/base/templates/cbv/settings/employee_shift_schedule_detail_action.html index c07393043..aa65a0bd2 100644 --- a/base/templates/cbv/settings/employee_shift_schedule_detail_action.html +++ b/base/templates/cbv/settings/employee_shift_schedule_detail_action.html @@ -28,4 +28,4 @@ {% csrf_token %} {% endif %} - \ No newline at end of file + diff --git a/base/templates/cbv/settings/employee_shift_schedule_form.html b/base/templates/cbv/settings/employee_shift_schedule_form.html index faae70374..321044f50 100644 --- a/base/templates/cbv/settings/employee_shift_schedule_form.html +++ b/base/templates/cbv/settings/employee_shift_schedule_form.html @@ -6,4 +6,4 @@ $(document).ready(function(e){ $("[name=is_auto_punch_out_enabled]").change(); }); - \ No newline at end of file + diff --git a/base/templates/cbv/settings/extended_mail_server.html b/base/templates/cbv/settings/extended_mail_server.html index d1c437bd6..3c0f99ddc 100644 --- a/base/templates/cbv/settings/extended_mail_server.html +++ b/base/templates/cbv/settings/extended_mail_server.html @@ -15,4 +15,4 @@ {% endif %} {% include "generic/horilla_list_table.html" %} - \ No newline at end of file + diff --git a/base/templates/cbv/settings/job_position_col_in_job_role.html b/base/templates/cbv/settings/job_position_col_in_job_role.html index aa4fcf91a..dc821694d 100644 --- a/base/templates/cbv/settings/job_position_col_in_job_role.html +++ b/base/templates/cbv/settings/job_position_col_in_job_role.html @@ -17,4 +17,3 @@ {{instance}} - diff --git a/base/templates/cbv/settings/job_role.html b/base/templates/cbv/settings/job_role.html index ae444a420..993a8f335 100644 --- a/base/templates/cbv/settings/job_role.html +++ b/base/templates/cbv/settings/job_role.html @@ -30,9 +30,9 @@ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/base/templates/cbv/shift_request/confirm_allocated.html b/base/templates/cbv/shift_request/confirm_allocated.html index 73200843d..48d279cf8 100644 --- a/base/templates/cbv/shift_request/confirm_allocated.html +++ b/base/templates/cbv/shift_request/confirm_allocated.html @@ -25,4 +25,4 @@ {% endif %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/base/templates/cbv/shift_request/export_shift.html b/base/templates/cbv/shift_request/export_shift.html index 1a1362dff..691441237 100644 --- a/base/templates/cbv/shift_request/export_shift.html +++ b/base/templates/cbv/shift_request/export_shift.html @@ -27,4 +27,3 @@ - diff --git a/base/templates/cbv/shift_request/extended_shift.html b/base/templates/cbv/shift_request/extended_shift.html index a7c8adea3..d56be6c56 100644 --- a/base/templates/cbv/shift_request/extended_shift.html +++ b/base/templates/cbv/shift_request/extended_shift.html @@ -2,7 +2,7 @@ {% include "generic/horilla_list_table.html" %} {% if request.GET.deleted %} - -{% endif %} \ No newline at end of file +{% endif %} diff --git a/base/templates/cbv/shift_request/filter.html b/base/templates/cbv/shift_request/filter.html index 88b8a35fc..81568176d 100644 --- a/base/templates/cbv/shift_request/filter.html +++ b/base/templates/cbv/shift_request/filter.html @@ -90,7 +90,7 @@ - +
@@ -106,7 +106,7 @@
- +
@@ -124,9 +124,9 @@
- - - + + +
{% trans "Advanced" %} @@ -152,4 +152,4 @@
- \ No newline at end of file + diff --git a/base/templates/cbv/shift_request/shift_deatil_actions.html b/base/templates/cbv/shift_request/shift_deatil_actions.html index 228886fc7..842532a96 100644 --- a/base/templates/cbv/shift_request/shift_deatil_actions.html +++ b/base/templates/cbv/shift_request/shift_deatil_actions.html @@ -27,7 +27,5 @@ + {% endif %} - - \ No newline at end of file diff --git a/base/templates/cbv/shift_request/shift_request.html b/base/templates/cbv/shift_request/shift_request.html index 1b999335e..f6e8536cd 100644 --- a/base/templates/cbv/shift_request/shift_request.html +++ b/base/templates/cbv/shift_request/shift_request.html @@ -71,4 +71,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/base/templates/cbv/shift_request/shift_request_form.html b/base/templates/cbv/shift_request/shift_request_form.html index abb5ba4ae..ab33211b3 100644 --- a/base/templates/cbv/shift_request/shift_request_form.html +++ b/base/templates/cbv/shift_request/shift_request_form.html @@ -9,7 +9,7 @@ $("[id=id_requested_till_parent_div]").show(); }id_requested_till } - + $(document).ready(function(){ $("[type=checkbox]").change(function (e) { e.preventDefault(); @@ -18,4 +18,3 @@ }) toggleFunctionShiftRequestForm($("#genericModalBody #id_is_permanent_shift")); - \ No newline at end of file diff --git a/base/templates/cbv/work_shift_tab/extended_work-shift.html b/base/templates/cbv/work_shift_tab/extended_work-shift.html index 363050f12..3781695b1 100644 --- a/base/templates/cbv/work_shift_tab/extended_work-shift.html +++ b/base/templates/cbv/work_shift_tab/extended_work-shift.html @@ -14,7 +14,7 @@

- + {% endif %} {% include "generic/horilla_tabs.html" %} - \ No newline at end of file + diff --git a/base/templates/cbv/work_type_request/actions.html b/base/templates/cbv/work_type_request/actions.html index 0052739ae..0c2df4574 100644 --- a/base/templates/cbv/work_type_request/actions.html +++ b/base/templates/cbv/work_type_request/actions.html @@ -37,4 +37,4 @@ {% endif %} {% endif %} - \ No newline at end of file + diff --git a/base/templates/cbv/work_type_request/confirmation.html b/base/templates/cbv/work_type_request/confirmation.html index 548f5d9b5..1d17c3448 100644 --- a/base/templates/cbv/work_type_request/confirmation.html +++ b/base/templates/cbv/work_type_request/confirmation.html @@ -32,4 +32,4 @@ {% endif %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/base/templates/cbv/work_type_request/detail_view_actions.html b/base/templates/cbv/work_type_request/detail_view_actions.html index ed822942a..f83175991 100644 --- a/base/templates/cbv/work_type_request/detail_view_actions.html +++ b/base/templates/cbv/work_type_request/detail_view_actions.html @@ -1,10 +1,10 @@ {% load basefilters %} {% load i18n %} {% if instance.approved == False and not instance.canceled %} - @@ -12,7 +12,7 @@ {% endif %} {% if instance.approved == False and instance.canceled == False %} -
{% csrf_token %} @@ -27,4 +27,4 @@ $(".reload-record").click() $("#reloadMessagesButton").click() - {% endif %} \ No newline at end of file + {% endif %} diff --git a/base/templates/cbv/work_type_request/filter.html b/base/templates/cbv/work_type_request/filter.html index 8b8732c29..5af091145 100644 --- a/base/templates/cbv/work_type_request/filter.html +++ b/base/templates/cbv/work_type_request/filter.html @@ -66,12 +66,12 @@ {{form.requested_date}} - +
{{form.approved}}
- +
diff --git a/base/templates/cbv/work_type_request/form/form.html b/base/templates/cbv/work_type_request/form/form.html index a25ec5d42..f47cd654f 100644 --- a/base/templates/cbv/work_type_request/form/form.html +++ b/base/templates/cbv/work_type_request/form/form.html @@ -15,7 +15,7 @@ function toggleFunctionWorkTypeRequestForm(){ } else { $("[id=id_requested_till_parent_div]").show(); } - } + } $(document).ready(function(){ $("[type=checkbox]").change(function (e) { e.preventDefault(); @@ -25,4 +25,3 @@ function toggleFunctionWorkTypeRequestForm(){ toggleFunctionWorkTypeRequestForm(); - diff --git a/base/templates/cbv/work_type_request/note.html b/base/templates/cbv/work_type_request/note.html index 51a148d6f..912cd1d26 100644 --- a/base/templates/cbv/work_type_request/note.html +++ b/base/templates/cbv/work_type_request/note.html @@ -8,4 +8,4 @@
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/base/templates/cbv/work_type_request/work_export.html b/base/templates/cbv/work_type_request/work_export.html index bfea89c64..c43d1a14d 100644 --- a/base/templates/cbv/work_type_request/work_export.html +++ b/base/templates/cbv/work_type_request/work_export.html @@ -27,4 +27,4 @@
- \ No newline at end of file + diff --git a/base/templates/cbv/work_type_request/work_type_home.html b/base/templates/cbv/work_type_request/work_type_home.html index 7fbdebbcd..acf3dc2d5 100644 --- a/base/templates/cbv/work_type_request/work_type_home.html +++ b/base/templates/cbv/work_type_request/work_type_home.html @@ -51,4 +51,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/base/views copy.py b/base/views copy.py index 9a84c7d94..492f895c0 100644 --- a/base/views copy.py +++ b/base/views copy.py @@ -738,11 +738,11 @@ def change_password(request): if form.is_valid(): new_password = form.cleaned_data["new_password"] user.set_password(new_password) - + if user.is_new_employee: # Ensure this only affects new employees user.is_new_employee = False user.save() - + user = authenticate(request, username=user.username, password=new_password) login(request, user) messages.success(request, _("Password changed successfully")) @@ -752,14 +752,6 @@ def change_password(request): return render(request, "base/auth/password_change.html", {"form": form}) - - - - - - - - def logout_user(request): """ This method used to logout the user diff --git a/base/widgets.py b/base/widgets.py index 12fee0531..a8d7151f7 100644 --- a/base/widgets.py +++ b/base/widgets.py @@ -1,6 +1,7 @@ from django import forms from django.utils.safestring import mark_safe + class CustomModelChoiceWidget(forms.Select): """ A custom Django widget for rendering a select input with an optional delete button. @@ -13,6 +14,7 @@ class CustomModelChoiceWidget(forms.Select): delete_url (str): The URL to be used for the delete button's action. If not provided, the button will not be rendered. """ + def __init__(self, *args, **kwargs): # Remove default delete_url self.delete_url = None @@ -37,11 +39,13 @@ class CustomModelChoiceWidget(forms.Select): """ return mark_safe(custom_html) - from django import forms + + from django.utils.safestring import mark_safe + class CustomTextInputWidget(forms.TextInput): """ A custom Django widget for rendering a text input with an optional delete button. @@ -54,6 +58,7 @@ class CustomTextInputWidget(forms.TextInput): delete_url (str): The URL to be used for the delete button's action. If not provided, the button will not be rendered. """ + def __init__(self, *args, **kwargs): # Remove default delete_url self.delete_url = None @@ -78,4 +83,3 @@ class CustomTextInputWidget(forms.TextInput): """ return mark_safe(custom_html) - diff --git a/base/work_type_decorators.py b/base/work_type_decorators.py index e82e2e05d..e5371d602 100644 --- a/base/work_type_decorators.py +++ b/base/work_type_decorators.py @@ -2,9 +2,10 @@ decorator functions for base """ +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render -from django.contrib import messages + from base.models import MultipleApprovalManagers from employee.models import EmployeeWorkInformation diff --git a/biometric/cbv/biometric.py b/biometric/cbv/biometric.py index b4fa634f3..b6ed70f83 100644 --- a/biometric/cbv/biometric.py +++ b/biometric/cbv/biometric.py @@ -4,26 +4,37 @@ This page handles the cbv methods for Biometric app from typing import Any from venv import logger -from django.http import HttpResponse + +from apscheduler.schedulers.background import BackgroundScheduler from django.contrib import messages +from django.http import HttpResponse from django.urls import reverse +from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ from zk import ZK + from biometric.filters import BiometricDeviceFilter from biometric.forms import BiometricDeviceForm, BiometricDeviceSchedulerForm from biometric.models import BiometricDevices -from django.utils.decorators import method_decorator -from apscheduler.schedulers.background import BackgroundScheduler - -from biometric.views import anviz_biometric_attendance_scheduler, cosec_biometric_attendance_scheduler, str_time_seconds, zk_biometric_attendance_scheduler +from biometric.views import ( + anviz_biometric_attendance_scheduler, + cosec_biometric_attendance_scheduler, + str_time_seconds, + zk_biometric_attendance_scheduler, +) from horilla.horilla_settings import BIO_DEVICE_THREADS -from horilla_views.generic.cbv.views import HorillaFormView,HorillaCardView,HorillaNavView from horilla_views.cbv_methods import login_required, permission_required - +from horilla_views.generic.cbv.views import ( + HorillaCardView, + HorillaFormView, + HorillaNavView, +) @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required(perm="biometric.view_biometricdevices"), name="dispatch") +@method_decorator( + permission_required(perm="biometric.view_biometricdevices"), name="dispatch" +) class BiometricNavBar(HorillaNavView): """ nav bar of the page @@ -46,10 +57,11 @@ class BiometricNavBar(HorillaNavView): filter_form_context_name = "form" search_swap_target = "#listContainer" - @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required(perm="biometric.view_biometricdevices"), name="dispatch") +@method_decorator( + permission_required(perm="biometric.view_biometricdevices"), name="dispatch" +) class BiometricCardView(HorillaCardView): """ card view of the page @@ -57,40 +69,41 @@ class BiometricCardView(HorillaCardView): model = BiometricDevices filter_class = BiometricDeviceFilter - + def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.search_url = reverse("biometric-card-view") self.actions = [ - { - "action": "Edit", - "attrs": """ + { + "action": "Edit", + "attrs": """ class="oh-dropdown__link" hx-get="{get_update_url}" hx-target="#genericModalBody" data-toggle="oh-modal-toggle" data-target="#genericModal" """, - }, - { - "action": "archive_status", - "attrs": """ + }, + { + "action": "archive_status", + "attrs": """ hx-confirm="Do you want to {archive_status} this device?" hx-post="{get_archive_url}" class="oh-dropdown__link" - hx-target="#listContainer" + hx-target="#listContainer" """, - }, - { - "action": "Delete", - "attrs": """ + }, + { + "action": "Delete", + "attrs": """ hx-confirm="Do you want to delete this device?" hx-post="{get_delete_url}" class="oh-dropdown__link oh-dropdown__link--danger" hx-target="#biometricDeviceList" """, - }, - ] + }, + ] + details = { "title": "{name}", "subtitle": " Device Type : {get_machine_type}
{get_card_details}
{render_live_capture_html}
{render_actions_html}", @@ -118,7 +131,7 @@ class BiometricCardView(HorillaCardView): " """, ), - ( + ( "live--dot", _("Live Capture"), """ @@ -129,14 +142,11 @@ class BiometricCardView(HorillaCardView): ), ] - - - - - @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required(perm="biometric.add_biometricdevices"), name="dispatch") +@method_decorator( + permission_required(perm="biometric.add_biometricdevices"), name="dispatch" +) class BiometricFormView(HorillaFormView): """ from view for create and update biometric devices @@ -149,7 +159,7 @@ class BiometricFormView(HorillaFormView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - + if self.form.instance.pk: self.form_class.verbose_name = _("Edit Biometric Devices") context["form"] = self.form @@ -166,13 +176,12 @@ class BiometricFormView(HorillaFormView): messages.success(self.request, message) return self.HttpResponse() return super().form_valid(form) - - - @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required(perm="biometric.change_biometricdevices"), name="dispatch") +@method_decorator( + permission_required(perm="biometric.change_biometricdevices"), name="dispatch" +) class BiometricSheduleForm(HorillaFormView): """ form view for shedule biometric device @@ -190,7 +199,7 @@ class BiometricSheduleForm(HorillaFormView): self.form.fields["scheduler_duration"].initial = device.scheduler_duration return context - + def form_valid(self, form: BiometricDeviceSchedulerForm) -> HttpResponse: if form.is_valid(): if form.instance.pk: @@ -227,7 +236,9 @@ class BiometricSheduleForm(HorillaFormView): scheduler.start() return HttpResponse("") except Exception as error: - logger.error("An error comes in biometric_device_schedule ", error) + logger.error( + "An error comes in biometric_device_schedule ", error + ) script = """ @@ -282,4 +293,3 @@ class BiometricSheduleForm(HorillaFormView): messages.success(self.request, message) # return self.HttpResponse("") return super().form_valid(form) - diff --git a/biometric/templates/cbv/biometric_card_actions.html b/biometric/templates/cbv/biometric_card_actions.html index 4614c2fb9..5ffef86aa 100644 --- a/biometric/templates/cbv/biometric_card_actions.html +++ b/biometric/templates/cbv/biometric_card_actions.html @@ -2,7 +2,7 @@
{% include 'generic/horilla_card.html' %}
-
'); - + var button = $( ' - {% if "payroll"|app_installed %} + {% if "payroll"|app_installed %} {% if perms.payroll.add_loanaccount %} {% endif %} diff --git a/employee/templates/cbv/allocations/auth/perm.html b/employee/templates/cbv/allocations/auth/perm.html index 4c6afc499..8a68a19b8 100644 --- a/employee/templates/cbv/allocations/auth/perm.html +++ b/employee/templates/cbv/allocations/auth/perm.html @@ -49,7 +49,7 @@ }) {% if perms.auth.add_permission or perms.auth.change_permission or perms.auth.delete_permission %} - {% load i18n %} + {% load i18n %} {% for perm in permissions %}
@@ -176,7 +176,7 @@ if (!$(this).is(':checked')) { $(this).closest('.oh-sticky-table__tr').find('.row-permission').prop('checked',false) } - " + " data-group-id="{{group.id}}" data-group-name="{{group.name}}" /> @@ -211,7 +211,7 @@
{% endfor %} - + {% endif %} @@ -363,4 +363,4 @@ } }) } - \ No newline at end of file + diff --git a/employee/templates/cbv/allocations/employee/form_structure.html b/employee/templates/cbv/allocations/employee/form_structure.html index e76e75ca0..d97880e0e 100644 --- a/employee/templates/cbv/allocations/employee/form_structure.html +++ b/employee/templates/cbv/allocations/employee/form_structure.html @@ -35,7 +35,7 @@
{{ field|add_class:'oh-switch__checkbox' }}
- {% else %} + {% else %}
{{ field|add_class:'form-control' }} {{ field.errors }} diff --git a/employee/templates/cbv/allocations/employee/forms.html b/employee/templates/cbv/allocations/employee/forms.html index 8210163c1..e325b9401 100644 --- a/employee/templates/cbv/allocations/employee/forms.html +++ b/employee/templates/cbv/allocations/employee/forms.html @@ -46,4 +46,4 @@ $(".oh-inner-sidebar-content__header:visible .oh-general__tab:first span").click(); }, 100); }); - \ No newline at end of file + diff --git a/employee/templates/cbv/allocations/payroll/allowance/allowance_view.html b/employee/templates/cbv/allocations/payroll/allowance/allowance_view.html index 68b3e3cea..fdbb4ae6b 100644 --- a/employee/templates/cbv/allocations/payroll/allowance/allowance_view.html +++ b/employee/templates/cbv/allocations/payroll/allowance/allowance_view.html @@ -26,6 +26,5 @@
- + - \ No newline at end of file diff --git a/employee/templates/cbv/allocations/payroll/deduction/deduction_view.html b/employee/templates/cbv/allocations/payroll/deduction/deduction_view.html index a57e3a15c..a1429c678 100644 --- a/employee/templates/cbv/allocations/payroll/deduction/deduction_view.html +++ b/employee/templates/cbv/allocations/payroll/deduction/deduction_view.html @@ -26,6 +26,5 @@ - + - \ No newline at end of file diff --git a/employee/templates/cbv/allocations/summary.html b/employee/templates/cbv/allocations/summary.html index 083c3ae2f..2b7b8d2cf 100644 --- a/employee/templates/cbv/allocations/summary.html +++ b/employee/templates/cbv/allocations/summary.html @@ -124,7 +124,7 @@
-
+
diff --git a/employee/templates/cbv/disciplinary_actions/action_taken.html b/employee/templates/cbv/disciplinary_actions/action_taken.html index 88d034825..c1214dca2 100644 --- a/employee/templates/cbv/disciplinary_actions/action_taken.html +++ b/employee/templates/cbv/disciplinary_actions/action_taken.html @@ -11,4 +11,4 @@ {% else %}
{{ instance.action }}
- {% endif %} \ No newline at end of file + {% endif %} diff --git a/employee/templates/cbv/disciplinary_actions/actions.html b/employee/templates/cbv/disciplinary_actions/actions.html index e21c39d46..4e5ae46ac 100644 --- a/employee/templates/cbv/disciplinary_actions/actions.html +++ b/employee/templates/cbv/disciplinary_actions/actions.html @@ -25,4 +25,4 @@ {% endif %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/employee/templates/cbv/disciplinary_actions/attachments.html b/employee/templates/cbv/disciplinary_actions/attachments.html index 9a6c2e714..53dc1dfb1 100644 --- a/employee/templates/cbv/disciplinary_actions/attachments.html +++ b/employee/templates/cbv/disciplinary_actions/attachments.html @@ -11,4 +11,3 @@ {% else %}
{% trans "No file has been uploaded." %}
{% endif %} - \ No newline at end of file diff --git a/employee/templates/cbv/disciplinary_actions/detail_action.html b/employee/templates/cbv/disciplinary_actions/detail_action.html index e5a47beb6..7dc8b4143 100644 --- a/employee/templates/cbv/disciplinary_actions/detail_action.html +++ b/employee/templates/cbv/disciplinary_actions/detail_action.html @@ -1,6 +1,6 @@ {% load basefilters %}{% load i18n %} {% if perms.payroll.change_disciplinaryaction or perms.payroll.delete_disciplinaryaction %} - +
{% if perms.payroll.change_disciplinaryaction %} @@ -14,10 +14,10 @@ {% endif %}
- + {% endif %} {% if request.GET.deleted %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/employee/templates/cbv/disciplinary_actions/disciplinary_actions.html b/employee/templates/cbv/disciplinary_actions/disciplinary_actions.html index 4b0bc57d0..5ff36a022 100644 --- a/employee/templates/cbv/disciplinary_actions/disciplinary_actions.html +++ b/employee/templates/cbv/disciplinary_actions/disciplinary_actions.html @@ -91,4 +91,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/employee/templates/cbv/disciplinary_actions/employee_col.html b/employee/templates/cbv/disciplinary_actions/employee_col.html index 0df40dbec..21258fe34 100644 --- a/employee/templates/cbv/disciplinary_actions/employee_col.html +++ b/employee/templates/cbv/disciplinary_actions/employee_col.html @@ -1,7 +1,7 @@ {% load i18n %} {% load basefilters %}
- +
- \ No newline at end of file + diff --git a/employee/templates/cbv/disciplinary_actions/forms/create_form.html b/employee/templates/cbv/disciplinary_actions/forms/create_form.html index b6cc58b24..813cca75d 100644 --- a/employee/templates/cbv/disciplinary_actions/forms/create_form.html +++ b/employee/templates/cbv/disciplinary_actions/forms/create_form.html @@ -18,4 +18,4 @@ $("#id_unit_in").parent().parent().hide(); $("#id_hours").parent().parent().hide(); $("[name=days]").prop("required", false); - \ No newline at end of file + diff --git a/employee/templates/cbv/disciplinary_actions/main_dis.html b/employee/templates/cbv/disciplinary_actions/main_dis.html index 4bebb06b4..425330b2d 100644 --- a/employee/templates/cbv/disciplinary_actions/main_dis.html +++ b/employee/templates/cbv/disciplinary_actions/main_dis.html @@ -1,4 +1,4 @@ -
+
{% include "generic/horilla_list.html" %} -
\ No newline at end of file +
diff --git a/employee/templates/cbv/document/notify_field.html b/employee/templates/cbv/document/notify_field.html index e760766b3..ece6fd3c9 100644 --- a/employee/templates/cbv/document/notify_field.html +++ b/employee/templates/cbv/document/notify_field.html @@ -12,4 +12,4 @@ $(this).closest("select")[0].dispatchEvent(new Event("change")); }); }); - {% endcomment %} \ No newline at end of file + {% endcomment %} diff --git a/employee/templates/cbv/documents/inherit_form.html b/employee/templates/cbv/documents/inherit_form.html index 67084060a..f85b71117 100644 --- a/employee/templates/cbv/documents/inherit_form.html +++ b/employee/templates/cbv/documents/inherit_form.html @@ -9,7 +9,7 @@ border-color: #d6e9c6; border: 1px solid transparent; border-radius: 4px; - + } \ No newline at end of file + diff --git a/employee/templates/cbv/employees_view/bulk_update_page.html b/employee/templates/cbv/employees_view/bulk_update_page.html index ae23d3a02..b824f36f9 100644 --- a/employee/templates/cbv/employees_view/bulk_update_page.html +++ b/employee/templates/cbv/employees_view/bulk_update_page.html @@ -23,11 +23,11 @@ text: value })); }); - + if ($('#id_employee_work_info__job_position_id option').length > 0) { var firstJobPositionId = $('#id_employee_work_info__job_position_id option:first').val(); $('#id_employee_work_info__job_position_id').val(firstJobPositionId); - + $('#id_employee_work_info__job_role_id').empty(); $.each(data.job_roles, function(key, value) { @@ -37,9 +37,9 @@ })); }); } - - $('#id_employee_work_info__job_position_id').change(); - $('#id_employee_work_info__job_role_id').change(); + + $('#id_employee_work_info__job_position_id').change(); + $('#id_employee_work_info__job_role_id').change(); } }); }); @@ -47,16 +47,16 @@ // auto update department and job role when change job position $('#id_employee_work_info__job_position_id').on('change', function() { - + var jobPositionId = $(this).val(); $.ajax({ - url: '{% url "get-job-roles" %}', + url: '{% url "get-job-roles" %}', method: 'GET', data: { 'job_position_id': jobPositionId }, success: function(data) { - + $('#id_employee_work_info__job_role_id').empty(); $.each(data.job_roles, function(key, value) { $('#id_employee_work_info__job_role_id').append($('
{% else %} {% if claim_request or request.user.employee_get in ticket.assigned_to.all %} - {% csrf_token %} {% else %} - - diff --git a/horilla_theme/templates/horilla_theme/components/header.html b/horilla_theme/templates/horilla_theme/components/header.html index 69e6d6d4a..fccd6a027 100644 --- a/horilla_theme/templates/horilla_theme/components/header.html +++ b/horilla_theme/templates/horilla_theme/components/header.html @@ -160,4 +160,4 @@ - \ No newline at end of file + diff --git a/horilla_theme/templates/horilla_theme/components/header_scripts.html b/horilla_theme/templates/horilla_theme/components/header_scripts.html index 2263cff40..da6c56603 100644 --- a/horilla_theme/templates/horilla_theme/components/header_scripts.html +++ b/horilla_theme/templates/horilla_theme/components/header_scripts.html @@ -9,4 +9,4 @@ {% block header_scripts %} -{% endblock header_scripts %} \ No newline at end of file +{% endblock header_scripts %} diff --git a/horilla_theme/templates/horilla_theme/components/sidebar.html b/horilla_theme/templates/horilla_theme/components/sidebar.html index 503bf0011..ac85dfc36 100644 --- a/horilla_theme/templates/horilla_theme/components/sidebar.html +++ b/horilla_theme/templates/horilla_theme/components/sidebar.html @@ -67,4 +67,4 @@ - \ No newline at end of file + diff --git a/horilla_theme/templates/index.html b/horilla_theme/templates/index.html index a08da26f5..1605bfeae 100644 --- a/horilla_theme/templates/index.html +++ b/horilla_theme/templates/index.html @@ -48,8 +48,8 @@
- {% block content %} - {% include "horilla_theme/components/dashboard.html" %} + {% block content %} + {% include "horilla_theme/components/dashboard.html" %} {% endblock %}
diff --git a/horilla_views/templates/generic/components.html b/horilla_views/templates/generic/components.html index ef1b8b458..7a16fcd68 100644 --- a/horilla_views/templates/generic/components.html +++ b/horilla_views/templates/generic/components.html @@ -76,3 +76,5 @@ } } +{% block generic_components %} +{% endblock generic_components %} diff --git a/horilla_views/templates/generic/import_block.html b/horilla_views/templates/generic/import_block.html index ca62dcb44..fdf40fa1f 100644 --- a/horilla_views/templates/generic/import_block.html +++ b/horilla_views/templates/generic/import_block.html @@ -57,7 +57,7 @@ diff --git a/leave/cbv/accessibility.py b/leave/cbv/accessibility.py index 5c0c2f246..ea06a8b36 100644 --- a/leave/cbv/accessibility.py +++ b/leave/cbv/accessibility.py @@ -1,27 +1,33 @@ """ Accessibility page for card functions """ + +from django.contrib.auth.context_processors import PermWrapper from django.contrib.auth.models import User + from base.methods import check_manager from employee.models import Employee from leave.models import LeaveType -from django.contrib.auth.context_processors import PermWrapper + def assign_leave(request, instance, user_perm): - if request.user.has_perm('leave.add_availableleave'): + if request.user.has_perm("leave.add_availableleave"): if not instance.is_compensatory_leave: - return True + return True return False -def leave_accessibility(request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs) -> bool: +def leave_accessibility( + request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs +) -> bool: """ accessibility for leave tab in individual view """ employee = Employee.objects.get(id=instance.pk) - if request.user.has_perm("leave.view_leaverequest") or check_manager(request.user.employee_get, instance) or request.user == employee.employee_user_id: + if ( + request.user.has_perm("leave.view_leaverequest") + or check_manager(request.user.employee_get, instance) + or request.user == employee.employee_user_id + ): return True return False - - - diff --git a/leave/cbv/assigned_leave.py b/leave/cbv/assigned_leave.py index fab06aba5..d7d0bda5a 100644 --- a/leave/cbv/assigned_leave.py +++ b/leave/cbv/assigned_leave.py @@ -3,21 +3,23 @@ this page handles cbv of assigned leave page """ from typing import Any -from django.http import HttpResponse + from django.contrib import messages +from django.http import HttpResponse from django.urls import reverse, reverse_lazy -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator -from base.methods import filtersubordinates +from django.utils.translation import gettext_lazy as _ + from base.decorators import manager_can_enter +from base.methods import filtersubordinates +from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( - TemplateView, - HorillaListView, - HorillaNavView, HorillaDetailedView, HorillaFormView, + HorillaListView, + HorillaNavView, + TemplateView, ) -from horilla_views.cbv_methods import login_required from leave.filters import AssignedLeaveFilter from leave.forms import AssignLeaveForm, AvailableLeaveColumnExportForm from leave.models import AvailableLeave @@ -141,8 +143,11 @@ class AssignedLeaveNavView(HorillaNavView): ("carryforward_days", _("Carryforward Days")), ("total_leave_days", _("Total Leave Days")), ("assigned_date", _("Assigned Date")), - ("employee_id__employee_work_info__reporting_manager_id", _("Reporting Manager")), - ("employee_id__employee_work_info__department_id",_("Department")), + ( + "employee_id__employee_work_info__reporting_manager_id", + _("Reporting Manager"), + ), + ("employee_id__employee_work_info__department_id", _("Department")), ("employee_id__employee_work_info__job_position_id", _("Job Position")), ("employee_id__employee_work_info__employee_type_id", _("Employement Type")), ("employee_id__employee_work_info__company_id", _("Company")), @@ -196,7 +201,8 @@ class AssignedLeaveDetailView(HorillaDetailedView): action_method = "assigned_leave_detail_actions" -# not done + +# not done class AssignedLeaveFormView(HorillaFormView): """ form view diff --git a/leave/cbv/compensatory_leave_request.py b/leave/cbv/compensatory_leave_request.py index 8f864903c..7d0d4835b 100644 --- a/leave/cbv/compensatory_leave_request.py +++ b/leave/cbv/compensatory_leave_request.py @@ -3,22 +3,24 @@ this page handles the cbv methods of compensatory leave request page. """ from typing import Any + from django.apps import apps -from django.http import HttpResponse from django.contrib import messages +from django.http import HttpResponse from django.urls import reverse, reverse_lazy -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from base.methods import filtersubordinates, is_reportingmanager +from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, + HorillaFormView, HorillaListView, HorillaNavView, HorillaTabView, TemplateView, - HorillaFormView, ) -from horilla_views.cbv_methods import login_required from leave.decorators import is_compensatory_leave_enabled from leave.methods import attendance_days @@ -70,7 +72,7 @@ class CompensatoryListView(HorillaListView): ("Attendance Dates", "compensatory_date"), ("Requested Days", "requested_days"), ("Created By", "created_by__get_full_name"), - ("Status", "status_display") + ("Status", "status_display"), ] row_status_indications = [ ( @@ -116,6 +118,7 @@ class CompensatoryListView(HorillaListView): row_status_class = "status-{status}" + @method_decorator(login_required, name="dispatch") @method_decorator(is_compensatory_leave_enabled(), name="dispatch") class CompensatoryNavView(HorillaNavView): @@ -168,6 +171,7 @@ class CompensatoryLeaveTabView(HorillaTabView): } ) + @method_decorator(login_required, name="dispatch") @method_decorator(is_compensatory_leave_enabled(), name="dispatch") class MyCompensatoryLeaveTab(CompensatoryListView): @@ -192,7 +196,7 @@ class MyCompensatoryLeaveTab(CompensatoryListView): data-target="#genericModal" data-toggle="oh-modal-toggle" """ - + @method_decorator(login_required, name="dispatch") @method_decorator(is_compensatory_leave_enabled(), name="dispatch") @@ -222,6 +226,7 @@ class CompensatoryLeaveTab(CompensatoryListView): data-toggle="oh-modal-toggle" """ + @method_decorator(login_required, name="dispatch") @method_decorator(is_compensatory_leave_enabled(), name="dispatch") class CompensatoryGenericDetailView(HorillaDetailedView): @@ -244,9 +249,10 @@ class CompensatoryGenericDetailView(HorillaDetailedView): (_("Created By"), "created_by__employee_get"), (_("Attendance Dates"), "compensatory_date"), (_("Description"), "description"), - (_("Reject Reason"),"compensatory_detail_reject_reason", True) + (_("Reject Reason"), "compensatory_detail_reject_reason", True), ] + @method_decorator(login_required, name="dispatch") @method_decorator(is_compensatory_leave_enabled(), name="dispatch") class MyCompensatoryDetailView(CompensatoryGenericDetailView): @@ -292,7 +298,7 @@ class CompensatoryForm(HorillaFormView): else: comp_req = form.save() comp_req.requested_days = attendance_days( - comp_req.employee_id, comp_req.attendance_id.all() + comp_req.employee_id, comp_req.attendance_id.all() ) comp_req.save() message = _("Compensatory Leave Created") diff --git a/leave/cbv/dashboard.py b/leave/cbv/dashboard.py index ef6a95eea..3817adec2 100644 --- a/leave/cbv/dashboard.py +++ b/leave/cbv/dashboard.py @@ -1,14 +1,16 @@ from datetime import date from typing import Any + from django.urls import reverse -from base.methods import filtersubordinates -from base.decorators import manager_can_enter from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + +from base.decorators import manager_can_enter +from base.methods import filtersubordinates +from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import HorillaListView from leave.cbv.leave_allocation_request import LeaveAllocationRequests -from django.utils.translation import gettext_lazy as _ from leave.cbv.leave_requests import LeaveRequestsListView -from horilla_views.cbv_methods import login_required from leave.cbv.my_leave_request import MyLeaveRequestListView from leave.filters import UserLeaveRequestFilter from leave.models import LeaveRequest @@ -54,6 +56,7 @@ class LeaveAllocationRequestToApprove(LeaveAllocationRequests): """, } + @method_decorator(login_required, name="dispatch") class LeaveRequestsToApprove(LeaveRequestsListView): """ @@ -64,7 +67,6 @@ class LeaveRequestsToApprove(LeaveRequestsListView): row_status_indications = None option_method = None show_toggle_form = False - def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) @@ -93,13 +95,11 @@ class LeaveRequestsToApprove(LeaveRequestsListView): "employee_id": """ style ="width:100px !important" """, - "get_period": """ + "get_period": """ style ="width:100px !important" """, } - - @method_decorator(login_required, name="dispatch") @method_decorator(manager_can_enter("leave.view_leaverequest"), name="dispatch") @@ -113,7 +113,6 @@ class DashboardOnLeave(HorillaListView): show_toggle_form = False bulk_select_option = False - def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.search_url = reverse("dashboard-on-leave") @@ -124,19 +123,18 @@ class DashboardOnLeave(HorillaListView): data-target="#genericModal" data-toggle="oh-modal-toggle" """ - def get_queryset(self): today = date.today() - queryset = super().get_queryset() + queryset = super().get_queryset() queryset = queryset.filter( - employee_id__is_active=True, - status="approved", - start_date__lte=today, - end_date__gte=today, - ) + employee_id__is_active=True, + status="approved", + start_date__lte=today, + end_date__gte=today, + ) return queryset - + columns = [ ("Employee", "employee_id", "employee_id__get_avatar"), ] @@ -164,7 +162,7 @@ class DashboardTotalLeaveRequest(MyLeaveRequestListView): """ queryset = super().get_queryset() employee = self.request.user.employee_get - queryset = queryset.filter(employee_id=employee,status="approved") + queryset = queryset.filter(employee_id=employee, status="approved") return queryset columns = [ @@ -205,5 +203,3 @@ class DashboardTotalLeaveRequest(MyLeaveRequestListView): style ="width:100px !important" """, } - - diff --git a/leave/cbv/leave_allocation_request.py b/leave/cbv/leave_allocation_request.py index 92ffd7a9a..5d438fac8 100644 --- a/leave/cbv/leave_allocation_request.py +++ b/leave/cbv/leave_allocation_request.py @@ -2,15 +2,16 @@ Leave allocation request page """ -from typing import Any import contextlib +from typing import Any + from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse, reverse_lazy -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator -from notifications.signals import notify +from django.utils.translation import gettext_lazy as _ + from base.methods import choosesubordinates, filtersubordinates, is_reportingmanager from employee.cbv.employee_profile import EmployeeProfileView from employee.models import Employee @@ -27,7 +28,7 @@ from leave.cbv.leave_tab import IndividualLeaveTab from leave.filters import LeaveAllocationRequestFilter from leave.forms import LeaveAllocationRequestForm from leave.models import LeaveAllocationRequest - +from notifications.signals import notify @method_decorator(login_required, name="dispatch") @@ -48,14 +49,11 @@ class LeaveAllocationRequestList(HorillaListView): model = LeaveAllocationRequest filter_class = LeaveAllocationRequestFilter - - def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.search_url = reverse("leave-allocation-request-filter") self.view_id = "view-container" - columns = [ (_("Employee"), "employee_id", "employee_id__get_avatar"), (_("Leave Type"), "leave_type_id"), @@ -67,16 +65,14 @@ class LeaveAllocationRequestList(HorillaListView): ] header_attrs = { - "action" : """ + "action": """ style="width:180px !important;" """, - "description" : """ + "description": """ style="width:180px !important;" """, - } - sortby_mapping = [ ("Employee", "employee_id__get_full_name"), ("Leave Type", "leave_type_id__name"), @@ -85,7 +81,6 @@ class LeaveAllocationRequestList(HorillaListView): ("Status", "get_status"), ] - option_method = "action_col" row_status_indications = [ @@ -133,7 +128,6 @@ class LeaveAllocationRequestTab(HorillaTabView): Tab View """ - def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.view_id = "leave-allocation" diff --git a/leave/cbv/leave_requests.py b/leave/cbv/leave_requests.py index 3dedff414..ff379c39a 100644 --- a/leave/cbv/leave_requests.py +++ b/leave/cbv/leave_requests.py @@ -6,35 +6,33 @@ import contextlib from typing import Any from django.contrib import messages -from django.http import HttpResponse -from django.utils.translation import gettext_lazy as _ -from django.shortcuts import get_object_or_404, render from django.db.models import Q +from django.http import HttpResponse +from django.shortcuts import get_object_or_404, render from django.urls import resolve, reverse, reverse_lazy from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from base.cbv.penalty import ViewPenaltyList -from base.filters import PenaltyFilter -from base.models import PenaltyAccounts -from leave.views import multiple_approvals_check -from notifications.signals import notify from base.decorators import manager_can_enter -from base.methods import ( - choosesubordinates, - filtersubordinates, -) -from leave.methods import filter_conditional_leave_request +from base.filters import PenaltyFilter +from base.methods import choosesubordinates, filtersubordinates +from base.models import PenaltyAccounts from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, + HorillaFormView, + HorillaListView, HorillaNavView, TemplateView, - HorillaListView, - HorillaFormView, ) from leave.filters import LeaveRequestFilter from leave.forms import LeaveRequestCreationForm, LeaveRequestExportForm +from leave.methods import filter_conditional_leave_request from leave.models import AvailableLeave, LeaveRequest, LeaveType from leave.threading import LeaveMailSendThread +from leave.views import multiple_approvals_check +from notifications.signals import notify @method_decorator(login_required, name="dispatch") @@ -59,10 +57,7 @@ class LeaveRequestsListView(HorillaListView): self.search_url = reverse("request-filter") self.view_id = "leaveRequest" if self.request.user.has_perm("leave.change_leaverequest"): - self.bulk_update_fields = [ - "status" - ] - + self.bulk_update_fields = ["status"] def get_queryset(self): queryset = super().get_queryset() @@ -108,10 +103,9 @@ class LeaveRequestsListView(HorillaListView): "leave_requests_custom_emp_col": """ style="width:200px !important;" """, - "option": """ style="width:200px !important;" - """, + """, } row_status_indications = [ @@ -177,7 +171,6 @@ class LeaveRequestsListView(HorillaListView): ) - @method_decorator(login_required, name="dispatch") @method_decorator(manager_can_enter("leave.view_leaverequest"), name="dispatch") class LeaveRequestsNavView(HorillaNavView): @@ -248,13 +241,17 @@ class LeaveRequestsNavView(HorillaNavView): ("end_date", _("End Date")), ("status", _("Status")), ("requested_days", _("Requested Days")), - ("employee_id__employee_work_info__reporting_manager_id", _("Reporting Manager")), + ( + "employee_id__employee_work_info__reporting_manager_id", + _("Reporting Manager"), + ), ("employee_id__employee_work_info__department_id", _("Department")), ("employee_id__employee_work_info__job_position_id", _("Job Position")), ("employee_id__employee_work_info__employee_type_id", _("Employement Type")), ("employee_id__employee_work_info__company_id", _("Company")), ] + @method_decorator(login_required, name="dispatch") @method_decorator(manager_can_enter("leave.view_leaverequest"), name="dispatch") class LeaveRequestsExportNav(TemplateView): @@ -330,7 +327,7 @@ class LeaveRequestFormView(HorillaFormView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - + if self.request: employee = self.request.user.employee_get if employee: @@ -340,7 +337,6 @@ class LeaveRequestFormView(HorillaFormView): ) self.form.fields["leave_type_id"].queryset = assigned_leave_types - if self.form.instance.pk: leave_request = LeaveRequest.objects.get(id=self.form.instance.pk) leave_type_id = leave_request.leave_type_id @@ -360,7 +356,9 @@ class LeaveRequestFormView(HorillaFormView): ) self.form.fields["leave_type_id"].queryset = assigned_leave_types # form = self.form_class(instance = self.form.instance) - self.form = choosesubordinates(self.request, self.form, "leave.add_leaverequest") + self.form = choosesubordinates( + self.request, self.form, "leave.add_leaverequest" + ) if self.form.instance.pk: self.form_class.verbose_name = _("Leave Request") @@ -447,7 +445,9 @@ class LeaveRequestFormView(HorillaFormView): leave_request.save() if multiple_approvals_check(leave_request.id): - conditional_requests = multiple_approvals_check(leave_request.id) + conditional_requests = multiple_approvals_check( + leave_request.id + ) managers = [] for manager in conditional_requests["managers"]: managers.append(manager.employee_user_id) @@ -491,7 +491,7 @@ class LeaveRequestFormView(HorillaFormView): return self.HttpResponse("") return super().form_valid(form) - + @method_decorator(login_required, name="dispatch") class LeaveClashListView(LeaveRequestsListView): @@ -503,34 +503,40 @@ class LeaveClashListView(LeaveRequestsListView): queryset = HorillaListView.get_queryset(self) pk = self.kwargs.get("pk") record = LeaveRequest.objects.get(id=pk) - if record.status != 'rejected' or record.status != 'cancelled': - queryset = queryset.filter( - Q( - employee_id__employee_work_info__department_id=record.employee_id.employee_work_info.department_id + if record.status != "rejected" or record.status != "cancelled": + queryset = ( + queryset.filter( + Q( + employee_id__employee_work_info__department_id=record.employee_id.employee_work_info.department_id + ) + | Q( + employee_id__employee_work_info__job_position_id=record.employee_id.employee_work_info.job_position_id + ), + start_date__lte=record.end_date, + end_date__gte=record.start_date, ) - | Q( - employee_id__employee_work_info__job_position_id=record.employee_id.employee_work_info.job_position_id - ), - start_date__lte=record.end_date, - end_date__gte=record.start_date, - ).exclude(id=pk).exclude(Q(status='cancelled') | Q(status='rejected')) + .exclude(id=pk) + .exclude(Q(status="cancelled") | Q(status="rejected")) + ) return queryset.distinct() - columns = [ - col for col in LeaveRequestsListView.columns - if col[1] not in ["leave_clash_col", "penality_col", "actions_col"] - ] + [(_("Clased Due To"), "clashed_due_to")] - + col + for col in LeaveRequestsListView.columns + if col[1] not in ["leave_clash_col", "penality_col", "actions_col"] + ] + [(_("Clased Due To"), "clashed_due_to")] + row_status_class = "" row_status_indications = None bulk_select_option = None row_attrs = "" -ViewPenaltyList.columns.extend([ - (_("Leave Type"), "leave_type_id"), - (_("Minus Days"), "minus_leaves"), - (_("Deducted FromCFD"), "get_deduct_from_carry_forward") -]) +ViewPenaltyList.columns.extend( + [ + (_("Leave Type"), "leave_type_id"), + (_("Minus Days"), "minus_leaves"), + (_("Deducted FromCFD"), "get_deduct_from_carry_forward"), + ] +) diff --git a/leave/cbv/leave_tab.py b/leave/cbv/leave_tab.py index a8bbd2ae8..b6cd60456 100644 --- a/leave/cbv/leave_tab.py +++ b/leave/cbv/leave_tab.py @@ -3,8 +3,10 @@ This page is handling the cbv methods of leave tab in employee profile page. """ from typing import Any + from django.urls import reverse from django.utils.translation import gettext_lazy as _ + from base.methods import is_reportingmanager from employee.models import Employee from leave.cbv.my_leave_request import MainParentListView, MyLeaveRequestListView @@ -42,7 +44,7 @@ class IndividualLeaveTab(MainParentListView): super().__init__(**kwargs) self.view_id = "leave-tab" pk = self.request.resolver_match.kwargs.get("pk") - self.search_url = reverse("individual-leave-tab-list",kwargs={'pk':pk}) + self.search_url = reverse("individual-leave-tab-list", kwargs={"pk": pk}) if self.request.user.has_perm( "leave.change_leaverequest" ) or is_reportingmanager(self.request): diff --git a/leave/cbv/leave_types.py b/leave/cbv/leave_types.py index aaefae8ca..d356f457e 100644 --- a/leave/cbv/leave_types.py +++ b/leave/cbv/leave_types.py @@ -4,26 +4,28 @@ This page handles the cbv methods for leave types page import contextlib from typing import Any -from django.http import HttpResponse + from django.contrib import messages +from django.http import HttpResponse from django.shortcuts import render -from django.utils.decorators import method_decorator from django.urls import reverse, reverse_lazy +from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from notifications.signals import notify + from employee.models import Employee +from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( - HorillaFormView, - HorillaListView, - TemplateView, - HorillaNavView, HorillaCardView, HorillaDetailedView, + HorillaFormView, + HorillaListView, + HorillaNavView, + TemplateView, ) -from horilla_views.cbv_methods import login_required, permission_required from leave.filters import LeaveTypeFilter from leave.forms import AssignLeaveForm, LeaveOneAssignForm from leave.models import AvailableLeave, LeaveType +from notifications.signals import notify @method_decorator(login_required, name="dispatch") @@ -50,7 +52,6 @@ class LeaveTypeListView(HorillaListView): filter_class = LeaveTypeFilter model = LeaveType - columns = [ (_("Leave Type"), "name", "get_avatar"), (_("Payment"), "payment"), @@ -64,7 +65,6 @@ class LeaveTypeListView(HorillaListView): ("Total Days", "count"), ] - row_status_indications = [ ( "paid--dot", @@ -89,7 +89,7 @@ class LeaveTypeListView(HorillaListView): ] header_attrs = { - "action" : """ + "action": """ style = "width:180px !important" """ } @@ -104,6 +104,7 @@ class LeaveTypeListView(HorillaListView): """ + @method_decorator(login_required, name="dispatch") @method_decorator(permission_required(perm="leave.view_leavetype"), name="dispatch") class LeaveTypeNavView(HorillaNavView): @@ -123,17 +124,17 @@ class LeaveTypeNavView(HorillaNavView): "type": "list", "icon": "list-outline", "url": reverse("leave-type-list"), - "attrs" : """ + "attrs": """ title='List' - """ + """, }, { "type": "card", "icon": "grid-outline", "url": reverse("leave-type-card-view"), - "attrs" : """ + "attrs": """ title='Card' - """ + """, }, ] @@ -247,11 +248,11 @@ class LeaveTypeCardView(HorillaCardView): "attrs": """ class="oh-dropdown__link" hx-get="{get_delete_url}?model=leave.LeaveType&pk={pk}" - data-toggle="oh-modal-toggle" + data-toggle="oh-modal-toggle" data-target="#deleteConfirmation" hx-target="#deleteConfirmationBody" style="cursor: pointer; color:red !important" - + """, }, ] @@ -324,9 +325,7 @@ class LeaveTypeAssignForm(HorillaFormView): else: messages.info( self.request, - _( - "leave type is already assigned to the employee" - ), + _("leave type is already assigned to the employee"), ) else: messages.info( diff --git a/leave/cbv/restricted_days.py b/leave/cbv/restricted_days.py index a65fd0894..8b44ebc3b 100644 --- a/leave/cbv/restricted_days.py +++ b/leave/cbv/restricted_days.py @@ -3,11 +3,14 @@ Restricted page """ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from django.contrib import messages + +from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, HorillaFormView, @@ -15,7 +18,6 @@ from horilla_views.generic.cbv.views import ( HorillaNavView, TemplateView, ) -from horilla_views.cbv_methods import login_required, permission_required from leave.filters import RestrictLeaveFilter from leave.forms import RestrictLeaveForm from leave.models import RestrictLeave @@ -36,11 +38,7 @@ class RestrictedDaysList(HorillaListView): List view of the resticted days page """ - bulk_update_fields = [ - "department", - "job_position" - - ] + bulk_update_fields = ["department", "job_position"] def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) @@ -62,9 +60,7 @@ class RestrictedDaysList(HorillaListView): (_("Description"), "description"), ] - header_attrs = { - "title": """ style="width:180px !important" """ - } + header_attrs = {"title": """ style="width:180px !important" """} sortby_mapping = [ ("Start Date", "start_date"), @@ -80,6 +76,7 @@ class RestrictedDaysList(HorillaListView): data-toggle="oh-modal-toggle" """ + @method_decorator(login_required, name="dispatch") class RestrictedDaysNav(HorillaNavView): """ @@ -115,8 +112,9 @@ class RestrictedDaysNav(HorillaNavView): search_swap_target = "#listContainer" filter_form_context_name = "form" + @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("leave.add_restrictleave"),name="dispatch") +@method_decorator(permission_required("leave.add_restrictleave"), name="dispatch") class RestrictedDaysFormView(HorillaFormView): """ Create and edit form diff --git a/leave/static/cbv/assigned_leave/assigned_leave.js b/leave/static/cbv/assigned_leave/assigned_leave.js index 4d1c7808f..da0615ae2 100644 --- a/leave/static/cbv/assigned_leave/assigned_leave.js +++ b/leave/static/cbv/assigned_leave/assigned_leave.js @@ -155,4 +155,4 @@ function leaveAssigBulkDelete() { }); } }); -} \ No newline at end of file +} diff --git a/leave/static/cbv/compensatory_leave/compensatory_leave.js b/leave/static/cbv/compensatory_leave/compensatory_leave.js index fb2afe1b6..f760fe52f 100644 --- a/leave/static/cbv/compensatory_leave/compensatory_leave.js +++ b/leave/static/cbv/compensatory_leave/compensatory_leave.js @@ -5,7 +5,7 @@ var closeButtonText = { en: "Close", fr: "Fermer", }; - + var confirmButtonText = { ar: "تأكيد", de: "Bestätigen", @@ -13,7 +13,7 @@ var closeButtonText = { en: "Confirm", fr: "Confirmer", }; - + var deleteCompensatoryMessages = { ar: "هل تريد حقًا حذف جميع طلبات الإجازة المحددة؟", de: "Möchten Sie wirklich alle ausgewählten Urlaubsanfragen löschen?", @@ -23,17 +23,17 @@ var closeButtonText = { }; - + tickLeaverequestsCheckboxes(); function makeLeaverequestsListUnique(list) { return Array.from(new Set(list)); } - + tickUserrequestsCheckboxes(); function makeUserrequestsListUnique(list) { return Array.from(new Set(list)); } - + function getCurrentLanguageCode(callback) { var languageCode = $("#main-section-data").attr("data-lang"); var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"]; @@ -57,4 +57,4 @@ var closeButtonText = { }, }); } - } \ No newline at end of file + } diff --git a/leave/static/cbv/holidays/holiday_action.js b/leave/static/cbv/holidays/holiday_action.js index aff9808f1..d6acba4ba 100644 --- a/leave/static/cbv/holidays/holiday_action.js +++ b/leave/static/cbv/holidays/holiday_action.js @@ -5,7 +5,7 @@ var rowMessages = { en: " Selected", fr: " Sélectionné", }; - + var deleteHolidayMessages = { ar: "هل تريد حقًا حذف جميع العطل المحددة؟", de: "Möchten Sie wirklich alle ausgewählten Feiertage löschen?", @@ -13,7 +13,7 @@ var rowMessages = { en: "Do you really want to delete all the selected holidays?", fr: "Voulez-vous vraiment supprimer toutes les vacances sélectionnées?", }; - + var no_rows_deleteMessages = { ar: "لم تتم تحديد صفوف لحذف العطلات.", de: "Es wurden keine Zeilen zum Löschen von Feiertagen ausgewählt.", @@ -28,18 +28,18 @@ var rowMessages = { en: "Do you want to download the template?", fr: "Voulez-vous télécharger le modèle ?", }; - + function createHolidayHxValue() { var pd = $(".oh-pagination").attr("data-pd"); var hxValue = JSON.stringify(pd); $("#holidayCreateButton").attr("hx-vals", `{"pd":${hxValue}}`); } - + tickHolidayCheckboxes(); function makeHolidayListUnique(list) { return Array.from(new Set(list)); } - + function getCurrentLanguageCode(callback) { var languageCode = $("#main-section-data").attr("data-lang"); var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"]; @@ -64,7 +64,7 @@ var rowMessages = { }); } } - + function tickHolidayCheckboxes() { var ids = JSON.parse($("#selectedHolidays").attr("data-ids") || "[]"); uniqueIds = makeHolidayListUnique(ids); @@ -185,4 +185,4 @@ function bulkDeleteHoliday(){ }); } }); -} \ No newline at end of file +} diff --git a/leave/static/cbv/leave_requests/leave_requests.js b/leave/static/cbv/leave_requests/leave_requests.js index 4ee911868..91cd07c21 100644 --- a/leave/static/cbv/leave_requests/leave_requests.js +++ b/leave/static/cbv/leave_requests/leave_requests.js @@ -116,7 +116,7 @@ function tickLeaverequestsCheckboxes() { } }); } - + // function bulkApproveLeaveRequests() { // var languageCode = null; // getCurrentLanguageCode(function (code) { @@ -127,7 +127,7 @@ function tickLeaverequestsCheckboxes() { // ids.push($("#selectedInstances").attr("data-ids")); // ids = JSON.parse($("#selectedInstances").attr("data-ids")); // console.log(ids) // Parse IDs - + // if (ids.length === 0) { // Swal.fire({ // text: textMessage, @@ -171,7 +171,7 @@ function tickLeaverequestsCheckboxes() { // } // }); // } - + function bulkApproveLeaveRequests() { @@ -181,7 +181,7 @@ function bulkApproveLeaveRequests() { var confirmMessage = approveLeaveRequests[languageCode]; var textMessage = noRowMessage[languageCode]; ids = JSON.parse($("#selectedInstances").attr("data-ids")); - + if (ids.length === 0) { Swal.fire({ text: textMessage, diff --git a/leave/static/cbv/my_leave_request/my_leave_request.js b/leave/static/cbv/my_leave_request/my_leave_request.js index 9b418913f..f67507922 100644 --- a/leave/static/cbv/my_leave_request/my_leave_request.js +++ b/leave/static/cbv/my_leave_request/my_leave_request.js @@ -168,5 +168,3 @@ function myLeaveRequestBulkDelete() { } }); } - - \ No newline at end of file diff --git a/leave/templates/cbv/assigned_leave/assigned_filter.html b/leave/templates/cbv/assigned_leave/assigned_filter.html index 9f33dd2f2..8bd52aba5 100644 --- a/leave/templates/cbv/assigned_leave/assigned_filter.html +++ b/leave/templates/cbv/assigned_leave/assigned_filter.html @@ -106,4 +106,4 @@ - \ No newline at end of file + diff --git a/leave/templates/cbv/assigned_leave/assigned_leave_actions.html b/leave/templates/cbv/assigned_leave/assigned_leave_actions.html index d05aabf78..b84dfb774 100644 --- a/leave/templates/cbv/assigned_leave/assigned_leave_actions.html +++ b/leave/templates/cbv/assigned_leave/assigned_leave_actions.html @@ -8,12 +8,12 @@ {% endif %} {% if request.user|is_reportingmanager or perms.leave.delete_availableleave %} - - + {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/assigned_leave/assigned_leave_detail_actions.html b/leave/templates/cbv/assigned_leave/assigned_leave_detail_actions.html index be6d76a2d..683c09e25 100644 --- a/leave/templates/cbv/assigned_leave/assigned_leave_detail_actions.html +++ b/leave/templates/cbv/assigned_leave/assigned_leave_detail_actions.html @@ -22,4 +22,3 @@ $("#reloadMessagesButton").click() {% endif %} - diff --git a/leave/templates/cbv/assigned_leave/assigned_leave_export.html b/leave/templates/cbv/assigned_leave/assigned_leave_export.html index dc1c6832b..2634cfd4e 100644 --- a/leave/templates/cbv/assigned_leave/assigned_leave_export.html +++ b/leave/templates/cbv/assigned_leave/assigned_leave_export.html @@ -155,5 +155,3 @@ - - \ No newline at end of file diff --git a/leave/templates/cbv/assigned_leave/assigned_leave_home.html b/leave/templates/cbv/assigned_leave/assigned_leave_home.html index ff0e533f1..5389d08d4 100644 --- a/leave/templates/cbv/assigned_leave/assigned_leave_home.html +++ b/leave/templates/cbv/assigned_leave/assigned_leave_home.html @@ -12,7 +12,7 @@
-
+
@@ -77,4 +77,4 @@ $('.oh-modal--show').removeClass('oh-modal--show'); }); -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/leave/templates/cbv/assigned_leave/nav_fixed_filter.html b/leave/templates/cbv/assigned_leave/nav_fixed_filter.html index 19cf54b0a..8c0670b36 100644 --- a/leave/templates/cbv/assigned_leave/nav_fixed_filter.html +++ b/leave/templates/cbv/assigned_leave/nav_fixed_filter.html @@ -5,4 +5,4 @@ \ No newline at end of file + diff --git a/leave/templates/cbv/compensatory_leave/compensatory_actions.html b/leave/templates/cbv/compensatory_leave/compensatory_actions.html index 82aa07966..3083c43b8 100644 --- a/leave/templates/cbv/compensatory_leave/compensatory_actions.html +++ b/leave/templates/cbv/compensatory_leave/compensatory_actions.html @@ -2,24 +2,24 @@
{% if instance.status == 'requested' %} - {% else %} - + {% endif %} {% if instance.status != 'approved' %} @@ -31,4 +31,4 @@ {% endif %}
-
\ No newline at end of file +
diff --git a/leave/templates/cbv/compensatory_leave/compensatory_comment.html b/leave/templates/cbv/compensatory_leave/compensatory_comment.html index d7138f924..da3cbd570 100644 --- a/leave/templates/cbv/compensatory_leave/compensatory_comment.html +++ b/leave/templates/cbv/compensatory_leave/compensatory_comment.html @@ -3,4 +3,3 @@ data-target = '#allocationactivitySidebar' title='{% trans "Add / View Comment" %}' class="oh-btn oh-btn--light oh-activity-sidebar__open w-100" style="flex: 1 0 auto; width:20px;height: 40.68px; padding: 0;" onclick="event.stopPropagation()"> - diff --git a/leave/templates/cbv/compensatory_leave/compensatory_confirmation.html b/leave/templates/cbv/compensatory_leave/compensatory_confirmation.html index 26885adec..9d060124f 100644 --- a/leave/templates/cbv/compensatory_leave/compensatory_confirmation.html +++ b/leave/templates/cbv/compensatory_leave/compensatory_confirmation.html @@ -4,8 +4,8 @@ {% if perms.leave.change_leaveallocationrequest or request.user|is_reportingmanager %} {% if instance.status == 'requested' %} - diff --git a/leave/templates/cbv/compensatory_leave/compensatory_detail_actions.html b/leave/templates/cbv/compensatory_leave/compensatory_detail_actions.html index 7cd8f6057..4ac15ddcd 100644 --- a/leave/templates/cbv/compensatory_leave/compensatory_detail_actions.html +++ b/leave/templates/cbv/compensatory_leave/compensatory_detail_actions.html @@ -5,8 +5,8 @@
{% if perms.leave.change_compensatoryleaverequest or request.user|is_reportingmanager %} {% if instance.status == 'requested' %} - @@ -49,4 +49,3 @@ $("#reloadMessagesButton").click() {% endif %} - \ No newline at end of file diff --git a/leave/templates/cbv/compensatory_leave/compensatory_home.html b/leave/templates/cbv/compensatory_leave/compensatory_home.html index 45c599e8a..251bbc3e2 100644 --- a/leave/templates/cbv/compensatory_leave/compensatory_home.html +++ b/leave/templates/cbv/compensatory_leave/compensatory_home.html @@ -17,31 +17,31 @@ .status-rejected{ border-left: 4px solid red !important; border-radius: 5px 0 0 4px; - + } .status-requested{ - + border-left: 4px solid rgb(103, 171, 238)!important; border-radius: 5px 0 0 4px; - + } .status-approved { border-left: 4px solid yellowgreen !important; border-radius: 5px 0 0 4px; - - } + + }
-
+
{% include "generic/components.html" %}
-
+
diff --git a/leave/templates/cbv/compensatory_leave/compensatory_leave_filter.html b/leave/templates/cbv/compensatory_leave/compensatory_leave_filter.html index 624e73869..87b25e410 100644 --- a/leave/templates/cbv/compensatory_leave/compensatory_leave_filter.html +++ b/leave/templates/cbv/compensatory_leave/compensatory_leave_filter.html @@ -53,4 +53,4 @@
- \ No newline at end of file + diff --git a/leave/templates/cbv/compensatory_leave/custom_date.html b/leave/templates/cbv/compensatory_leave/custom_date.html index 558ac4114..979b355f7 100644 --- a/leave/templates/cbv/compensatory_leave/custom_date.html +++ b/leave/templates/cbv/compensatory_leave/custom_date.html @@ -3,4 +3,4 @@ {% for attendance in instance.attendance_id.all %} {{ attendance.attendance_date }}
{% endfor %} - \ No newline at end of file + diff --git a/leave/templates/cbv/compensatory_leave/detail_reject_reason.html b/leave/templates/cbv/compensatory_leave/detail_reject_reason.html index f9e9df192..b2e4156e5 100644 --- a/leave/templates/cbv/compensatory_leave/detail_reject_reason.html +++ b/leave/templates/cbv/compensatory_leave/detail_reject_reason.html @@ -10,4 +10,4 @@ {% endif %} {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/compensatory_leave/inherit_class.html b/leave/templates/cbv/compensatory_leave/inherit_class.html index 45cb6a5ff..c381a9b75 100644 --- a/leave/templates/cbv/compensatory_leave/inherit_class.html +++ b/leave/templates/cbv/compensatory_leave/inherit_class.html @@ -1,3 +1,3 @@
{% include "generic/horilla_tabs.html" %} -
\ No newline at end of file + diff --git a/leave/templates/cbv/compensatory_leave/my_compensatory_detail_action.html b/leave/templates/cbv/compensatory_leave/my_compensatory_detail_action.html index c17b33a0a..14e73d992 100644 --- a/leave/templates/cbv/compensatory_leave/my_compensatory_detail_action.html +++ b/leave/templates/cbv/compensatory_leave/my_compensatory_detail_action.html @@ -4,12 +4,12 @@
{% if instance.status == 'requested' %} - - {% endif %}
- \ No newline at end of file + diff --git a/leave/templates/cbv/leave_allocation_request/attachment.html b/leave/templates/cbv/leave_allocation_request/attachment.html index 7d3c93539..a7ad71e4e 100644 --- a/leave/templates/cbv/leave_allocation_request/attachment.html +++ b/leave/templates/cbv/leave_allocation_request/attachment.html @@ -5,4 +5,4 @@ {% trans "View attachment" %}
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/leave/templates/cbv/leave_allocation_request/comment.html b/leave/templates/cbv/leave_allocation_request/comment.html index a34f3f6b7..03912a1f7 100644 --- a/leave/templates/cbv/leave_allocation_request/comment.html +++ b/leave/templates/cbv/leave_allocation_request/comment.html @@ -4,4 +4,4 @@ class="oh-btn oh-btn--light oh-activity-sidebar__open w-100" title="{% trans 'Add / View Comment' %}" style="flex: 1 0 auto; width:20px;height: 40.68px; padding: 0;"> - \ No newline at end of file + diff --git a/leave/templates/cbv/leave_allocation_request/confirmations.html b/leave/templates/cbv/leave_allocation_request/confirmations.html index 844034887..7ca212c67 100644 --- a/leave/templates/cbv/leave_allocation_request/confirmations.html +++ b/leave/templates/cbv/leave_allocation_request/confirmations.html @@ -34,4 +34,4 @@ {% endif %} {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/leave_allocation_request/detail_action.html b/leave/templates/cbv/leave_allocation_request/detail_action.html index 65a807076..6e04c2910 100644 --- a/leave/templates/cbv/leave_allocation_request/detail_action.html +++ b/leave/templates/cbv/leave_allocation_request/detail_action.html @@ -1,7 +1,7 @@ {% load i18n %}
- + {% if instance.status == 'requested' %}
- \ No newline at end of file + diff --git a/leave/templates/cbv/leave_allocation_request/history.html b/leave/templates/cbv/leave_allocation_request/history.html index 8aba2a7f3..f349739d3 100644 --- a/leave/templates/cbv/leave_allocation_request/history.html +++ b/leave/templates/cbv/leave_allocation_request/history.html @@ -1,6 +1,6 @@ {% load i18n %} {% if instance.allocate_tracking and instance.status == 'approved' %} - +
{% trans "History" %} @@ -16,9 +16,5 @@
- - {% endif %} - - - \ No newline at end of file + {% endif %} diff --git a/leave/templates/cbv/leave_allocation_request/leave_allocation_request.html b/leave/templates/cbv/leave_allocation_request/leave_allocation_request.html index 5bd92f565..314ef1cda 100644 --- a/leave/templates/cbv/leave_allocation_request/leave_allocation_request.html +++ b/leave/templates/cbv/leave_allocation_request/leave_allocation_request.html @@ -27,7 +27,7 @@ top: 25px; right: 15px; } - + .approved--dot{ background-color:yellowgreen; } @@ -68,7 +68,7 @@
-
+ {% include "generic/components.html" %} @@ -82,10 +82,10 @@ style="display: none" > - -
@@ -122,6 +122,6 @@ }); }); - - -{% endblock content %} \ No newline at end of file + + +{% endblock content %} diff --git a/leave/templates/cbv/leave_allocation_request/leave_detail_action.html b/leave/templates/cbv/leave_allocation_request/leave_detail_action.html index 61a1f24fc..538996979 100644 --- a/leave/templates/cbv/leave_allocation_request/leave_detail_action.html +++ b/leave/templates/cbv/leave_allocation_request/leave_detail_action.html @@ -36,4 +36,4 @@ {% trans "Reject" %} {% endif %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/leave/templates/cbv/leave_allocation_request/reject.html b/leave/templates/cbv/leave_allocation_request/reject.html index 7e72a1225..1d2621347 100644 --- a/leave/templates/cbv/leave_allocation_request/reject.html +++ b/leave/templates/cbv/leave_allocation_request/reject.html @@ -8,4 +8,4 @@
{% endif %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/leave/templates/cbv/leave_requests/actions_col.html b/leave/templates/cbv/leave_requests/actions_col.html index ebace8715..843229ed4 100644 --- a/leave/templates/cbv/leave_requests/actions_col.html +++ b/leave/templates/cbv/leave_requests/actions_col.html @@ -23,7 +23,7 @@ - + {% endif %} {% if instance.status == 'requested' %} - + {% else %} - \ No newline at end of file + diff --git a/leave/templates/cbv/leave_requests/confirmation.html b/leave/templates/cbv/leave_requests/confirmation.html index 4d6dff341..cc96bcce5 100644 --- a/leave/templates/cbv/leave_requests/confirmation.html +++ b/leave/templates/cbv/leave_requests/confirmation.html @@ -19,11 +19,11 @@ {% else %} {% if instance.is_approved and instance.status == 'requested' %} current_date.month %} - onclick="leaveRequestConfirm('This leave request is for the month of {{instance.start_date|date:'F'}}. Approval depends on the {{instance.employee_id.get_full_name}} having available leave days for this month.', event);" - {% else %} - onclick="return confirm('Do you really want to approve this request?');" + class="oh-btn oh-btn--success w-100" + {% if instance.end_date.month > current_date.month %} + onclick="leaveRequestConfirm('This leave request is for the month of {{instance.start_date|date:'F'}}. Approval depends on the {{instance.employee_id.get_full_name}} having available leave days for this month.', event);" + {% else %} + onclick="return confirm('Do you really want to approve this request?');" {% endif %}> @@ -32,22 +32,22 @@ class="oh-btn oh-btn--success oh-btn--disabled w-100"> - {% endif %} + {% endif %} {% comment %} {% if instance.is_approved and instance.status == 'requested' %} - {% else %} - @@ -84,11 +84,11 @@ {% else %} {% if instance.is_approved and instance.status == 'requested' %} diff --git a/leave/templates/cbv/leave_requests/custom_status_col.html b/leave/templates/cbv/leave_requests/custom_status_col.html index 2605cd4bc..323c60b7c 100644 --- a/leave/templates/cbv/leave_requests/custom_status_col.html +++ b/leave/templates/cbv/leave_requests/custom_status_col.html @@ -10,4 +10,4 @@ {% else %}
{{ instance.get_status_display }}
- {% endif %} \ No newline at end of file + {% endif %} diff --git a/leave/templates/cbv/leave_requests/filter.html b/leave/templates/cbv/leave_requests/filter.html index 99afe74c3..bd8e368d8 100644 --- a/leave/templates/cbv/leave_requests/filter.html +++ b/leave/templates/cbv/leave_requests/filter.html @@ -5,7 +5,7 @@
{% trans "Leave Request" %}
- +
@@ -67,11 +67,11 @@ {{form.employee_id__employee_work_info__work_type_id}}
- +
- +
{% trans "Advanced" %}
diff --git a/leave/templates/cbv/leave_requests/form/inherit.html b/leave/templates/cbv/leave_requests/form/inherit.html index d142e40e1..d73ab4b16 100644 --- a/leave/templates/cbv/leave_requests/form/inherit.html +++ b/leave/templates/cbv/leave_requests/form/inherit.html @@ -10,7 +10,7 @@ $(this).closest("select")[0].dispatchEvent(new Event("change")); }); }); - + $("#createTitle").on("htmx:beforeSwap",function(e){ $('.available-leave-count').remove(); }); @@ -56,7 +56,7 @@ content += `

Are you sure you want to proceed with the request?

`; - + if (interviews.length != 0) { Swal.fire({ title: title, @@ -81,4 +81,4 @@ }); }); {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/leave_requests/leave_clash.html b/leave/templates/cbv/leave_requests/leave_clash.html index f359ad659..a4af540da 100644 --- a/leave/templates/cbv/leave_requests/leave_clash.html +++ b/leave/templates/cbv/leave_requests/leave_clash.html @@ -9,4 +9,3 @@
- diff --git a/leave/templates/cbv/leave_requests/leave_request_detail_actions.html b/leave/templates/cbv/leave_requests/leave_request_detail_actions.html index 98250b925..d0d54e5b6 100644 --- a/leave/templates/cbv/leave_requests/leave_request_detail_actions.html +++ b/leave/templates/cbv/leave_requests/leave_request_detail_actions.html @@ -17,7 +17,7 @@ data-target="#penaltyModal" hx-target="#penaltyModalBody" hx-get="{% url 'leave-cut-penalty' instance.id %}" - type="submit" class="oh-btn oh-btn--info w-100" + type="submit" class="oh-btn oh-btn--info w-100" title="Penalty" id="penaltyButton"> @@ -36,4 +36,4 @@ {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/leave_requests/leave_request_emp_col.html b/leave/templates/cbv/leave_requests/leave_request_emp_col.html index ba246ee58..1b7978a3e 100644 --- a/leave/templates/cbv/leave_requests/leave_request_emp_col.html +++ b/leave/templates/cbv/leave_requests/leave_request_emp_col.html @@ -1,5 +1,5 @@ {% load i18n %} -{% load basefilters %} +{% load basefilters %} {% if leave_requests_with_interview %}
diff --git a/leave/templates/cbv/leave_requests/leave_requests_export.html b/leave/templates/cbv/leave_requests/leave_requests_export.html index 645c71b23..a2875a165 100644 --- a/leave/templates/cbv/leave_requests/leave_requests_export.html +++ b/leave/templates/cbv/leave_requests/leave_requests_export.html @@ -157,4 +157,3 @@
- diff --git a/leave/templates/cbv/leave_requests/multiple_approval_action.html b/leave/templates/cbv/leave_requests/multiple_approval_action.html index 7fae05102..532474c9c 100644 --- a/leave/templates/cbv/leave_requests/multiple_approval_action.html +++ b/leave/templates/cbv/leave_requests/multiple_approval_action.html @@ -18,5 +18,3 @@ {% endif %} - - diff --git a/leave/templates/cbv/leave_types/detail_actions.html b/leave/templates/cbv/leave_types/detail_actions.html index 42e4b45c7..1d18947e7 100644 --- a/leave/templates/cbv/leave_types/detail_actions.html +++ b/leave/templates/cbv/leave_types/detail_actions.html @@ -17,9 +17,9 @@ hx-get="{% url 'assign-one' instance.id %}" hx-target="#genericModalBody" class="oh-btn oh-btn--success w-50"> {% trans "Assign" %} - + {% endif %} - {% trans "Delete" %} @@ -34,4 +34,4 @@ -{% endif %} {% endcomment %} \ No newline at end of file +{% endif %} {% endcomment %} diff --git a/leave/templates/cbv/leave_types/inherit.html b/leave/templates/cbv/leave_types/inherit.html index ec44097e9..bb5922b7d 100644 --- a/leave/templates/cbv/leave_types/inherit.html +++ b/leave/templates/cbv/leave_types/inherit.html @@ -3,4 +3,4 @@ \ No newline at end of file + diff --git a/leave/templates/cbv/leave_types/leave_detail_carryforward.html b/leave/templates/cbv/leave_types/leave_detail_carryforward.html index 434b86813..73ac82f3e 100644 --- a/leave/templates/cbv/leave_types/leave_detail_carryforward.html +++ b/leave/templates/cbv/leave_types/leave_detail_carryforward.html @@ -22,4 +22,4 @@ {% trans "Carryforward Expire period" %} {{instance.carryforward_expire_period}} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/leave/templates/cbv/leave_types/leave_detail_reset.html b/leave/templates/cbv/leave_types/leave_detail_reset.html index db69ab6c1..5e886b612 100644 --- a/leave/templates/cbv/leave_types/leave_detail_reset.html +++ b/leave/templates/cbv/leave_types/leave_detail_reset.html @@ -31,4 +31,4 @@ {% trans "Reset weekend" %} {{instance.get_reset_weekend_display}} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/leave/templates/cbv/leave_types/leave_type_home.html b/leave/templates/cbv/leave_types/leave_type_home.html index 353413c43..608689e0e 100644 --- a/leave/templates/cbv/leave_types/leave_type_home.html +++ b/leave/templates/cbv/leave_types/leave_type_home.html @@ -44,10 +44,10 @@ style="display: none" > - -
@@ -58,4 +58,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/leave/templates/cbv/leave_types/leave_type_list_actions.html b/leave/templates/cbv/leave_types/leave_type_list_actions.html index 903cd3f41..07f2aa580 100644 --- a/leave/templates/cbv/leave_types/leave_type_list_actions.html +++ b/leave/templates/cbv/leave_types/leave_type_list_actions.html @@ -4,7 +4,7 @@
- + {% endif %} @@ -16,14 +16,14 @@ {% else %} - + {% endif %} {% endif %} {% if perms.leave.delete_leavetype and perms.leave.add_availableleave %} - @@ -31,5 +31,5 @@ {% endif %} - +
diff --git a/leave/templates/cbv/my_leave_request/attachment_action.html b/leave/templates/cbv/my_leave_request/attachment_action.html index 91b236b07..dac57fbc5 100644 --- a/leave/templates/cbv/my_leave_request/attachment_action.html +++ b/leave/templates/cbv/my_leave_request/attachment_action.html @@ -3,7 +3,7 @@ .diff-cell{ background: rgba(255, 166, 0, 0.158); } - + {% if instance.attachment %} @@ -14,4 +14,3 @@ {% endif %} - diff --git a/leave/templates/cbv/my_leave_request/cancelled_action.html b/leave/templates/cbv/my_leave_request/cancelled_action.html index 3469124eb..5345318ad 100644 --- a/leave/templates/cbv/my_leave_request/cancelled_action.html +++ b/leave/templates/cbv/my_leave_request/cancelled_action.html @@ -3,9 +3,9 @@ .diff-cell{ background: rgba(255, 166, 0, 0.158); } - + - + {% if instance.reject_reason %} {% if instance.status == "cancelled" %}
@@ -16,4 +16,3 @@
{% endif %} {% endif %} - \ No newline at end of file diff --git a/leave/templates/cbv/my_leave_request/comment.html b/leave/templates/cbv/my_leave_request/comment.html index 15cdee585..cc14b845c 100644 --- a/leave/templates/cbv/my_leave_request/comment.html +++ b/leave/templates/cbv/my_leave_request/comment.html @@ -4,4 +4,4 @@ data-target = '#leaveactivitySidebar' title='{% trans "Add / View Comment" %}' class="oh-btn oh-btn--light oh-activity-sidebar__open w-100" style="flex: 1 0 auto; width:20px;height: 40.68px; padding: 0;" onclick="event.stopPropagation()"> - \ No newline at end of file + diff --git a/leave/templates/cbv/my_leave_request/confirm_cancel.html b/leave/templates/cbv/my_leave_request/confirm_cancel.html index fb1019d34..44903119e 100644 --- a/leave/templates/cbv/my_leave_request/confirm_cancel.html +++ b/leave/templates/cbv/my_leave_request/confirm_cancel.html @@ -11,7 +11,7 @@ {% else %} + {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/my_leave_request/detail_leave_actions.html b/leave/templates/cbv/my_leave_request/detail_leave_actions.html index 9d79a3a6d..9af94eadc 100644 --- a/leave/templates/cbv/my_leave_request/detail_leave_actions.html +++ b/leave/templates/cbv/my_leave_request/detail_leave_actions.html @@ -1,10 +1,10 @@ {% load basefilters %} {% load i18n %} {% if instance.status == 'requested'%} -
@@ -12,7 +12,7 @@ {% endif %} {% if instance.status == 'requested'%} -
{% csrf_token %} @@ -23,7 +23,7 @@ {% endif %} -{% comment %} +{% comment %} {% load i18n %}
{% if instance.status == 'requested'%} @@ -53,4 +53,4 @@
{% endif %} - {% endcomment %} \ No newline at end of file + {% endcomment %} diff --git a/leave/templates/cbv/my_leave_request/filter.html b/leave/templates/cbv/my_leave_request/filter.html index 2b4e857b9..8f567f347 100644 --- a/leave/templates/cbv/my_leave_request/filter.html +++ b/leave/templates/cbv/my_leave_request/filter.html @@ -62,4 +62,4 @@ - \ No newline at end of file + diff --git a/leave/templates/cbv/my_leave_request/form/inherit.html b/leave/templates/cbv/my_leave_request/form/inherit.html index 7295afda3..a0ed6a2a6 100644 --- a/leave/templates/cbv/my_leave_request/form/inherit.html +++ b/leave/templates/cbv/my_leave_request/form/inherit.html @@ -39,7 +39,7 @@ }, success: function (response) { var interviews = response.interviews; - + title = "Leave Request Alert."; var content = `

{{request.user.employee_get}} has interview in the requested date.

@@ -50,7 +50,7 @@ content += `

Are you sure you want to proceed with the request?

`; - + if (interviews.length != 0) { Swal.fire({ title: title, @@ -75,4 +75,4 @@ }); }); {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/my_leave_request/leave_actions.html b/leave/templates/cbv/my_leave_request/leave_actions.html index d7245e7bf..82d38818b 100644 --- a/leave/templates/cbv/my_leave_request/leave_actions.html +++ b/leave/templates/cbv/my_leave_request/leave_actions.html @@ -28,4 +28,4 @@ {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/my_leave_request/leave_type_col.html b/leave/templates/cbv/my_leave_request/leave_type_col.html index ebfdfc338..03e454cf1 100644 --- a/leave/templates/cbv/my_leave_request/leave_type_col.html +++ b/leave/templates/cbv/my_leave_request/leave_type_col.html @@ -1,5 +1,5 @@ {% load i18n %} -{% load basefilters %} +{% load basefilters %} {% if leave_requests_with_interview %}
@@ -25,4 +25,4 @@
{{instance.leave_type_id}} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/leave/templates/cbv/my_leave_request/rejected_action.html b/leave/templates/cbv/my_leave_request/rejected_action.html index 090b4de0d..b6ef915ee 100644 --- a/leave/templates/cbv/my_leave_request/rejected_action.html +++ b/leave/templates/cbv/my_leave_request/rejected_action.html @@ -3,9 +3,9 @@ .diff-cell{ background: rgba(255, 166, 0, 0.158); } - + - + {% if instance.reject_reason %} {% if instance.status == "rejected" %}
@@ -14,7 +14,6 @@
{{instance.reject_reason}}
- - {% endif %} - {% endif %} + {% endif %} + {% endif %} diff --git a/leave/templates/cbv/restricted_days/actions.html b/leave/templates/cbv/restricted_days/actions.html index 09505adf9..22266ab51 100644 --- a/leave/templates/cbv/restricted_days/actions.html +++ b/leave/templates/cbv/restricted_days/actions.html @@ -27,4 +27,4 @@ {% endif %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/leave/templates/cbv/restricted_days/detail_action.html b/leave/templates/cbv/restricted_days/detail_action.html index 36ce4fda2..f0bb43aa9 100644 --- a/leave/templates/cbv/restricted_days/detail_action.html +++ b/leave/templates/cbv/restricted_days/detail_action.html @@ -26,10 +26,10 @@ {% endif %} - + {% endif %} {% if request.GET.deleted %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/leave/templates/cbv/restricted_days/job_position.html b/leave/templates/cbv/restricted_days/job_position.html index 5ebee16c8..3c3bdcb7f 100644 --- a/leave/templates/cbv/restricted_days/job_position.html +++ b/leave/templates/cbv/restricted_days/job_position.html @@ -6,4 +6,4 @@ {% else %} All {% endif %} - \ No newline at end of file + diff --git a/leave/templates/cbv/restricted_days/restricted_days.html b/leave/templates/cbv/restricted_days/restricted_days.html index 1bfc33fe9..b1fc9cb23 100644 --- a/leave/templates/cbv/restricted_days/restricted_days.html +++ b/leave/templates/cbv/restricted_days/restricted_days.html @@ -27,10 +27,10 @@ style="display: none" > - -
@@ -43,5 +43,5 @@ hx-post="{% url 'restrict-days-bulk-delete' %}?{{pd}}" hx-target="#restrictday" > - -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/offboarding/cbv/accessibility.py b/offboarding/cbv/accessibility.py index 7d8fe6856..ea1e0f075 100644 --- a/offboarding/cbv/accessibility.py +++ b/offboarding/cbv/accessibility.py @@ -2,10 +2,10 @@ Accessibility page to specify the permissions """ -from base.context_processors import resignation_request_enabled -from employee.models import Employee from django.contrib.auth.context_processors import PermWrapper +from base.context_processors import resignation_request_enabled +from employee.models import Employee from offboarding.templatetags.offboarding_filter import ( is_any_stage_manager, is_offboarding_manager, @@ -51,6 +51,7 @@ def add_employee_accessibility( ) return perms + def delete_stage_accessibility( request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs ): diff --git a/offboarding/cbv/exit_process.py b/offboarding/cbv/exit_process.py index 9c552c5b8..a57b65041 100644 --- a/offboarding/cbv/exit_process.py +++ b/offboarding/cbv/exit_process.py @@ -2,26 +2,29 @@ This page handles the cbv methods for existing process """ -from datetime import datetime, timedelta import re +from datetime import datetime, timedelta + from django import forms -from django.http import HttpResponse from django.contrib import messages +from django.http import HttpResponse from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ + from base.context_processors import intial_notice_period from base.methods import eval_validate +from horilla_views.cbv_methods import login_required, permission_required +from horilla_views.generic.cbv.pipeline import Pipeline from horilla_views.generic.cbv.views import ( HorillaDetailedView, HorillaFormView, - HorillaSectionView, - HorillaNavView, HorillaListView, + HorillaNavView, + HorillaSectionView, HorillaTabView, ) -from horilla_views.generic.cbv.pipeline import Pipeline -from horilla_views.cbv_methods import login_required, permission_required +from notifications.signals import notify from offboarding.cbv_decorators import ( any_manager_can_enter, offboarding_manager_can_enter, @@ -34,19 +37,17 @@ from offboarding.filters import ( ) from offboarding.forms import ( OffboardingEmployeeForm, - OffboardingStageForm, OffboardingForm, + OffboardingStageForm, TaskForm, ) from offboarding.models import ( EmployeeTask, - OffboardingEmployee, - OffboardingStage, Offboarding, OffboardingEmployee, + OffboardingStage, OffboardingTask, ) -from notifications.signals import notify from offboarding.templatetags.offboarding_filter import ( any_manager, is_offboarding_manager, @@ -406,10 +407,10 @@ class OffboardingPipelineStage(Pipeline): "action": "Edit", "accessibility": "offboarding.cbv.accessibility.edit_stage_accessibility", "attrs": """ - hx-target="#genericModalBody" - hx-get="{get_update_url}" - data-toggle="oh-modal-toggle" - data-target="#genericModal" + hx-target="#genericModalBody" + hx-get="{get_update_url}" + data-toggle="oh-modal-toggle" + data-target="#genericModal" """, }, { @@ -522,7 +523,7 @@ class OffboardingEmployeeList(HorillaListView): - None: super().__init__(**kwargs) - self.search_url = reverse('list-resignation-request') + self.search_url = reverse("list-resignation-request") if self.request.user.has_perm("offboarding.change_resignationletter"): self.action_method = "actions_column" @@ -107,14 +120,14 @@ class ResignationListView(HorillaListView): (_("Title"), "title"), (_("Planned To Leave"), "planned_to_leave_on"), (_("Status"), "get_status"), - (_("Description"), "description_col") + (_("Description"), "description_col"), ] header_attrs = { - "description_col" : """ + "description_col": """ style="width:200px !important" - """ - } + """ + } sortby_mapping = [ ("Employee", "employee_id", "employee_id__get_avatar"), @@ -123,10 +136,14 @@ class ResignationListView(HorillaListView): ] - @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("offboarding.view_resignationletter"),name="dispatch") -@method_decorator(check_feature_enabled("resignation_request",OffboardingGeneralSetting),name="dispatch") +@method_decorator( + permission_required("offboarding.view_resignationletter"), name="dispatch" +) +@method_decorator( + check_feature_enabled("resignation_request", OffboardingGeneralSetting), + name="dispatch", +) class ResinationLettersNav(HorillaNavView): """ Nav bar @@ -154,7 +171,10 @@ class ResinationLettersNav(HorillaNavView): ("status", _("Status")), ("employee_id__employee_work_info__department_id", _("Department")), ("employee_id__employee_work_info__job_position_id", _("Job Position")), - ("employee_id__employee_work_info__reporting_manager_id", _("Reporting Manager")), + ( + "employee_id__employee_work_info__reporting_manager_id", + _("Reporting Manager"), + ), ] @@ -186,8 +206,13 @@ class ResignationLettersFormView(HorillaFormView): @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("offboarding.view_resignationletter"),name="dispatch") -@method_decorator(check_feature_enabled("resignation_request",OffboardingGeneralSetting),name="dispatch") +@method_decorator( + permission_required("offboarding.view_resignationletter"), name="dispatch" +) +@method_decorator( + check_feature_enabled("resignation_request", OffboardingGeneralSetting), + name="dispatch", +) class ResignationLetterDetailView(HorillaDetailedView): """ detail view of resignations @@ -208,8 +233,8 @@ class ResignationLetterDetailView(HorillaDetailedView): return context body = [ - (_(""),""), - (_("Actions"),"option_column",True), + (_(""), ""), + (_("Actions"), "option_column", True), (_("Planned To Leave"), "planned_to_leave_on"), (_("Status"), "get_status"), (_("Description"), "detail_description_col"), diff --git a/offboarding/cbv/resignation_tab.py b/offboarding/cbv/resignation_tab.py index 83a550c73..fe785bf37 100644 --- a/offboarding/cbv/resignation_tab.py +++ b/offboarding/cbv/resignation_tab.py @@ -1,19 +1,20 @@ """ -This page handles the cbv methods for resignation tab +This page handles the cbv methods for resignation tab """ from typing import Any + from django.urls import reverse from django.utils.decorators import method_decorator + from employee.cbv.employee_profile import EmployeeProfileView +from horilla_views.cbv_methods import check_feature_enabled, login_required from offboarding.cbv.resignation import ResignationLetterDetailView, ResignationListView -from horilla_views.cbv_methods import login_required, check_feature_enabled from offboarding.models import OffboardingGeneralSetting # @method_decorator(check_feature_enabled("resignation_request", OffboardingGeneralSetting), name="dispatch") class ResignationTabView(ResignationListView): - """ List view of resignation Tab in profile """ @@ -25,7 +26,7 @@ class ResignationTabView(ResignationListView): self.action_method = None self.view_id = "resignation-container" pk = self.request.resolver_match.kwargs.get("pk") - self.search_url = reverse("individual-resignation-tab-list",kwargs={'pk':pk}) + self.search_url = reverse("individual-resignation-tab-list", kwargs={"pk": pk}) template_name = "cbv/resignation/resignation_tab.html" diff --git a/offboarding/cbv_decorators.py b/offboarding/cbv_decorators.py index 380dcfdc9..40afcb118 100644 --- a/offboarding/cbv_decorators.py +++ b/offboarding/cbv_decorators.py @@ -1,9 +1,10 @@ +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render + from horilla.decorators import decorator_with_arguments -from offboarding.models import Offboarding, OffboardingStage, OffboardingTask from horilla.horilla_middlewares import _thread_locals -from django.contrib import messages +from offboarding.models import Offboarding, OffboardingStage, OffboardingTask @decorator_with_arguments @@ -34,7 +35,6 @@ def any_manager_can_enter(function, perm, offboarding_employee_can_enter=False): return _function - @decorator_with_arguments def offboarding_manager_can_enter(function, perm): def _function(self, *args, **kwargs): diff --git a/offboarding/templates/cbv/exit_process/detail_view_tasks.html b/offboarding/templates/cbv/exit_process/detail_view_tasks.html index 9318d3362..edf4e156d 100644 --- a/offboarding/templates/cbv/exit_process/detail_view_tasks.html +++ b/offboarding/templates/cbv/exit_process/detail_view_tasks.html @@ -28,7 +28,7 @@ {% else %} - {% endif %} + {% endif %} {% endfor %}
@@ -47,4 +47,4 @@ dot.removeClass().addClass('oh-dot oh-dot--small me-1 oh-dot--color-' + value); }) }) - \ No newline at end of file + diff --git a/offboarding/templates/cbv/exit_process/detailed_page_empty.html b/offboarding/templates/cbv/exit_process/detailed_page_empty.html index 0659a5355..823557795 100644 --- a/offboarding/templates/cbv/exit_process/detailed_page_empty.html +++ b/offboarding/templates/cbv/exit_process/detailed_page_empty.html @@ -13,4 +13,4 @@
{% trans "No Records found..." %}
- \ No newline at end of file + diff --git a/offboarding/templates/cbv/exit_process/pipeline_action_col.html b/offboarding/templates/cbv/exit_process/pipeline_action_col.html index 300122f93..77dce56a7 100644 --- a/offboarding/templates/cbv/exit_process/pipeline_action_col.html +++ b/offboarding/templates/cbv/exit_process/pipeline_action_col.html @@ -63,7 +63,7 @@ type="button" hx-confirm="Do you want to delete this offboarding user?" hx-post="{% url "delete-offboarding-employee" %}?employee_ids={{employee.id}}" - hx-swap="none" + hx-swap="none" hx-on-htmx-after-request = "$(`#offboardingStageContainer{{stage.pk}}`).find('.reload-record').click()" title="{% trans 'Delete' %}" class="oh-btn oh-btn--light w-100" @@ -84,4 +84,4 @@ {% endif %} - \ No newline at end of file + diff --git a/offboarding/templates/cbv/exit_process/pipeline_filter.html b/offboarding/templates/cbv/exit_process/pipeline_filter.html index 86faca6f4..c4777e7c9 100644 --- a/offboarding/templates/cbv/exit_process/pipeline_filter.html +++ b/offboarding/templates/cbv/exit_process/pipeline_filter.html @@ -99,4 +99,4 @@ - \ No newline at end of file + diff --git a/offboarding/templates/cbv/exit_process/pipeline_stage_col.html b/offboarding/templates/cbv/exit_process/pipeline_stage_col.html index fc4cb003b..bcebbf85a 100644 --- a/offboarding/templates/cbv/exit_process/pipeline_stage_col.html +++ b/offboarding/templates/cbv/exit_process/pipeline_stage_col.html @@ -9,4 +9,4 @@ {{employee.stage_id}} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/offboarding/templates/cbv/exit_process/stage_order.html b/offboarding/templates/cbv/exit_process/stage_order.html index ceef974cc..e322c051d 100644 --- a/offboarding/templates/cbv/exit_process/stage_order.html +++ b/offboarding/templates/cbv/exit_process/stage_order.html @@ -50,7 +50,7 @@ $("#sortable li").each(function (index) { order.push($(this).data("id")); }); - + $.ajax({ url: "{% url 'update-stage-sequence' offboarding.id %}", method: "POST", diff --git a/offboarding/templates/cbv/exit_process/tasks_cols.html b/offboarding/templates/cbv/exit_process/tasks_cols.html index 82436d4e2..8ab7f2267 100644 --- a/offboarding/templates/cbv/exit_process/tasks_cols.html +++ b/offboarding/templates/cbv/exit_process/tasks_cols.html @@ -1,4 +1,4 @@ -{% load i18n %} +{% load i18n %} {% if task_id in request.managing_offboarding_tasks or perms.offboarding.change_employeetask or perms.offboarding.change_offboardingtask or instance.stage_id.pk in request.managing_offboarding_stages or instance.stage_id.offboarding_id.pk in request.managing_recruitments or request.user.employee_get == instance.employee_id %}
- {% for choice in task.statuses %} + {% for choice in task.statuses %} {% if choice.0 == task.status %} {% else %} - {% endif %} + {% endif %} {% endfor %} {% else %} @@ -39,6 +39,6 @@ {% endif %}
-{% else %} - {{ task.get_status_display }} +{% else %} + {{ task.get_status_display }} {% endif %} diff --git a/offboarding/templates/cbv/resignation/actions.html b/offboarding/templates/cbv/resignation/actions.html index 3b074b704..56f844c68 100644 --- a/offboarding/templates/cbv/resignation/actions.html +++ b/offboarding/templates/cbv/resignation/actions.html @@ -66,4 +66,4 @@ id="requestCard1Button" /> - \ No newline at end of file + diff --git a/offboarding/templates/cbv/resignation/description.html b/offboarding/templates/cbv/resignation/description.html index cc285b74a..627711095 100644 --- a/offboarding/templates/cbv/resignation/description.html +++ b/offboarding/templates/cbv/resignation/description.html @@ -13,7 +13,7 @@ position: relative; width: 100%; /* Adjust as needed */ } - + .description-text { display: inline; white-space: nowrap; @@ -33,7 +33,7 @@ max-height: 150px; overflow-y: auto; /* Enable vertical scrolling */ overflow-x: hidden; /* Hide horizontal scrolling */ - } + } {% comment %} .full-description { display: none; position: absolute; @@ -47,12 +47,12 @@ overflow-y: scroll; /* Enable vertical scrolling */ overflow-x: hidden; /* Hide horizontal scrolling */ } - + /* Hide scrollbar for Webkit browsers (Chrome, Safari) */ .full-description::-webkit-scrollbar { display: none; } - + /* Hide scrollbar for Firefox */ .full-description { -ms-overflow-style: none; /* IE and Edge */ @@ -62,13 +62,4 @@ .description-container:hover .full-description { display: block; } - - - - - - - - - - + diff --git a/offboarding/templates/cbv/resignation/detail_description.html b/offboarding/templates/cbv/resignation/detail_description.html index 20cda2f10..5da472689 100644 --- a/offboarding/templates/cbv/resignation/detail_description.html +++ b/offboarding/templates/cbv/resignation/detail_description.html @@ -5,11 +5,11 @@ padding: 10px; /* Optional: Add padding for better readability */ border: none; /* Optional: Add a border */ } - +
{{ instance.description|safe }}
\ No newline at end of file + diff --git a/offboarding/templates/cbv/resignation/detail_view.html b/offboarding/templates/cbv/resignation/detail_view.html index 95151b8f6..0e31fc147 100644 --- a/offboarding/templates/cbv/resignation/detail_view.html +++ b/offboarding/templates/cbv/resignation/detail_view.html @@ -3,6 +3,3 @@
{% include "generic/horilla_detailed_view.html" %}
- - - diff --git a/offboarding/templates/cbv/resignation/filter.html b/offboarding/templates/cbv/resignation/filter.html index 6984b3340..d023b15e5 100644 --- a/offboarding/templates/cbv/resignation/filter.html +++ b/offboarding/templates/cbv/resignation/filter.html @@ -35,4 +35,4 @@ - \ No newline at end of file + diff --git a/offboarding/templates/cbv/resignation/options.html b/offboarding/templates/cbv/resignation/options.html index 3369cf188..730692d03 100644 --- a/offboarding/templates/cbv/resignation/options.html +++ b/offboarding/templates/cbv/resignation/options.html @@ -24,4 +24,3 @@ - diff --git a/offboarding/templates/cbv/resignation/resignation.html b/offboarding/templates/cbv/resignation/resignation.html index b27333f56..d687a20c8 100644 --- a/offboarding/templates/cbv/resignation/resignation.html +++ b/offboarding/templates/cbv/resignation/resignation.html @@ -25,16 +25,16 @@ border-left: 3.4px solid yellowgreen !important; border-radius: 4px 0 0 4px; } - + - +
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -50,9 +50,9 @@ style="display: none" > - -
@@ -80,7 +80,7 @@ $("#resignationCells").find("[type=checkbox]").prop("checked", true); } $("[type=checkbox]").change(); - + function resignLetterConfirmation(params, target, approve = false) { // Define the select box options var selectOptions = ``; @@ -88,7 +88,7 @@ `` + '' + ``; - + html = '

' + params + '

' if (approve) { html = html + "
" + selectOptions + `
@@ -132,7 +132,7 @@ target.siblings("input[name=offboarding_id]").val(selectedOffboarding) } target.click(); - + if (event.target.tagName.toLowerCase() === 'form') { event.target.submit(); } else if (event.target.tagName.toLowerCase() === 'a') { @@ -145,4 +145,4 @@ } -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/offboarding/templates/employees/extended_detailed_view.html b/offboarding/templates/employees/extended_detailed_view.html index 32beb5377..5c9212492 100644 --- a/offboarding/templates/employees/extended_detailed_view.html +++ b/offboarding/templates/employees/extended_detailed_view.html @@ -10,7 +10,7 @@ $("#resignationCells").find("[type=checkbox]").prop("checked", true); } $("[type=checkbox]").change(); - + function resignLetterConfirmation(params, target, approve = false) { // Define the select box options var selectOptions = ``; @@ -18,7 +18,7 @@ `` + '' + ``; - + html = '

' + params + '

' if (approve) { html = html + "
" + selectOptions + `
@@ -62,7 +62,7 @@ target.siblings("input[name=offboarding_id]").val(selectedOffboarding) } target.click(); - + if (event.target.tagName.toLowerCase() === 'form') { event.target.submit(); } else if (event.target.tagName.toLowerCase() === 'a') { @@ -74,4 +74,3 @@ }); } - \ No newline at end of file diff --git a/onboarding/cbv/accessibility.py b/onboarding/cbv/accessibility.py index 7cb7c5108..c47e7f3b2 100644 --- a/onboarding/cbv/accessibility.py +++ b/onboarding/cbv/accessibility.py @@ -2,8 +2,8 @@ onboarding/cbv/accessibility.py """ -from recruitment.methods import recruitment_manages from onboarding.templatetags.onboardingfilters import stage_manages +from recruitment.methods import recruitment_manages def edit_stage_accessibility( diff --git a/onboarding/cbv/dashboard.py b/onboarding/cbv/dashboard.py index 08238fb61..6f64ba69a 100644 --- a/onboarding/cbv/dashboard.py +++ b/onboarding/cbv/dashboard.py @@ -3,11 +3,13 @@ Dashboard of onboarding """ from typing import Any + +from django.db.models import CharField, Count, Q, Value +from django.db.models.functions import Cast, Concat from django.urls import reverse -from django.utils.translation import gettext_lazy as _ -from django.db.models import Count, Q, Value, CharField -from django.db.models.functions import Concat, Cast from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import HorillaListView from onboarding.cbv_decorators import all_manager_can_enter @@ -46,22 +48,22 @@ class MyOnboardingTaskList(HorillaListView): header_attrs = { "task_title_count": """ - style = "width:100px !important " + style = "width:100px !important " """, "todo_count": """ - style = "width:55px !important" + style = "width:55px !important" """, "scheduled_count": """ - style = "width:55px !important;" + style = "width:55px !important;" """, "ongoing_count": """ - style = "width:60px !important" + style = "width:60px !important" """, "stuck_count": """ - style = "width:55px !important" + style = "width:55px !important" """, "done_count": """ - style = "width:65px !important" + style = "width:65px !important" """, } diff --git a/onboarding/cbv/onboarding_candidates.py b/onboarding/cbv/onboarding_candidates.py index b12fb1fb1..4f311b2f4 100644 --- a/onboarding/cbv/onboarding_candidates.py +++ b/onboarding/cbv/onboarding_candidates.py @@ -3,10 +3,13 @@ Onboarding candidate view. """ from typing import Any + +from django.db.models import Q from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from django.db.models import Q + +from base.models import HorillaMailTemplate from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaListView, @@ -15,7 +18,6 @@ from horilla_views.generic.cbv.views import ( ) from recruitment.filters import CandidateFilter from recruitment.models import Candidate -from base.models import HorillaMailTemplate @method_decorator(login_required, name="dispatch") @@ -99,7 +101,7 @@ class OnboardingCandidatesList(HorillaListView): $('#applyFilter').closest('form').find('[name=joining_set]').val('true'); $('[name=portal_sent]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -111,7 +113,7 @@ class OnboardingCandidatesList(HorillaListView): $('#applyFilter').closest('form').find('[name=joining_set]').val('false'); $('[name=portal_sent]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -134,7 +136,7 @@ class OnboardingCandidatesList(HorillaListView): $('#applyFilter').closest('form').find('[name=portal_sent]').val('true'); $('[name=joining_set]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -190,7 +192,7 @@ class OnboardingCandidatesNav(HorillaNavView): { "action": _("Send Portal"), "attrs": """ - + data-target="#addAttachments" data-toggle="oh-modal-toggle" id="send-port" diff --git a/onboarding/cbv/onboarding_view.py b/onboarding/cbv/onboarding_view.py index 28bfa3c22..cfb555159 100644 --- a/onboarding/cbv/onboarding_view.py +++ b/onboarding/cbv/onboarding_view.py @@ -1,9 +1,10 @@ """ -This page handles the cbv methods for onboarding view +This page handles the cbv methods for onboarding view """ import contextlib from typing import Any + from django import forms from django.contrib import messages from django.http import HttpResponse @@ -11,10 +12,15 @@ 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 _ -from notifications.signals import notify + from employee.models import Employee -from horilla_views.generic.cbv.views import HorillaDetailedView, HorillaFormView from horilla_views.cbv_methods import login_required +from horilla_views.generic.cbv.views import HorillaDetailedView, HorillaFormView +from notifications.signals import notify +from onboarding.cbv_decorators import ( + recruitment_manager_can_enter, + stage_manager_can_enter, +) from onboarding.forms import ( OnboardingTaskForm, OnboardingViewStageForm, @@ -22,10 +28,6 @@ from onboarding.forms import ( ) from onboarding.models import CandidateTask, OnboardingStage, OnboardingTask from recruitment.models import Candidate -from onboarding.cbv_decorators import ( - recruitment_manager_can_enter, - stage_manager_can_enter, -) @method_decorator(login_required, name="dispatch") diff --git a/onboarding/cbv/pipeline.py b/onboarding/cbv/pipeline.py index 4875bf19c..fb2132e0d 100644 --- a/onboarding/cbv/pipeline.py +++ b/onboarding/cbv/pipeline.py @@ -3,16 +3,18 @@ onboarding/cbv/pipeline.py """ import re + +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse, reverse_lazy -from django.views import View -from django.views.generic import TemplateView from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from django.contrib import messages +from django.views import View +from django.views.generic import TemplateView + from base.methods import eval_validate from horilla.horilla_middlewares import _thread_locals -from horilla_views.cbv_methods import render_template, login_required +from horilla_views.cbv_methods import login_required, render_template from horilla_views.generic.cbv.pipeline import Pipeline from horilla_views.generic.cbv.views import ( HorillaFormView, @@ -20,12 +22,14 @@ from horilla_views.generic.cbv.views import ( HorillaNavView, HorillaTabView, ) +from onboarding import filters as onboarding_filters +from onboarding import forms +from onboarding import models as onboarding_models +from onboarding.cbv_decorators import all_manager_can_enter, stage_manager_can_enter +from onboarding.templatetags.onboardingfilters import stage_manages +from recruitment import models as recruitment_models from recruitment.cbv.candidates import CandidateDetail from recruitment.methods import recruitment_manages -from recruitment import models as recruitment_models -from onboarding.templatetags.onboardingfilters import stage_manages -from onboarding import models as onboarding_models, filters as onboarding_filters, forms -from onboarding.cbv_decorators import all_manager_can_enter, stage_manager_can_enter @method_decorator(login_required, name="dispatch") @@ -228,19 +232,19 @@ class CandidatePipeline(Pipeline): "action": "Edit", "accessibility": "onboarding.cbv.accessibility.edit_stage_accessibility", "attrs": """ - hx-target="#genericModalBody" - hx-get="{edit_stage_path}" - data-toggle="oh-modal-toggle" - data-target="#genericModal" + hx-target="#genericModalBody" + hx-get="{edit_stage_path}" + data-toggle="oh-modal-toggle" + data-target="#genericModal" """, }, { "action": "Bulk Mail", "attrs": """ hx-target="#objectCreateModalTarget" - hx-get="{bulk_send_mail_path}" - data-toggle="oh-modal-toggle" - data-target="#objectCreateModal" + hx-get="{bulk_send_mail_path}" + data-toggle="oh-modal-toggle" + data-target="#objectCreateModal" """, }, { @@ -551,7 +555,7 @@ class CandidateList(HorillaListView): - {{ candidate_tasks.first.onboarding_task_id.task_title }}
{% include "generic/horilla_list.html" %} -
\ No newline at end of file +
diff --git a/onboarding/templates/cbv/dashboard/status.html b/onboarding/templates/cbv/dashboard/status.html index aed5608c1..80bfb8704 100644 --- a/onboarding/templates/cbv/dashboard/status.html +++ b/onboarding/templates/cbv/dashboard/status.html @@ -39,4 +39,4 @@ >{{status.1}} {% endfor %} - \ No newline at end of file + diff --git a/onboarding/templates/cbv/onboarding_candidates/actions.html b/onboarding/templates/cbv/onboarding_candidates/actions.html index 51284738a..b60e5a8cf 100644 --- a/onboarding/templates/cbv/onboarding_candidates/actions.html +++ b/onboarding/templates/cbv/onboarding_candidates/actions.html @@ -15,7 +15,7 @@ {% endif %} {% if not instance.onboarding_stage %}
- @@ -39,7 +39,7 @@
{% else %} - @@ -70,4 +70,4 @@ -
\ No newline at end of file +
diff --git a/onboarding/templates/cbv/onboarding_candidates/cand_email.html b/onboarding/templates/cbv/onboarding_candidates/cand_email.html index 83e32d7d0..b375d516e 100644 --- a/onboarding/templates/cbv/onboarding_candidates/cand_email.html +++ b/onboarding/templates/cbv/onboarding_candidates/cand_email.html @@ -4,4 +4,4 @@ {% if instance.get_last_sent_mail %} {% endif %} - \ No newline at end of file + diff --git a/onboarding/templates/cbv/onboarding_candidates/date_of_joining.html b/onboarding/templates/cbv/onboarding_candidates/date_of_joining.html index 9ef03fecb..85287f559 100644 --- a/onboarding/templates/cbv/onboarding_candidates/date_of_joining.html +++ b/onboarding/templates/cbv/onboarding_candidates/date_of_joining.html @@ -3,4 +3,3 @@ - diff --git a/onboarding/templates/cbv/onboarding_candidates/filter.html b/onboarding/templates/cbv/onboarding_candidates/filter.html index 22fed4765..01449f7de 100644 --- a/onboarding/templates/cbv/onboarding_candidates/filter.html +++ b/onboarding/templates/cbv/onboarding_candidates/filter.html @@ -67,4 +67,4 @@
- \ No newline at end of file + diff --git a/onboarding/templates/cbv/onboarding_candidates/offer_letter.html b/onboarding/templates/cbv/onboarding_candidates/offer_letter.html index 90a101ad2..0f1faf243 100644 --- a/onboarding/templates/cbv/onboarding_candidates/offer_letter.html +++ b/onboarding/templates/cbv/onboarding_candidates/offer_letter.html @@ -4,4 +4,4 @@ {% endfor %} - \ No newline at end of file + diff --git a/onboarding/templates/cbv/onboarding_candidates/onboarding_candidates.html b/onboarding/templates/cbv/onboarding_candidates/onboarding_candidates.html index fd66d191b..cbbd12714 100644 --- a/onboarding/templates/cbv/onboarding_candidates/onboarding_candidates.html +++ b/onboarding/templates/cbv/onboarding_candidates/onboarding_candidates.html @@ -34,7 +34,7 @@
-
+ @@ -51,10 +51,10 @@ style="display: none"> - -
@@ -72,7 +72,7 @@
- +
@@ -94,7 +94,7 @@
- +
- \ No newline at end of file + diff --git a/onboarding/templates/cbv/onboarding_view/detail_view.html b/onboarding/templates/cbv/onboarding_view/detail_view.html index 4b47766c6..2171aadef 100644 --- a/onboarding/templates/cbv/onboarding_view/detail_view.html +++ b/onboarding/templates/cbv/onboarding_view/detail_view.html @@ -1,6 +1,6 @@
+ >New {% include "generic/horilla_detailed_view.html" %}
diff --git a/onboarding/templates/cbv/onboarding_view/status.html b/onboarding/templates/cbv/onboarding_view/status.html index e2421d003..823d55902 100644 --- a/onboarding/templates/cbv/onboarding_view/status.html +++ b/onboarding/templates/cbv/onboarding_view/status.html @@ -21,4 +21,4 @@ {% endif %} {% endfor %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/onboarding/templates/cbv/onboarding_view/task.html b/onboarding/templates/cbv/onboarding_view/task.html index efcf59e7d..e8a130738 100644 --- a/onboarding/templates/cbv/onboarding_view/task.html +++ b/onboarding/templates/cbv/onboarding_view/task.html @@ -16,4 +16,4 @@
{% endfor %} -
\ No newline at end of file +
diff --git a/onboarding/templates/cbv/pipeline/onboarding/pipeline.html b/onboarding/templates/cbv/pipeline/onboarding/pipeline.html index 960a333cb..5be27d984 100644 --- a/onboarding/templates/cbv/pipeline/onboarding/pipeline.html +++ b/onboarding/templates/cbv/pipeline/onboarding/pipeline.html @@ -36,18 +36,18 @@ visibility: visible; opacity: 1; - - + + } {% include "generic/components.html" %}
-
@@ -91,4 +91,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/onboarding/templates/cbv/pipeline/onboarding/stage_drop_down.html b/onboarding/templates/cbv/pipeline/onboarding/stage_drop_down.html index a76d6bc9c..1dfce31e1 100644 --- a/onboarding/templates/cbv/pipeline/onboarding/stage_drop_down.html +++ b/onboarding/templates/cbv/pipeline/onboarding/stage_drop_down.html @@ -14,4 +14,4 @@ {% else %} {{instance.onboarding_stage_id}} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/onboarding/templates/onboarding/empty_task.html b/onboarding/templates/onboarding/empty_task.html index 2a6a4ebc1..ac3357ed6 100644 --- a/onboarding/templates/onboarding/empty_task.html +++ b/onboarding/templates/onboarding/empty_task.html @@ -5,4 +5,4 @@ {% trans "No Tasks found." %}

- \ No newline at end of file + diff --git a/payroll/cbv/accessibility.py b/payroll/cbv/accessibility.py index 3ea9c7a59..b8818086a 100644 --- a/payroll/cbv/accessibility.py +++ b/payroll/cbv/accessibility.py @@ -1,26 +1,43 @@ -from base.methods import check_manager -from employee.models import Employee from django.contrib.auth.context_processors import PermWrapper -def payroll_accessibility(request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs) -> bool: +from base.methods import check_manager +from employee.models import Employee + + +def payroll_accessibility( + request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs +) -> bool: """ accessibility for payroll tab """ employee = Employee.objects.get(id=instance.pk) - if request.user.has_perm("payroll.view_payslip") or request.user == employee.employee_user_id: + if ( + request.user.has_perm("payroll.view_payslip") + or request.user == employee.employee_user_id + ): return True return False -def bonus_accessibility(request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs) -> bool: + +def bonus_accessibility( + request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs +) -> bool: """ accessibility for bonus tab """ employee = Employee.objects.get(id=instance.pk) - if request.user.has_perm("employee.view_bonuspoint") or check_manager(request.user.employee_get, instance)or request.user == employee.employee_user_id: + if ( + request.user.has_perm("employee.view_bonuspoint") + or check_manager(request.user.employee_get, instance) + or request.user == employee.employee_user_id + ): return True return False -def allowance_and_deduction_accessibility(request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs) -> bool: + +def allowance_and_deduction_accessibility( + request, instance: object = None, user_perms: PermWrapper = [], *args, **kwargs +) -> bool: """ accessibility for allowance and deduction tab """ diff --git a/payroll/cbv/allowance_deduction.py b/payroll/cbv/allowance_deduction.py index 50343d65c..13c916271 100644 --- a/payroll/cbv/allowance_deduction.py +++ b/payroll/cbv/allowance_deduction.py @@ -4,23 +4,24 @@ This page is handling the cbv methods of allowance and deduction in employee pro import operator from typing import Any + from django.apps import apps -from django.utils.translation import gettext_lazy as _ from django.urls import reverse +from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from employee.models import Employee from employee.views import return_none from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, - HorillaTabView, HorillaListView, + HorillaTabView, ) -from payroll.cbv.deduction import DeductionListView from payroll.cbv.allowances import AllowanceListView +from payroll.cbv.deduction import DeductionListView from payroll.methods.payslip_calc import dynamic_attr from payroll.models.models import Allowance, Deduction -from horilla_views.cbv_methods import login_required -from django.utils.decorators import method_decorator operator_mapping = { "equal": operator.eq, @@ -38,7 +39,6 @@ class AllowanceDeductionTabView(HorillaTabView): """ generic tab view for allowance and deduction """ - def get_context_data(self, **kwargs): """ @@ -83,23 +83,27 @@ class AllowanceTabList(AllowanceListView): super().__init__(**kwargs) self.view_id = "allowance_tab_id" pk = self.request.resolver_match.kwargs.get("pk") - self.search_url = reverse("allowance-tab-list", kwargs={'pk':pk}) + self.search_url = reverse("allowance-tab-list", kwargs={"pk": pk}) columns = [ - col for col in AllowanceListView.columns - if col[1] not in ("get_specific_employees", "get_exclude_employees", "condition_based_display", "rate") + col + for col in AllowanceListView.columns + if col[1] + not in ( + "get_specific_employees", + "get_exclude_employees", + "condition_based_display", + "rate", + ) ] # row_status_class = None row_status_indications = None - @method_decorator(login_required, name="dispatch") def dispatch(self, *args, **kwargs): return super(AllowanceListView, self).dispatch(*args, **kwargs) - - def get_context_data(self, **kwargs: Any): """ Adds active contract details and basic pay for a specified employee @@ -124,7 +128,7 @@ class AllowanceTabList(AllowanceListView): def get_queryset(self): """ - Returns a filtered queryset of allowance based on + Returns a filtered queryset of allowance based on the employee's active contract and specific conditions """ @@ -186,27 +190,30 @@ class AllowanceTabList(AllowanceListView): class DeductionTab(DeductionListView): """ - list view for deduction tab + list view for deduction tab """ - @method_decorator(login_required, name="dispatch") + @method_decorator(login_required, name="dispatch") def dispatch(self, *args, **kwargs): return super(DeductionListView, self).dispatch(*args, **kwargs) def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.view_id = "deduct-div" - pk = self.request.resolver_match.kwargs.get('pk') - self.search_url = reverse("deduction-tab-list",kwargs= {'pk': pk} ) + pk = self.request.resolver_match.kwargs.get("pk") + self.search_url = reverse("deduction-tab-list", kwargs={"pk": pk}) self.row_status_indications = None - - - - columns = [ - col for col in DeductionListView.columns - if col[1] not in ("specific_employees_col","excluded_employees_col","condition_bsed_col","rate") + col + for col in DeductionListView.columns + if col[1] + not in ( + "specific_employees_col", + "excluded_employees_col", + "condition_bsed_col", + "rate", + ) ] # action_method = "deduct_detail_actions" @@ -235,10 +242,9 @@ class DeductionTab(DeductionListView): # ) return context - def get_queryset(self): """ - Returns a filtered queryset of deductions based on + Returns a filtered queryset of deductions based on the employee's active contract and specific conditions """ @@ -342,5 +348,5 @@ class AllowanceDetailView(HorillaDetailedView): (_("Has Maximum Limit"), "cust_allowance_max_limit"), (_("Allowance Eligibility"), "allowance_eligibility"), ] - + action_method = "allowance_detail_actions" diff --git a/payroll/cbv/allowances.py b/payroll/cbv/allowances.py index 8d9ca014a..758f56d55 100644 --- a/payroll/cbv/allowances.py +++ b/payroll/cbv/allowances.py @@ -3,9 +3,11 @@ this page handles cbv of allowances page """ from typing import Any + from django.urls import reverse, reverse_lazy -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaCardView, @@ -18,11 +20,8 @@ from payroll.filters import AllowanceFilter from payroll.models.models import Allowance - @method_decorator(login_required, name="dispatch") -@method_decorator( - permission_required(perm="payroll.view_allowance"), name="dispatch" -) +@method_decorator(permission_required(perm="payroll.view_allowance"), name="dispatch") class AllowanceViewPage(TemplateView): """ for interview page @@ -31,11 +30,8 @@ class AllowanceViewPage(TemplateView): template_name = "cbv/allowances/allowances_home.html" - @method_decorator(login_required, name="dispatch") -@method_decorator( - permission_required(perm="payroll.view_allowance"), name="dispatch" -) +@method_decorator(permission_required(perm="payroll.view_allowance"), name="dispatch") class AllowanceListView(HorillaListView): """ list view of the page @@ -48,8 +44,7 @@ class AllowanceListView(HorillaListView): "is_fixed", "amount", "based_on", - "rate" - + "rate", ] model = Allowance @@ -72,11 +67,11 @@ class AllowanceListView(HorillaListView): (_("Excluded Employees"), "get_exclude_employees"), (_("Is Taxable"), "get_is_taxable_display"), (_("Is Condition Based"), "get_is_condition_based"), - (_("Condition"),"condition_based_display"), + (_("Condition"), "condition_based_display"), (_("Is Fixed"), "get_is_fixed"), (_("Amount"), "amount"), (_("Based On"), "get_based_on_display"), - (_("Rate"),"rate") + (_("Rate"), "rate"), ] sortby_mapping = [ @@ -84,20 +79,18 @@ class AllowanceListView(HorillaListView): ("Specific Employees", "get_specific_employees"), ("Excluded Employees", "get_exclude_employees"), ("Amount", "amount"), - ] header_attrs = { "title": """ style="width:200px !important;" """, - "get_specific_employees": """ style="width:200px !important;" - """, + """, "get_exclude_employees": """ style="width:200px !important;" - """, + """, } row_attrs = """ @@ -106,7 +99,7 @@ class AllowanceListView(HorillaListView): data-target="#genericModal" data-toggle="oh-modal-toggle" """ - + row_status_class = "taxable-{is_taxable} fixed-{is_fixed}" row_status_indications = [ @@ -131,7 +124,7 @@ class AllowanceListView(HorillaListView): " """, ), - ( + ( "fixed--dot", _("Fixed"), """ @@ -141,7 +134,7 @@ class AllowanceListView(HorillaListView): " """, ), - ( + ( "not-fixed--dot", _("Not Fixed"), """ @@ -152,9 +145,9 @@ class AllowanceListView(HorillaListView): """, ), ] - + def get_context_data(self, **kwargs: Any): - context = super().get_context_data(**kwargs) + context = super().get_context_data(**kwargs) self.request.allowance_div = "allowance_div" return context @@ -164,18 +157,13 @@ class AllowanceListView(HorillaListView): """ queryset = super().get_queryset() - queryset = queryset.exclude( - only_show_under_employee=True - ) + queryset = queryset.exclude(only_show_under_employee=True) return queryset - - + @method_decorator(login_required, name="dispatch") -@method_decorator( - permission_required(perm="payroll.view_allowance"), name="dispatch" -) +@method_decorator(permission_required(perm="payroll.view_allowance"), name="dispatch") class AllowanceNavView(HorillaNavView): """ nav bar of the page @@ -188,27 +176,25 @@ class AllowanceNavView(HorillaNavView): self.create_attrs = f""" href="{reverse_lazy('create-allowance')}" """ - + self.view_types = [ - { - "type": "list", - "icon": "list-outline", - "url": reverse("allowances-list-view"), - "attrs" : """ + { + "type": "list", + "icon": "list-outline", + "url": reverse("allowances-list-view"), + "attrs": """ title='List' - """ - }, - { - "type": "card", - "icon": "grid-outline", - "url": reverse("allowances-card-view"), - "attrs" : """ + """, + }, + { + "type": "card", + "icon": "grid-outline", + "url": reverse("allowances-card-view"), + "attrs": """ title='Card' - """ - }, - ] - - + """, + }, + ] nav_title = _("Allowances") filter_instance = AllowanceFilter() @@ -218,9 +204,7 @@ class AllowanceNavView(HorillaNavView): @method_decorator(login_required, name="dispatch") -@method_decorator( - permission_required(perm="payroll.view_allowance"), name="dispatch" -) +@method_decorator(permission_required(perm="payroll.view_allowance"), name="dispatch") class AllowancesCardView(HorillaCardView): """ card view for the page @@ -240,26 +224,23 @@ class AllowancesCardView(HorillaCardView): """ queryset = super().get_queryset() - queryset = queryset.exclude( - only_show_under_employee=True - ) + queryset = queryset.exclude(only_show_under_employee=True) return queryset - + details = { "image_src": "get_avatar", "title": "{title}", "subtitle": "Amount : {based_on_amount}
One Time Allowance : {one_time_date_display}
Taxable : {get_is_taxable_display}", } - card_attrs = """ hx-get='{allowance_detail_view}?instance_ids={ordered_ids}' hx-target="#genericModalBody" data-target="#genericModal" data-toggle="oh-modal-toggle" """ - + card_status_class = "taxable-{is_taxable} fixed-{is_fixed}" card_status_indications = [ @@ -284,7 +265,7 @@ class AllowancesCardView(HorillaCardView): " """, ), - ( + ( "fixed--dot", _("Fixed"), """ @@ -294,7 +275,7 @@ class AllowancesCardView(HorillaCardView): " """, ), - ( + ( "not-fixed--dot", _("Not Fixed"), """ @@ -327,14 +308,8 @@ class AllowancesCardView(HorillaCardView): ] - - - - @method_decorator(login_required, name="dispatch") -@method_decorator( - permission_required(perm="payroll.view_allowance"), name="dispatch" -) +@method_decorator(permission_required(perm="payroll.view_allowance"), name="dispatch") class AllowanceDetailView(HorillaDetailedView): """ detail view for allowances @@ -359,6 +334,3 @@ class AllowanceDetailView(HorillaDetailedView): ] action_method = "allowance_detail_actions" - - - diff --git a/payroll/cbv/asset_fine.py b/payroll/cbv/asset_fine.py index 255626f5f..3a1ee04fb 100644 --- a/payroll/cbv/asset_fine.py +++ b/payroll/cbv/asset_fine.py @@ -1,33 +1,31 @@ - - -import datetime +import datetime from typing import Any -from django.apps import apps + from django import forms +from django.apps import apps from django.contrib import messages from django.http import HttpResponse +from django.utils.translation import gettext_lazy as _ + from employee.models import Employee from horilla.methods import get_horilla_model_class from horilla_views.generic.cbv.views import HorillaFormView from payroll.forms.component_forms import AssetFineForm, LoanAccountForm from payroll.models.models import LoanAccount -from django.utils.translation import gettext_lazy as _ + class AssetFineFormView(HorillaFormView): """ form view for create asset assign form """ - model = LoanAccount form_class = AssetFineForm new_display_title = _("Asset Fine") - def form_valid(self, form: AssetFineForm) -> HttpResponse: if form.is_valid(): form.save() messages.success(self.request, "Asset fine added") return HttpResponse("") return super().form_valid(form) - diff --git a/payroll/cbv/contracts.py b/payroll/cbv/contracts.py index ab80c71ee..e7928e1a0 100644 --- a/payroll/cbv/contracts.py +++ b/payroll/cbv/contracts.py @@ -3,9 +3,11 @@ Contracts page """ from typing import Any + from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ + from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, @@ -41,8 +43,7 @@ class ContractsList(HorillaListView): "wage_type", "filing_status", "wage", - "contract_status" - + "contract_status", ] def __init__(self, **kwargs: Any) -> None: @@ -65,7 +66,7 @@ class ContractsList(HorillaListView): ] header_attrs = { - "contract_name" : """ + "contract_name": """ style="width:250px !important;" """ } @@ -76,7 +77,7 @@ class ContractsList(HorillaListView): ("Start Date", "contract_start_date"), ("End Date", "contract_end_date"), ("Basic Salary", "wage"), - ("Status", "status_col") + ("Status", "status_col"), ] action_method = "actions_col" @@ -89,7 +90,7 @@ class ContractsList(HorillaListView): onclick=" $('#applyFilter').closest('form').find('[name=contract_status]').val('terminated'); $('#applyFilter').click(); - + " """, ), @@ -100,7 +101,7 @@ class ContractsList(HorillaListView): onclick=" $('#applyFilter').closest('form').find('[name=contract_status]').val('expired'); $('#applyFilter').click(); - + " """, ), @@ -121,7 +122,7 @@ class ContractsList(HorillaListView): onclick=" $('#applyFilter').closest('form').find('[name=contract_status]').val('active'); $('#applyFilter').click(); - + " """, ), @@ -136,6 +137,7 @@ class ContractsList(HorillaListView): data-toggle="oh-modal-toggle" """ + @method_decorator(login_required, name="dispatch") @method_decorator(permission_required(perm="payroll.view_contract"), name="dispatch") class ContractsNav(HorillaNavView): @@ -147,7 +149,7 @@ class ContractsNav(HorillaNavView): super().__init__(**kwargs) self.search_url = reverse("contract-filter") self.create_attrs = f""" - href={reverse('contract-create')} + href={reverse('contract-create')} """ self.actions = [ { @@ -186,10 +188,14 @@ class ContractsNav(HorillaNavView): ("employee_id__employee_work_info__shift_id", _("Shift")), ("employee_id__employee_work_info__work_type_id", _("Work Type")), ("employee_id__employee_work_info__job_role_id", _("Job Role")), - ("employee_id__employee_work_info__reporting_manager_id", _("Reporting Manager")), + ( + "employee_id__employee_work_info__reporting_manager_id", + _("Reporting Manager"), + ), ("employee_id__employee_work_info__company_id", _("Company")), ] + @method_decorator(login_required, name="dispatch") @method_decorator(permission_required(perm="payroll.view_contract"), name="dispatch") class ContractsExportView(TemplateView): @@ -211,6 +217,7 @@ class ContractsExportView(TemplateView): context["export_filter"] = export_filter return context + @method_decorator(login_required, name="dispatch") @method_decorator(permission_required(perm="payroll.view_contract"), name="dispatch") class ContractsDetailView(HorillaDetailedView): diff --git a/payroll/cbv/dashboard.py b/payroll/cbv/dashboard.py index f3200f471..28e8d17ba 100644 --- a/payroll/cbv/dashboard.py +++ b/payroll/cbv/dashboard.py @@ -2,16 +2,17 @@ This page handles the cbv methods for payroll dashboard """ +import calendar from typing import Any + +from django.db.models import F, Sum, Value from django.urls import reverse from django.utils import timezone +from django.utils.translation import gettext_lazy as _ + from base.filters import DepartmentViewFilter from base.models import Department from horilla_views.generic.cbv.views import HorillaListView -from django.db.models import Sum, F, Value -import calendar -from django.utils.translation import gettext_lazy as _ - from payroll.filters import ContractFilter from payroll.models.models import Contract @@ -26,7 +27,6 @@ class DashboardDepartmentPayslip(HorillaListView): show_filter_tags = False bulk_select_option = False - def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.search_url = reverse("dashboard-department-chart") @@ -92,7 +92,7 @@ class DashboardContractList(HorillaListView): month = month_year.split("-")[1] input_month_year = (int(year), int(month)) current_month_year = (current_year, current_month) - + if input_month_year < current_month_year: month = current_month year = current_year @@ -103,11 +103,11 @@ class DashboardContractList(HorillaListView): columns = [ (_("Contract"), "contract_name"), - (_("Ending Date"), "contract_end_date"), + (_("Ending Date"), "contract_end_date"), ] header_attrs = { - "contract_name" : """ + "contract_name": """ style="width:200px !important;" """ } @@ -123,6 +123,7 @@ class DashboardContractListExpired(HorillaListView): """ list view for contract ending this month """ + def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.search_url = reverse("dashboard-contract-expired") @@ -145,10 +146,10 @@ class DashboardContractListExpired(HorillaListView): input_month_year = (int(year), int(month)) current_month_year = (current_year, current_month) if input_month_year >= current_month_year: - if current_month == 1: + if current_month == 1: month = 12 year = current_year - 1 - else: + else: month = current_month - 1 year = current_year queryset = queryset.filter( @@ -158,11 +159,11 @@ class DashboardContractListExpired(HorillaListView): columns = [ (_("Contract"), "contract_name"), - (_("Expired Date"), "contract_end_date"), + (_("Expired Date"), "contract_end_date"), ] header_attrs = { - "contract_name" : """ + "contract_name": """ style="width:200px !important;" """ } diff --git a/payroll/cbv/deduction.py b/payroll/cbv/deduction.py index ce1842c16..d38f1a82b 100644 --- a/payroll/cbv/deduction.py +++ b/payroll/cbv/deduction.py @@ -1,13 +1,18 @@ from typing import Any from django.urls import reverse +from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from horilla_views.generic.cbv.views import HorillaCardView, HorillaListView, HorillaNavView,TemplateView + +from horilla_views.cbv_methods import login_required, permission_required +from horilla_views.generic.cbv.views import ( + HorillaCardView, + HorillaListView, + HorillaNavView, + TemplateView, +) from payroll.filters import DeductionFilter from payroll.models.models import Deduction -from horilla_views.cbv_methods import login_required, permission_required -from django.utils.decorators import method_decorator - @method_decorator(login_required, name="dispatch") @@ -17,7 +22,6 @@ class DeductionView(TemplateView): template_name = "cbv/deduction/deduction.html" - @method_decorator(login_required, name="dispatch") @method_decorator(permission_required(perm="payroll.view_deduction"), name="dispatch") class DeductionNav(HorillaNavView): @@ -29,26 +33,26 @@ class DeductionNav(HorillaNavView): super().__init__(**kwargs) self.search_url = reverse("deduction-view-list") self.create_attrs = f""" - href={reverse('create-deduction')} + href={reverse('create-deduction')} """ self.view_types = [ - { - "type": "list", - "icon": "list-outline", - "url": reverse("deduction-view-list"), - "attrs" : """ + { + "type": "list", + "icon": "list-outline", + "url": reverse("deduction-view-list"), + "attrs": """ title='List' - """ - }, - { - "type": "card", - "icon": "grid-outline", - "url": reverse("deduction-view-card"), - "attrs" : """ + """, + }, + { + "type": "card", + "icon": "grid-outline", + "url": reverse("deduction-view-card"), + "attrs": """ title='Card' - """ - }, - ] + """, + }, + ] nav_title = _("Deductions") filter_body_template = "cbv/deduction/filter.html" @@ -57,7 +61,6 @@ class DeductionNav(HorillaNavView): search_swap_target = "#listContainer" - @method_decorator(login_required, name="dispatch") @method_decorator(permission_required(perm="payroll.view_deduction"), name="dispatch") class DeductionListView(HorillaListView): @@ -75,7 +78,7 @@ class DeductionListView(HorillaListView): "is_fixed", "amount", "based_on", - "rate" + "rate", ] def __init__(self, **kwargs: Any) -> None: @@ -89,7 +92,6 @@ class DeductionListView(HorillaListView): self.action_method = None self.search_url = reverse("deduction-view-list") - row_attrs = """ {diff_cell} hx-get='{deduction_detail_view}?instance_ids={ordered_ids}' @@ -97,7 +99,7 @@ class DeductionListView(HorillaListView): data-target="#genericModal" data-toggle="oh-modal-toggle" """ - + row_status_indications = [ ( "pretax--dot", @@ -118,7 +120,7 @@ class DeductionListView(HorillaListView): $('#applyFilter').closest('form').find('[name=is_fixed]').val('true'); $('[name=is_pretax]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -130,7 +132,7 @@ class DeductionListView(HorillaListView): $('#applyFilter').closest('form').find('[name=is_fixed]').val('false'); $('[name=is_pretax]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -140,39 +142,37 @@ class DeductionListView(HorillaListView): columns = [ (_("Deduction"), "title"), - (_("Specific Employees"),"specific_employees_col"), - (_("Excluded Employees"),"excluded_employees_col"), + (_("Specific Employees"), "specific_employees_col"), + (_("Excluded Employees"), "excluded_employees_col"), (_("Is Pretax"), "get_is_pretax_display"), (_("Is Condition Based"), "get_is_condition_based_display"), - (_("Condition"),"condition_bsed_col"), + (_("Condition"), "condition_bsed_col"), (_("Is Fixed"), "get_is_fixed_display"), (_("Amount"), "amount"), (_("Based On"), "get_based_on_display"), - (_("Rate"),"rate") + (_("Rate"), "rate"), ] header_attrs = { - "title" : """ + "title": """ style="width:180px !important; """, - "excluded_employees_col" : """ + "excluded_employees_col": """ style="width:180px !important; - """ + """, } sortby_mapping = [ ("Deduction", "title"), - ("Specific Employees","specific_employees_col"), - ("Excluded Employees","excluded_employees_col"), + ("Specific Employees", "specific_employees_col"), + ("Excluded Employees", "excluded_employees_col"), ("Amount", "amount"), - ] def get_queryset(self): queryset = super().get_queryset() # queryset = queryset.exclude(only_show_under_employee=True) return queryset.exclude(only_show_under_employee=True) - @method_decorator(login_required, name="dispatch") @@ -205,7 +205,6 @@ class DeductionCardView(HorillaCardView): "image_src": "get_avatar", "title": "{title}", "subtitle": "Amount :
{amount_col}
Is Pretax : {get_is_pretax_display}
One Time deduction : {get_one_time_deduction}", - } card_status_indications = [ @@ -228,7 +227,7 @@ class DeductionCardView(HorillaCardView): $('#applyFilter').closest('form').find('[name=is_fixed]').val('true'); $('[name=is_pretax]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), @@ -240,13 +239,12 @@ class DeductionCardView(HorillaCardView): $('#applyFilter').closest('form').find('[name=is_fixed]').val('false'); $('[name=is_pretax]').val('unknown').change(); $('#applyFilter').click(); - + " """, ), ] - card_attrs = """ hx-get='{deduction_detail_view}?instance_ids={ordered_ids}' data-toggle="oh-modal-toggle" @@ -254,7 +252,6 @@ class DeductionCardView(HorillaCardView): hx-target="#genericModalBody" """ - actions = [ { "action": _("Edit"), @@ -268,7 +265,7 @@ class DeductionCardView(HorillaCardView): "attrs": """ onclick="event.stopPropagation()" hx-get="{get_delete_url}?model=payroll.Deduction&pk={pk}" - data-toggle="oh-modal-toggle" + data-toggle="oh-modal-toggle" data-target="#deleteConfirmation" hx-target="#deleteConfirmationBody" class="oh-dropdown__link" @@ -279,4 +276,3 @@ class DeductionCardView(HorillaCardView): ] records_per_page = 10 - diff --git a/payroll/cbv/federal_tax.py b/payroll/cbv/federal_tax.py index cfe59dfd8..99c1956e3 100644 --- a/payroll/cbv/federal_tax.py +++ b/payroll/cbv/federal_tax.py @@ -4,23 +4,25 @@ This page handles the cbv methods for federal tax import math from typing import Any + from django import forms -from django.template.loader import render_to_string from django.contrib import messages from django.http import HttpResponse +from django.template.loader import render_to_string from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from horilla_views.generic.cbv.views import HorillaFormView -from horilla_views.cbv_methods import login_required, permission_required + from base.models import Holidays +from horilla_views.cbv_methods import login_required, permission_required +from horilla_views.generic.cbv.views import HorillaFormView from payroll.forms.tax_forms import FilingStatusForm, TaxBracketForm from payroll.models.models import FilingStatus from payroll.models.tax_models import TaxBracket @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("payroll.add_filingstatus"),name="dispatch") +@method_decorator(permission_required("payroll.add_filingstatus"), name="dispatch") class FederalTaxFormView(HorillaFormView): """ form view for create button @@ -49,10 +51,10 @@ class FederalTaxFormView(HorillaFormView): messages.success(self.request, _(message)) return self.HttpResponse("") return super().form_valid(form) - + @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("payroll.add_taxbracket"),name="dispatch") +@method_decorator(permission_required("payroll.add_taxbracket"), name="dispatch") class TaxBracketCreateForm(HorillaFormView): """ from view for create and edit tax brackets @@ -63,7 +65,7 @@ class TaxBracketCreateForm(HorillaFormView): new_display_title = _("Create Tax Bracket") def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) + context = super().get_context_data(**kwargs) if self.form.instance.pk: tax_bracket = TaxBracket.find(self.form.instance.pk) filing_status_id = tax_bracket.filing_status_id.id @@ -72,13 +74,10 @@ class TaxBracketCreateForm(HorillaFormView): filing_status_id = self.kwargs.get("filing_status_id") filling = FilingStatus.objects.get(id=filing_status_id) self.form.fields["filing_status_id"].initial = filling - context['is_create'] = True + context["is_create"] = True - context["form"] = self.form return context - - def form_valid(self, form: TaxBracketForm) -> HttpResponse: if form.is_valid(): @@ -87,16 +86,20 @@ class TaxBracketCreateForm(HorillaFormView): messages.info(self.request, _("The maximum income will be infinite")) self.form.instance.max_income = math.inf if form.instance.pk: - messages.success(self.request,_("The tax bracket has been updated successfully.")) + messages.success( + self.request, _("The tax bracket has been updated successfully.") + ) else: - messages.success(self.request,_("The tax bracket was created successfully.")) + messages.success( + self.request, _("The tax bracket was created successfully.") + ) filing_status_id = self.form.cleaned_data.get("filing_status_id") - context = {"filing_status_id":filing_status_id.id,"form_instance":form.instance.pk} + context = { + "filing_status_id": filing_status_id.id, + "form_instance": form.instance.pk, + } template = "cbv/federal_tax/tax_bracket.html" - html = render_to_string(template,context) + html = render_to_string(template, context) form.save() return HttpResponse(html) return super().form_valid(form) - - - diff --git a/payroll/cbv/loan_advance_salary.py b/payroll/cbv/loan_advance_salary.py index f792cde75..90c5cc17e 100644 --- a/payroll/cbv/loan_advance_salary.py +++ b/payroll/cbv/loan_advance_salary.py @@ -2,22 +2,23 @@ this page is handling the cbv methods of loan/advanced salary page """ - from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse, reverse_lazy -from django.contrib import messages -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + +from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, + HorillaFormView, HorillaListView, HorillaNavView, HorillaTabView, TemplateView, - HorillaFormView, ) -from horilla_views.cbv_methods import login_required, permission_required from payroll.filters import LoanAccountFilter from payroll.forms.component_forms import LoanAccountForm from payroll.models.models import LoanAccount @@ -93,7 +94,7 @@ class LoanListView(HorillaListView): (_("Toatal Installments"), "installments"), (_("Amount"), "loan_amount"), (_("Description"), "description"), - (_("Progress Bar"),"progress_bar_col") + (_("Progress Bar"), "progress_bar_col"), ] sortby_mapping = [ @@ -166,7 +167,6 @@ class LoanNavView(HorillaNavView): data-toggle="oh-modal-toggle" """ - nav_title = _("Loan / Advanced Salary") filter_body_template = "cbv/loan/loan_filter.html" filter_instance = LoanAccountFilter() @@ -196,7 +196,6 @@ class LoanDetailView(HorillaDetailedView): context["ded_id"] = ded_id context["installments"] = installments return context - @method_decorator(login_required, name="dispatch") @@ -223,4 +222,3 @@ class LoanFormView(HorillaFormView): "" ) return super().form_valid(form) - diff --git a/payroll/cbv/payslip.py b/payroll/cbv/payslip.py index ce0464135..aef554973 100644 --- a/payroll/cbv/payslip.py +++ b/payroll/cbv/payslip.py @@ -4,31 +4,32 @@ this page handles cbv methods of payslip page import json from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse -from django.contrib import messages -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator -from employee.cbv.employee_profile import EmployeeProfileView +from django.utils.translation import gettext_lazy as _ + from employee import views as employee_view +from employee.cbv.employee_profile import EmployeeProfileView from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( + HorillaFormView, HorillaListView, HorillaNavView, TemplateView, - HorillaFormView, ) from notifications.signals import notify from payroll.cbv.allowance_deduction import AllowanceDeductionTabView -from payroll.forms import component_forms as forms from payroll.filters import PayslipFilter +from payroll.forms import component_forms as forms from payroll.methods.methods import calculate_employer_contribution, save_payslip from payroll.models.models import Contract, Payslip from payroll.views.component_views import payroll_calculation - @method_decorator(login_required, name="dispatch") class PayslipView(TemplateView): """ @@ -57,13 +58,14 @@ class PayslipList(HorillaListView): """ list view """ + selected_instances_key_id = "selectedInstances" bulk_update_fields = [ "status", "start_date", "end_date", - ] + def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.search_url = reverse("payslip-list") @@ -98,7 +100,7 @@ class PayslipList(HorillaListView): ("Gross Pay", "gross_pay_display"), ("Deduction", "deduction_display"), ("Net Pay", "net_pay_display"), - ("Status", "custom_status_col") + ("Status", "custom_status_col"), ] records_per_page = 5 action_method = "custom_actions_col" @@ -159,11 +161,11 @@ class PayslipList(HorillaListView): ] row_attrs = """ - + onclick=" event.stopPropagation(); window.location.href='{get_individual_payslip}'" - + """ row_status_class = "status-{status} sent_to_employee-{sent_to_employee}" @@ -212,7 +214,6 @@ class PayslipNav(HorillaNavView): style="cursor: pointer;" """, }, - { "action": _("Export"), "attrs": f""" @@ -257,6 +258,7 @@ class PayslipNav(HorillaNavView): ("employee_id__employee_work_info__company_id", _("Company")), ] + @method_decorator(login_required, name="dispatch") class PayslipBulkExport(TemplateView): """ @@ -294,7 +296,6 @@ class PayrollCreateFormView(HorillaFormView): new_display_title = _("Create Payslip") template_name = "cbv/payslip/payslip_inherit_form.html" - def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["view_id"] = "payslipCreate" @@ -381,11 +382,11 @@ class PayrollTab(PayslipList): pk = self.kwargs.get("pk") queryset = queryset.filter(employee_id=pk) return queryset - + def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) pk = self.request.resolver_match.kwargs.get("pk") - self.search_url = reverse("individual-payslip-tab-list",kwargs={'pk':pk}) + self.search_url = reverse("individual-payslip-tab-list", kwargs={"pk": pk}) columns = [col for col in PayslipList.columns if col[0] != _("Status")] columns.append((_("Status"), "get_status")) diff --git a/payroll/cbv/payslip_automation.py b/payroll/cbv/payslip_automation.py index 32049d2b6..9a508f7fe 100644 --- a/payroll/cbv/payslip_automation.py +++ b/payroll/cbv/payslip_automation.py @@ -3,13 +3,15 @@ This page is handle the payslip automation page in settings. """ from typing import Any + +from django.contrib import messages from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404 -from django.utils.translation import gettext_lazy as _ -from django.utils.decorators import method_decorator from django.urls import reverse -from django.contrib import messages +from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ from django.views import View + from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaFormView, @@ -47,10 +49,9 @@ class PaySlipAutomationListView(HorillaListView): ] header_attrs = { - "get_generate_day_display" : """ + "get_generate_day_display": """ style = "width:200px !important" """, - } actions = [ @@ -85,6 +86,7 @@ class PaySlipAutomationListView(HorillaListView): # onclick = "deleteItem({get_delete_url})" + @method_decorator(login_required, name="dispatch") @method_decorator( permission_required(perm="payroll.view_PayslipAutoGenerate"), name="dispatch" diff --git a/payroll/cbv/reimbursements.py b/payroll/cbv/reimbursements.py index de48c4b03..7a3e80b38 100644 --- a/payroll/cbv/reimbursements.py +++ b/payroll/cbv/reimbursements.py @@ -1,10 +1,13 @@ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from base.methods import filter_own_records from horilla_views.cbv_methods import login_required -from django.utils.translation import gettext_lazy as _ from horilla_views.generic.cbv.views import ( HorillaDetailedView, HorillaFormView, @@ -16,8 +19,6 @@ from horilla_views.generic.cbv.views import ( from payroll.filters import ReimbursementFilter from payroll.forms.component_forms import ReimbursementForm from payroll.models.models import Reimbursement -from django.contrib import messages - @method_decorator(login_required, name="dispatch") @@ -53,6 +54,7 @@ class ReimbursementsAndEncashmentsTabView(HorillaTabView): }, ] + @method_decorator(login_required, name="dispatch") class ReimbursementsAndEncashmentsListView(HorillaListView): """ @@ -116,14 +118,15 @@ class ReimbursementsAndEncashmentsListView(HorillaListView): ] header_attrs = { - "description" : """ + "description": """ style="width:250px !important;" """, - "action" : """ + "action": """ style="width:200px !important;" - """ + """, } + @method_decorator(login_required, name="dispatch") class ReimbursementsListView(ReimbursementsAndEncashmentsListView): @@ -131,7 +134,7 @@ class ReimbursementsListView(ReimbursementsAndEncashmentsListView): ("Employee", "employee_id__get_full_name", "employee_id__get_avatar"), ("Date", "created_at"), ("Amount", "amount"), - ("Status", "get_status_display") + ("Status", "get_status_display"), ] row_attrs = """ @@ -153,6 +156,7 @@ class ReimbursementsListView(ReimbursementsAndEncashmentsListView): ) return queryset + @method_decorator(login_required, name="dispatch") class LeaveEncashmentsListView(ReimbursementsAndEncashmentsListView): @@ -194,6 +198,7 @@ class LeaveEncashmentsListView(ReimbursementsAndEncashmentsListView): ) return queryset + @method_decorator(login_required, name="dispatch") class BonusEncashmentsListView(ReimbursementsAndEncashmentsListView): @@ -281,6 +286,7 @@ class ReimbursementsDetailView(HorillaDetailedView): "avatar": "employee_id__get_avatar", } + @method_decorator(login_required, name="dispatch") class LeaveEncashmentsDetailedView(ReimbursementsDetailView): @@ -292,6 +298,7 @@ class LeaveEncashmentsDetailedView(ReimbursementsDetailView): body.insert(position + 1, (_("Available days to encash"), "ad_to_encash")) body.insert(position + 2, (_("Carryforward to encash"), "cfd_to_encash")) + @method_decorator(login_required, name="dispatch") class BonusEncashmentsDetailedView(ReimbursementsDetailView): @@ -310,7 +317,7 @@ class ReimbursementsFormView(HorillaFormView): model = Reimbursement form_class = ReimbursementForm new_display_title = _("Create Reimbursement / Encashment") - template_name = "cbv/reimbursements/forms.html" + template_name = "cbv/reimbursements/forms.html" def get_context_data(self, **kwargs): """ diff --git a/payroll/static/cbv/actions.js b/payroll/static/cbv/actions.js index f1e342e22..7b58e045f 100644 --- a/payroll/static/cbv/actions.js +++ b/payroll/static/cbv/actions.js @@ -5,7 +5,7 @@ var excelMessages = { en: "Do you want to download the excel file?", fr: "Voulez-vous télécharger le fichier Excel?", }; - + var deletePayslipMessages = { ar: "هل تريد حقًا حذف جميع كشوف الدفع المحددة؟", de: "Sind Sie sicher, dass Sie alle ausgewählten Gehaltsabrechnungen löschen möchten?", @@ -13,7 +13,7 @@ var excelMessages = { en: "Do you really want to delete all the selected payslips?", fr: "Voulez-vous vraiment supprimer tous les bulletins de paie sélectionnés?", }; - + var deleteContractMessage = { ar: "هل ترغب حقًا في حذف جميع العقود المحددة؟", de: "Möchten Sie wirklich alle ausgewählten Verträge löschen?", @@ -21,7 +21,7 @@ var excelMessages = { en: "Do you really want to delete all the selected contracts?", fr: "Voulez-vous vraiment supprimer tous les contrats sélectionnés?", }; - + var noRowMessage = { ar: "لم يتم تحديد أي صفوف.", de: "Es wurden keine Zeilen ausgewählt.", @@ -29,7 +29,7 @@ var excelMessages = { en: "No rows have been selected.", fr: "Aucune ligne n'a été sélectionnée.", }; - + var rowMessages = { ar: " تم الاختيار", de: " Ausgewählt", @@ -53,8 +53,8 @@ var excelMessages = { } return cookieValue; } - - + + function getCurrentLanguageCode(callback) { var languageCode = $("#main-section-data").attr("data-lang"); var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"]; @@ -79,11 +79,11 @@ var excelMessages = { }); } } - - + + function DeleteContractBulk() { - - + + var languageCode = null; getCurrentLanguageCode(function (code) { languageCode = code; @@ -111,7 +111,7 @@ function DeleteContractBulk() { ids = []; ids.push($("#selectedInstances").attr("data-ids")); ids = JSON.parse($("#selectedInstances").attr("data-ids")); - + $.ajax({ type: "POST", url: "/payroll/contract-bulk-delete", @@ -132,4 +132,3 @@ function DeleteContractBulk() { } }); }; - \ No newline at end of file diff --git a/payroll/static/cbv/payslip.js b/payroll/static/cbv/payslip.js index 11bd4e1d3..c78e89780 100644 --- a/payroll/static/cbv/payslip.js +++ b/payroll/static/cbv/payslip.js @@ -5,7 +5,7 @@ var excelMessages = { en: "Do you want to download the excel file?", fr: "Voulez-vous télécharger le fichier Excel?", }; - + var deletePayslipMessages = { ar: "هل تريد حقًا حذف جميع كشوف الدفع المحددة؟", de: "Sind Sie sicher, dass Sie alle ausgewählten Gehaltsabrechnungen löschen möchten?", @@ -13,7 +13,7 @@ var excelMessages = { en: "Do you really want to delete all the selected payslips?", fr: "Voulez-vous vraiment supprimer tous les bulletins de paie sélectionnés?", }; - + var deleteContractMessages = { ar: "هل ترغب حقًا في حذف جميع العقود المحددة؟", de: "Möchten Sie wirklich alle ausgewählten Verträge löschen?", @@ -21,7 +21,7 @@ var excelMessages = { en: "Do you really want to delete all the selected contracts?", fr: "Voulez-vous vraiment supprimer tous les contrats sélectionnés?", }; - + var noRowMessagesMail = { ar: "لم يتم تحديد أي صفوف.", de: "Es wurden keine Zeilen ausgewählt.", @@ -36,7 +36,7 @@ var excelMessages = { en: "Do you want to send the payslip by mail?", fr: "Voulez-vous envoyer le bulletin de salaire par e-mail?", }; - + var rowMessages = { ar: " تم الاختيار", de: " Ausgewählt", @@ -44,17 +44,17 @@ var excelMessages = { en: " Selected", fr: " Sélectionné", }; - - + + function makeEmpListUnique(list) { return Array.from(new Set(list)); } - + function makePayslipListUnique(list) { return Array.from(new Set(list)); } - + function getCookie(name) { let cookieValue = null; if (document.cookie && document.cookie !== "") { @@ -70,7 +70,7 @@ var excelMessages = { } return cookieValue; } - + function getCurrentLanguageCode(callback) { var languageCode = $("#main-section-data").attr("data-lang"); var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"]; @@ -122,10 +122,10 @@ var excelMessages = { confirmButtonText: "Confirm", }).then(function (result) { if (result.isConfirmed) { - + // ids.push($("#selectedInstances").attr("data-ids")); //ids = JSON.parse($("#selectedInstances").attr("data-ids")); - + $.ajax({ type: "GET", @@ -137,7 +137,7 @@ var excelMessages = { location.reload(); } }, - + }); } }); diff --git a/payroll/templates/cbv/allowance_deduction/allowance/custom_amount.html b/payroll/templates/cbv/allowance_deduction/allowance/custom_amount.html index ed86c776e..82adab3a9 100644 --- a/payroll/templates/cbv/allowance_deduction/allowance/custom_amount.html +++ b/payroll/templates/cbv/allowance_deduction/allowance/custom_amount.html @@ -17,4 +17,4 @@ {% if instance.based_on == "overtime" %} {{instance.amount_per_one_hr}} {{currency}} {% trans "Amount Per One Hour" %} {% endif %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/payroll/templates/cbv/allowance_deduction/allowance/detail_view_actions.html b/payroll/templates/cbv/allowance_deduction/allowance/detail_view_actions.html index adf117e37..7b7f20bbe 100644 --- a/payroll/templates/cbv/allowance_deduction/allowance/detail_view_actions.html +++ b/payroll/templates/cbv/allowance_deduction/allowance/detail_view_actions.html @@ -40,4 +40,4 @@ $(".reload-record").click() $("#reloadMessagesButton").click() -{% endif %} \ No newline at end of file +{% endif %} diff --git a/payroll/templates/cbv/allowance_deduction/allowance/max_limit_col.html b/payroll/templates/cbv/allowance_deduction/allowance/max_limit_col.html index 707a04e97..a1c2e8938 100644 --- a/payroll/templates/cbv/allowance_deduction/allowance/max_limit_col.html +++ b/payroll/templates/cbv/allowance_deduction/allowance/max_limit_col.html @@ -3,4 +3,4 @@ {{instance.maximum_amount}} {{currency}} {% if instance.based_on == "basic_pay" %}{% trans "For working days on a month" %}{% endif %} {% else %} {% trans "No" %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/payroll/templates/cbv/allowance_deduction/allowance_action.html b/payroll/templates/cbv/allowance_deduction/allowance_action.html index fa54721b6..c947014fe 100644 --- a/payroll/templates/cbv/allowance_deduction/allowance_action.html +++ b/payroll/templates/cbv/allowance_deduction/allowance_action.html @@ -9,8 +9,8 @@ $("#reloadMessagesButton").click() -{% endif %} \ No newline at end of file +{% endif %} diff --git a/payroll/templates/cbv/allowance_deduction/allowance_deduction.html b/payroll/templates/cbv/allowance_deduction/allowance_deduction.html index be5d702aa..d6efd9e05 100644 --- a/payroll/templates/cbv/allowance_deduction/allowance_deduction.html +++ b/payroll/templates/cbv/allowance_deduction/allowance_deduction.html @@ -23,7 +23,7 @@
{% trans "This employee doesn't have an active contract. Please check the employee's contract" %}
-{% comment %} +{% comment %}
{% trans "This employee doesn't have an active contract. Please check the employee's contract" %}
diff --git a/payroll/templates/cbv/allowance_deduction/deductions/amount.html b/payroll/templates/cbv/allowance_deduction/deductions/amount.html index 7c0c53a16..777b54982 100644 --- a/payroll/templates/cbv/allowance_deduction/deductions/amount.html +++ b/payroll/templates/cbv/allowance_deduction/deductions/amount.html @@ -12,4 +12,4 @@ {% trans "Employer Rate :" %} {{instance.employer_rate}}% {% trans "of" %} {{instance.get_based_on_display}}
{% trans "Employee Rate :" %} {{instance.rate}}% {% trans "of" %} {{instance.get_based_on_display}} {% endif %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/payroll/templates/cbv/allowance_deduction/deductions/deductions_actions.html b/payroll/templates/cbv/allowance_deduction/deductions/deductions_actions.html index 9fe04ddfb..c46a431a2 100644 --- a/payroll/templates/cbv/allowance_deduction/deductions/deductions_actions.html +++ b/payroll/templates/cbv/allowance_deduction/deductions/deductions_actions.html @@ -19,8 +19,8 @@
@@ -33,4 +33,4 @@
- {% endif %} \ No newline at end of file + {% endif %} diff --git a/payroll/templates/cbv/allowance_deduction/deductions/has_maximum_limit.html b/payroll/templates/cbv/allowance_deduction/deductions/has_maximum_limit.html index b9a7b1149..961709ecd 100644 --- a/payroll/templates/cbv/allowance_deduction/deductions/has_maximum_limit.html +++ b/payroll/templates/cbv/allowance_deduction/deductions/has_maximum_limit.html @@ -5,4 +5,4 @@ {{instance.maximum_amount}} {{currency}} {% trans "For working days on a month" %} {% else %} {% trans "No" %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/payroll/templates/cbv/allowances/allowance_filter.html b/payroll/templates/cbv/allowances/allowance_filter.html index 82ec57d22..88f368344 100644 --- a/payroll/templates/cbv/allowances/allowance_filter.html +++ b/payroll/templates/cbv/allowances/allowance_filter.html @@ -34,4 +34,4 @@ - \ No newline at end of file + diff --git a/payroll/templates/cbv/allowances/allowances_home.html b/payroll/templates/cbv/allowances/allowances_home.html index 6464f8886..eaa33980d 100644 --- a/payroll/templates/cbv/allowances/allowances_home.html +++ b/payroll/templates/cbv/allowances/allowances_home.html @@ -10,14 +10,14 @@ .non-taxable--dot{ background-color:gray; } - + .fixed--dot{ background-color:orange; - + } .not-fixed--dot{ background-color:yellowgreen; - + } .taxable-True { @@ -38,7 +38,7 @@ }
-
+ {% include "generic/components.html" %} @@ -46,11 +46,11 @@ -
-
+
+
-
-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/payroll/templates/cbv/contracts/actions.html b/payroll/templates/cbv/contracts/actions.html index 2ce3e9eb6..be137c57d 100644 --- a/payroll/templates/cbv/contracts/actions.html +++ b/payroll/templates/cbv/contracts/actions.html @@ -32,4 +32,4 @@ > - \ No newline at end of file + diff --git a/payroll/templates/cbv/contracts/cal_leave_amount.html b/payroll/templates/cbv/contracts/cal_leave_amount.html index 8d68d66fe..f2a0e667d 100644 --- a/payroll/templates/cbv/contracts/cal_leave_amount.html +++ b/payroll/templates/cbv/contracts/cal_leave_amount.html @@ -7,4 +7,4 @@ {% trans "Deduction Amount For One Leave" %} {{instance.deduction_for_one_leave_amount}} {% endif %} - \ No newline at end of file + diff --git a/payroll/templates/cbv/contracts/contracts.html b/payroll/templates/cbv/contracts/contracts.html index bc176cd34..ef1a3b739 100644 --- a/payroll/templates/cbv/contracts/contracts.html +++ b/payroll/templates/cbv/contracts/contracts.html @@ -60,7 +60,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -76,9 +76,9 @@ style="display: none" > - -
@@ -110,8 +110,8 @@ id="hxContractExportForm" > {% csrf_token %} - - + +
@@ -121,6 +121,6 @@ - - -{% endblock content %} \ No newline at end of file + + +{% endblock content %} diff --git a/payroll/templates/cbv/contracts/detail_action.html b/payroll/templates/cbv/contracts/detail_action.html index 274784389..4599051ae 100644 --- a/payroll/templates/cbv/contracts/detail_action.html +++ b/payroll/templates/cbv/contracts/detail_action.html @@ -1,7 +1,7 @@ {% load i18n %} {% if perms.payroll.delete_contract or perms.payroll.change_contract %} - - + + {% if perms.payroll.change_contract %} {% trans "Delete" %} {% endif %} - - - {% endif %} \ No newline at end of file + + + {% endif %} diff --git a/payroll/templates/cbv/contracts/document.html b/payroll/templates/cbv/contracts/document.html index 55b8eaa9b..2cb24922b 100644 --- a/payroll/templates/cbv/contracts/document.html +++ b/payroll/templates/cbv/contracts/document.html @@ -2,4 +2,4 @@ {% if instance.contract_document %} {% trans "Document" %} {{ instance.contract_document.name }} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/payroll/templates/cbv/contracts/export.html b/payroll/templates/cbv/contracts/export.html index e8fef9f09..a61fba73d 100644 --- a/payroll/templates/cbv/contracts/export.html +++ b/payroll/templates/cbv/contracts/export.html @@ -179,4 +179,4 @@ > {% trans "Export" %} - \ No newline at end of file + diff --git a/payroll/templates/cbv/contracts/note.html b/payroll/templates/cbv/contracts/note.html index cdaa9f743..a3e11cf82 100644 --- a/payroll/templates/cbv/contracts/note.html +++ b/payroll/templates/cbv/contracts/note.html @@ -6,4 +6,4 @@ {{instance.note}} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/payroll/templates/cbv/contracts/status.html b/payroll/templates/cbv/contracts/status.html index 7fad5c8ed..316e3284e 100644 --- a/payroll/templates/cbv/contracts/status.html +++ b/payroll/templates/cbv/contracts/status.html @@ -4,4 +4,4 @@ {% endfor %} - \ No newline at end of file + diff --git a/payroll/templates/cbv/dashboard/contract_ending.html b/payroll/templates/cbv/dashboard/contract_ending.html index d0be672c3..b9610878b 100644 --- a/payroll/templates/cbv/dashboard/contract_ending.html +++ b/payroll/templates/cbv/dashboard/contract_ending.html @@ -6,6 +6,6 @@ $(document).ready(function() { var count = {{ queryset.paginator.count }}; $('#contract-count').text(count); - + }); - \ No newline at end of file + diff --git a/payroll/templates/cbv/dashboard/contract_expired.html b/payroll/templates/cbv/dashboard/contract_expired.html index 943810a52..4758df84b 100644 --- a/payroll/templates/cbv/dashboard/contract_expired.html +++ b/payroll/templates/cbv/dashboard/contract_expired.html @@ -6,6 +6,6 @@ $(document).ready(function() { var count = {{ queryset.paginator.count }}; $('#contract-expired-count').text(count); - + }); - \ No newline at end of file + diff --git a/payroll/templates/cbv/deduction/deduction.html b/payroll/templates/cbv/deduction/deduction.html index 84b09d9bc..a8b8a3c90 100644 --- a/payroll/templates/cbv/deduction/deduction.html +++ b/payroll/templates/cbv/deduction/deduction.html @@ -16,26 +16,26 @@ {% comment %} .fixed-True{ border-left: 3.4px solid orange !important; border-radius: 4px 0 0 4px; - + } .fixed-False { - + border-left: 3.4px solid yellowgreen !important; border-radius: 4px 0 0 4px; - - + + } .pretax-True { - + border-left: 3.4px solid red !important; border-radius: 4px 0 0 4px; - + } {% endcomment %}
-
+ {% include "generic/components.html" %} @@ -43,9 +43,9 @@ -
-
+
-
-{% endblock %} \ No newline at end of file +
+{% endblock %} diff --git a/payroll/templates/cbv/deduction/filter.html b/payroll/templates/cbv/deduction/filter.html index a70a29373..e61dab79e 100644 --- a/payroll/templates/cbv/deduction/filter.html +++ b/payroll/templates/cbv/deduction/filter.html @@ -36,7 +36,7 @@ - + - + {% endblock content %} diff --git a/payroll/templates/cbv/payslip/payslip_actions.html b/payroll/templates/cbv/payslip/payslip_actions.html index 90aad7697..fddacbd9b 100644 --- a/payroll/templates/cbv/payslip/payslip_actions.html +++ b/payroll/templates/cbv/payslip/payslip_actions.html @@ -22,4 +22,3 @@ {% endif %} - diff --git a/payroll/templates/cbv/payslip/payslip_download_tab.html b/payroll/templates/cbv/payslip/payslip_download_tab.html index 20fbd292b..59e466e21 100644 --- a/payroll/templates/cbv/payslip/payslip_download_tab.html +++ b/payroll/templates/cbv/payslip/payslip_download_tab.html @@ -2,4 +2,4 @@
{% csrf_token %} -
\ No newline at end of file + diff --git a/payroll/templates/cbv/payslip/payslip_filter.html b/payroll/templates/cbv/payslip/payslip_filter.html index b723826e8..229b7bb28 100644 --- a/payroll/templates/cbv/payslip/payslip_filter.html +++ b/payroll/templates/cbv/payslip/payslip_filter.html @@ -139,4 +139,4 @@ {% comment %} {{form.}} {% endcomment %} - \ No newline at end of file + diff --git a/payroll/templates/cbv/payslip/payslip_home.html b/payroll/templates/cbv/payslip/payslip_home.html index 49df22555..241ab2cc0 100644 --- a/payroll/templates/cbv/payslip/payslip_home.html +++ b/payroll/templates/cbv/payslip/payslip_home.html @@ -56,7 +56,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -71,9 +71,9 @@ style="display: none" > - -
@@ -158,4 +158,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/payroll/templates/cbv/payslip/payslip_inherit_form.html b/payroll/templates/cbv/payslip/payslip_inherit_form.html index d9c7735c9..55331d56c 100644 --- a/payroll/templates/cbv/payslip/payslip_inherit_form.html +++ b/payroll/templates/cbv/payslip/payslip_inherit_form.html @@ -14,5 +14,5 @@ $('#id_start_date_parent_div').before(contractStartDateHtml); }); - - \ No newline at end of file + + diff --git a/payroll/templates/cbv/payslip/payslip_status_col.html b/payroll/templates/cbv/payslip/payslip_status_col.html index 5b7ce784d..8883a15ae 100644 --- a/payroll/templates/cbv/payslip/payslip_status_col.html +++ b/payroll/templates/cbv/payslip/payslip_status_col.html @@ -14,4 +14,4 @@
{{instance.get_status_display}}
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/payroll/templates/cbv/reimbursements/actions.html b/payroll/templates/cbv/reimbursements/actions.html index c6c06788e..c2f0fd8c3 100644 --- a/payroll/templates/cbv/reimbursements/actions.html +++ b/payroll/templates/cbv/reimbursements/actions.html @@ -49,4 +49,4 @@
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/payroll/templates/cbv/reimbursements/amount.html b/payroll/templates/cbv/reimbursements/amount.html index 2928f7eb4..e1f0e3045 100644 --- a/payroll/templates/cbv/reimbursements/amount.html +++ b/payroll/templates/cbv/reimbursements/amount.html @@ -5,4 +5,4 @@ onkeyup="inputAmount($(this))" name="reqAmount" class="w-75"{% if instance.status != "requested" %}disabled{% endif %} {% if instance.amount %} value="{{instance.amount}}"{% endif %} /> - \ No newline at end of file + diff --git a/payroll/templates/cbv/reimbursements/attachments.html b/payroll/templates/cbv/reimbursements/attachments.html index 9a65fc32d..a710c4c3b 100644 --- a/payroll/templates/cbv/reimbursements/attachments.html +++ b/payroll/templates/cbv/reimbursements/attachments.html @@ -9,4 +9,4 @@ style="width:40px;height:40px" > - {% endfor %} \ No newline at end of file + {% endfor %} diff --git a/payroll/templates/cbv/reimbursements/comment.html b/payroll/templates/cbv/reimbursements/comment.html index a956698d3..70430a1f9 100644 --- a/payroll/templates/cbv/reimbursements/comment.html +++ b/payroll/templates/cbv/reimbursements/comment.html @@ -3,4 +3,4 @@ data-target = '#activitySidebar' title="View Comment" class="oh-btn oh-btn--light oh-activity-sidebar__open w-100" style="flex: 1 0 auto; width:20px;height: 40.68px; padding: 0;" onclick="event.stopPropagation()"> - \ No newline at end of file + diff --git a/payroll/templates/cbv/reimbursements/detail_actions.html b/payroll/templates/cbv/reimbursements/detail_actions.html index 4594a487e..5d1588be5 100644 --- a/payroll/templates/cbv/reimbursements/detail_actions.html +++ b/payroll/templates/cbv/reimbursements/detail_actions.html @@ -23,4 +23,3 @@ {% endif %} - diff --git a/payroll/templates/cbv/reimbursements/filter.html b/payroll/templates/cbv/reimbursements/filter.html index 3f6cb3d30..3c117f99e 100644 --- a/payroll/templates/cbv/reimbursements/filter.html +++ b/payroll/templates/cbv/reimbursements/filter.html @@ -35,4 +35,4 @@ - \ No newline at end of file + diff --git a/payroll/templates/cbv/reimbursements/forms.html b/payroll/templates/cbv/reimbursements/forms.html index 2d3f19888..0449ac3a3 100644 --- a/payroll/templates/cbv/reimbursements/forms.html +++ b/payroll/templates/cbv/reimbursements/forms.html @@ -2,7 +2,7 @@
{% include "generic/horilla_form.html" %}
- \ No newline at end of file + diff --git a/payroll/templates/cbv/reimbursements/options.html b/payroll/templates/cbv/reimbursements/options.html index 84953ebc5..4bba1f4fc 100644 --- a/payroll/templates/cbv/reimbursements/options.html +++ b/payroll/templates/cbv/reimbursements/options.html @@ -29,4 +29,4 @@ {% endif %} - \ No newline at end of file + diff --git a/payroll/templates/cbv/reimbursements/reimbursements.html b/payroll/templates/cbv/reimbursements/reimbursements.html index c69ae6c9d..c39e736bf 100644 --- a/payroll/templates/cbv/reimbursements/reimbursements.html +++ b/payroll/templates/cbv/reimbursements/reimbursements.html @@ -31,7 +31,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -47,9 +47,9 @@ style="display: none" > {% comment %} status=requested {% endcomment %} - -
@@ -62,7 +62,7 @@
- + - -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/payroll/templates/cbv/settings/is_active_col.html b/payroll/templates/cbv/settings/is_active_col.html index 824b4de87..8f89cc048 100644 --- a/payroll/templates/cbv/settings/is_active_col.html +++ b/payroll/templates/cbv/settings/is_active_col.html @@ -9,4 +9,3 @@ {% endif %} - diff --git a/pms/cbv/accessibility.py b/pms/cbv/accessibility.py index 43a12f272..a357c8e52 100644 --- a/pms/cbv/accessibility.py +++ b/pms/cbv/accessibility.py @@ -3,6 +3,7 @@ Accessiblility for pms """ from django.contrib.auth.context_processors import PermWrapper + from base.methods import check_manager from employee.models import Employee @@ -29,4 +30,3 @@ def create_objective_accessibility( To check the user has permission to add objectives """ return request.user.has_perm("pms.add_objective") - diff --git a/pms/cbv/dashboard.py b/pms/cbv/dashboard.py index eb9988c25..69fba2351 100644 --- a/pms/cbv/dashboard.py +++ b/pms/cbv/dashboard.py @@ -2,12 +2,13 @@ This page handles the cbv methods for dashboard views """ - from typing import Any -from django.urls import reverse + from django.db.models import Q +from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ + from base.methods import filtersubordinates from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import HorillaListView @@ -29,7 +30,6 @@ class DashboardFeedbackView(RequestedFeedbackTab): self.search_url = reverse("dashboard-feedback-answer") self.request.dashboard_feedback = "dashboard_feedback" - def get_queryset(self): queryset = super().get_queryset() employee = self.request.user.employee_get @@ -43,8 +43,6 @@ class DashboardFeedbackView(RequestedFeedbackTab): queryset = feedback_requested_ids.exclude(feedback_answer__employee_id=employee) return queryset - - columns = [ (_("Employee"), "employee_id", "employee_id__get_avatar"), (_("Title"), "review_cycle"), @@ -69,7 +67,6 @@ class DashboardFeedbackView(RequestedFeedbackTab): class KeyResultStatus(HorillaListView): - def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.view_id = "keyContainer" @@ -81,21 +78,20 @@ class KeyResultStatus(HorillaListView): bulk_select_option = False header_attrs = { - "key_result_column" : """ + "key_result_column": """ style="width:200px !important;" """ } - columns = [ - (_("Title"),"key_result_column"), - (_("Start Value"),"start_value"), - (_("Current Value"),"current_value_col"), - (_("Target Value"),"target_value_col"), - (_("Progress Percentage"),"progress_col"), - (_("Start Date"),"start_date"), - (_("End date"),"end_date"), - (_("Status"),"status") + (_("Title"), "key_result_column"), + (_("Start Value"), "start_value"), + (_("Current Value"), "current_value_col"), + (_("Target Value"), "target_value_col"), + (_("Progress Percentage"), "progress_col"), + (_("Start Date"), "start_date"), + (_("End date"), "end_date"), + (_("Status"), "status"), ] action_method = "actions_col" @@ -110,11 +106,9 @@ class KeyResultStatus(HorillaListView): return super(HorillaListView, self).dispatch(*args, **kwargs) - - class DasboardObjectivesRisk(HorillaListView): """ - list view for objectives at risk + list view for objectives at risk """ model = EmployeeObjective @@ -141,6 +135,3 @@ class DasboardObjectivesRisk(HorillaListView): data-target="#genericModal" data-toggle="oh-modal-toggle" """ - - - diff --git a/pms/cbv/feedback.py b/pms/cbv/feedback.py index a37cc88c1..f3b76abcb 100644 --- a/pms/cbv/feedback.py +++ b/pms/cbv/feedback.py @@ -3,27 +3,29 @@ this page handles cbv of assigned leave page """ from typing import Any -from django.shortcuts import render -from django.urls import reverse,reverse_lazy + from django.contrib import messages from django.contrib.auth.models import User -from django.http import HttpResponse from django.db.models import Q -from django.utils.translation import gettext_lazy as _ +from django.http import HttpResponse +from django.shortcuts import render +from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from base.decorators import manager_can_enter -from notifications.signals import notify from base.methods import choosesubordinates, is_reportingmanager from employee.cbv.employee_profile import EmployeeProfileView from employee.models import Employee -from horilla_views.generic.cbv.views import ( - TemplateView, - HorillaListView, - HorillaTabView, - HorillaNavView, - HorillaFormView, -) from horilla_views.cbv_methods import login_required +from horilla_views.generic.cbv.views import ( + HorillaFormView, + HorillaListView, + HorillaNavView, + HorillaTabView, + TemplateView, +) +from notifications.signals import notify from pms.filters import AnonymousFilter, FeedbackFilter from pms.forms import AnonymousFeedbackForm, FeedbackForm from pms.models import AnonymousFeedback, EmployeeKeyResult, Feedback @@ -87,7 +89,7 @@ class FeedbackListView(HorillaListView): row_attrs = """ onclick=" event.stopPropagation(); - window.location.href='{get_individual_feedback}'" + window.location.href='{get_individual_feedback}'" """ row_status_indications = [ @@ -227,7 +229,7 @@ class RequestedFeedbackTab(FeedbackListView): super().__init__(**kwargs) self.search_url = reverse("requested-feedback-tab") self.request.request_feedback = "request_feedback" - self.row_attrs = '' + self.row_attrs = "" def get_queryset(self): queryset = super().get_queryset() diff --git a/pms/cbv/key_result.py b/pms/cbv/key_result.py index cdfa7a644..b4c9a8cca 100644 --- a/pms/cbv/key_result.py +++ b/pms/cbv/key_result.py @@ -16,6 +16,7 @@ from django.views import View from base.methods import closest_numbers from horilla.decorators import manager_can_enter from horilla_views.cbv_methods import login_required, permission_required +from horilla_views.generic.cbv.history import HorillaHistoryView from horilla_views.generic.cbv.views import ( HorillaCardView, HorillaDetailedView, @@ -24,10 +25,9 @@ from horilla_views.generic.cbv.views import ( HorillaNavView, TemplateView, ) -from horilla_views.generic.cbv.history import HorillaHistoryView from pms.filters import ActualKeyResultFilter from pms.forms import KRForm -from pms.models import KeyResult, EmployeeKeyResult +from pms.models import EmployeeKeyResult, KeyResult @method_decorator(login_required, name="dispatch") diff --git a/pms/cbv/meetings.py b/pms/cbv/meetings.py index 1bede1f18..cb6385f37 100644 --- a/pms/cbv/meetings.py +++ b/pms/cbv/meetings.py @@ -2,15 +2,17 @@ Meetings page """ -from typing import Any import contextlib +from typing import Any + +from django.contrib import messages +from django.db.models import Q from django.http import HttpResponse from django.shortcuts import render -from django.utils.translation import gettext_lazy as _ -from django.utils.decorators import method_decorator from django.urls import reverse, reverse_lazy -from django.db.models import Q -from django.contrib import messages +from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, @@ -45,7 +47,6 @@ class MeetingsList(HorillaListView): self.search_url = reverse("meetings-list") self.view_id = "meetingManagerContainer" - def get_queryset(self): queryset = super().get_queryset() if not self.request.user.has_perm("pms.view_meetings"): @@ -59,8 +60,6 @@ class MeetingsList(HorillaListView): model = Meetings filter_class = MeetingsFilter - - columns = [ (_("Title"), "title_col"), (_("Employees"), "employees_col"), @@ -69,13 +68,9 @@ class MeetingsList(HorillaListView): (_("MoM"), "mom_col"), ] - sortby_mapping = [ - ("Date", "date_col") - ] + sortby_mapping = [("Date", "date_col")] - bulk_update_fields = [ - "manager" - ] + bulk_update_fields = ["manager"] action_method = "action_col" diff --git a/pms/cbv/period.py b/pms/cbv/period.py index be5834f9c..5520ccd7c 100644 --- a/pms/cbv/period.py +++ b/pms/cbv/period.py @@ -3,24 +3,26 @@ Question Template page """ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse from django.utils.decorators import method_decorator -from django.contrib import messages from django.utils.translation import gettext_lazy as _ -from base.methods import is_reportingmanager + from base.decorators import manager_can_enter +from base.methods import is_reportingmanager +from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( + HorillaDetailedView, HorillaFormView, HorillaListView, HorillaNavView, TemplateView, - HorillaDetailedView ) -from horilla_views.cbv_methods import login_required +from pms.filters import PeriodFilter from pms.forms import PeriodForm from pms.models import Period -from pms.filters import PeriodFilter @method_decorator(login_required, name="dispatch") @@ -54,16 +56,15 @@ class PeriodList(HorillaListView): (_("Title"), "period_name"), (_("Start Date"), "start_date"), (_("End date"), "end_date"), - ] header_attrs = { - "action" : """ + "action": """ style = "width:180px !important" """, - "period_name" : """ + "period_name": """ style = "width:180px !important" - """ + """, } sortby_mapping = [ @@ -114,11 +115,7 @@ class PeriodDetailView(HorillaDetailedView): model = Period title = _("Details") - header = { - "title": "period_name", - "subtitle": "", - "avatar": "" - } + header = {"title": "period_name", "subtitle": "", "avatar": ""} body = { (_("Title"), "period_name"), diff --git a/pms/cbv/question_template.py b/pms/cbv/question_template.py index 2054678db..360204173 100644 --- a/pms/cbv/question_template.py +++ b/pms/cbv/question_template.py @@ -3,23 +3,25 @@ Question Template page """ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from django.contrib import messages -from base.methods import is_reportingmanager + from base.decorators import manager_can_enter +from base.methods import is_reportingmanager +from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( HorillaFormView, HorillaListView, HorillaNavView, TemplateView, ) -from horilla_views.cbv_methods import login_required +from pms.filters import QuestionTemplateFilter from pms.forms import QuestionTemplateForm from pms.models import QuestionTemplate -from pms.filters import QuestionTemplateFilter @method_decorator(login_required, name="dispatch") @@ -52,8 +54,6 @@ class QuestionTemplateList(HorillaListView): model = QuestionTemplate filter_class = QuestionTemplateFilter - - columns = [ (_("Title"), "question_template", "get_avatar"), @@ -61,7 +61,7 @@ class QuestionTemplateList(HorillaListView): ] header_attrs = { - "action" : """ + "action": """ style="width:250px !important" """ } @@ -100,7 +100,6 @@ class QuestionTemplateNav(HorillaNavView): search_swap_target = "#listContainer" - @method_decorator(login_required, name="dispatch") @method_decorator(manager_can_enter("pms.add_questiontemplate"), name="dispatch") class QuestionTemplateFormView(HorillaFormView): @@ -110,7 +109,7 @@ class QuestionTemplateFormView(HorillaFormView): model = QuestionTemplate form_class = QuestionTemplateForm - + new_display_title = _("Add Question Template") def get_context_data(self, **kwargs): @@ -131,5 +130,7 @@ class QuestionTemplateFormView(HorillaFormView): form.save() messages.success(self.request, _(message)) detail_url = form.instance.get_detail_url() - return self.HttpResponse(f'') + return self.HttpResponse( + f'' + ) return super().form_valid(form) diff --git a/pms/static/cbv/360_feedback.js b/pms/static/cbv/360_feedback.js index 32d2c7d91..7defc3a82 100644 --- a/pms/static/cbv/360_feedback.js +++ b/pms/static/cbv/360_feedback.js @@ -5,7 +5,7 @@ var archiveMessagedata = { en: "Do you really want to archive all the selected feedbacks?", fr: "Voulez-vous vraiment archiver tous les retours sélectionnés?", }; - + var unarchiveMessagedata = { ar: "هل ترغب حقاً في إلغاء الأرشفة عن كل التعليقات المحددة؟", de: "Möchten Sie wirklich alle ausgewählten Rückmeldungen aus der Archivierung nehmen?", @@ -13,7 +13,7 @@ var archiveMessagedata = { en: "Do you really want to unarchive all the selected feedbacks?", fr: "Voulez-vous vraiment désarchiver tous les retours sélectionnés?", }; - + var deleteMessagedata = { ar: "هل ترغب حقاً في حذف كل التعليقات المحددة؟", de: "Möchten Sie wirklich alle ausgewählten Rückmeldungen löschen?", @@ -21,7 +21,7 @@ var archiveMessagedata = { en: "Do you really want to delete all the selected feedbacks?", fr: "Voulez-vous vraiment supprimer tous les retours sélectionnés?", }; - + var norowMessages = { ar: "لم يتم تحديد أي صفوف.", de: "Es wurden keine Zeilen ausgewählt.", @@ -29,7 +29,7 @@ var archiveMessagedata = { en: "No rows have been selected.", fr: "Aucune ligne n'a été sélectionnée.", }; - + $(".all-feedbacks").change(function (e) { var is_checked = $(this).is(":checked"); if (is_checked) { @@ -38,7 +38,7 @@ var archiveMessagedata = { $(".all-feedback-row").prop("checked", false); } }); - + $(".self-feedbacks").change(function (e) { var is_checked = $(this).is(":checked"); if (is_checked) { @@ -47,7 +47,7 @@ var archiveMessagedata = { $(".self-feedback-row").prop("checked", false); } }); - + $(".requested-feedbacks").change(function (e) { var is_checked = $(this).is(":checked"); if (is_checked) { @@ -56,7 +56,7 @@ var archiveMessagedata = { $(".requested-feedback-row").prop("checked", false); } }); - + function getCookie(name) { let cookieValue = null; if (document.cookie && document.cookie !== "") { @@ -72,7 +72,7 @@ var archiveMessagedata = { } return cookieValue; } - + function getCurrentLanguageCode(callback) { var languageCode = $("#main-section-data").attr("data-lang"); var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"]; @@ -98,25 +98,25 @@ var archiveMessagedata = { } } - + $(document).on('click', '#archiveFeedback', function(e) { e.preventDefault(); - + var languageCode = null; getCurrentLanguageCode(function(code) { languageCode = code; - + var confirmMessage = archiveMessagedata[languageCode]; var textMessage = norowMessages[languageCode]; - + var ids = JSON.parse($("#selectedInstances").attr("data-ids")) || []; var announy_ids = JSON.parse($("#anounyselectedInstances").attr("data-ids")) || []; - + if (announy_ids.length > 0) { - ids = []; + ids = []; } - + if (ids.length === 0 && announy_ids.length === 0) { Swal.fire({ text: textMessage, @@ -157,21 +157,21 @@ $(document).on('click', '#archiveFeedback', function(e) { $(document).on('click', '#UnarchiveFeedback', function(e) { e.preventDefault(); - + var languageCode = null; getCurrentLanguageCode(function(code) { languageCode = code; - + var confirmMessage = unarchiveMessagedata[languageCode]; var textMessage = norowMessages[languageCode]; - + var ids = JSON.parse($("#selectedInstances").attr("data-ids")) || []; var announy_ids = JSON.parse($("#anounyselectedInstances").attr("data-ids")) || []; - + if (announy_ids.length > 0) { - ids = []; + ids = []; } - + if (ids.length === 0 && announy_ids.length === 0) { Swal.fire({ text: textMessage, @@ -211,18 +211,18 @@ $(document).on('click', '#UnarchiveFeedback', function(e) { $(document).on('click', '#deleteFeedback', function(e) { e.preventDefault(); - + var languageCode = null; getCurrentLanguageCode(function(code) { languageCode = code; - + var confirmMessage = deleteMessagedata[languageCode]; var textMessage = norowMessages[languageCode]; - + 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) { Swal.fire({ text: textMessage, @@ -259,8 +259,3 @@ $(document).on('click', '#deleteFeedback', function(e) { } }); }); - - - - - diff --git a/pms/templates/cbv/360_feedback/anonymous_action.html b/pms/templates/cbv/360_feedback/anonymous_action.html index 31830ad55..d9924e37a 100644 --- a/pms/templates/cbv/360_feedback/anonymous_action.html +++ b/pms/templates/cbv/360_feedback/anonymous_action.html @@ -3,9 +3,9 @@ {% if request.user.id|stringformat:"d" == instance.anonymous_feedback_id or request.user.is_superuser %}
diff --git a/pms/templates/cbv/360_feedback/custom_actions.html b/pms/templates/cbv/360_feedback/custom_actions.html index 1dabfc78d..c46aa27e4 100644 --- a/pms/templates/cbv/360_feedback/custom_actions.html +++ b/pms/templates/cbv/360_feedback/custom_actions.html @@ -73,7 +73,3 @@ {%endif%} {%endif%}
- - - - diff --git a/pms/templates/cbv/360_feedback/custom_status_col.html b/pms/templates/cbv/360_feedback/custom_status_col.html index d02773b98..c90c255bd 100644 --- a/pms/templates/cbv/360_feedback/custom_status_col.html +++ b/pms/templates/cbv/360_feedback/custom_status_col.html @@ -6,17 +6,17 @@ .oh-dot--colorBehind { background-color: hsl(40deg, 91%, 60%) } - + .oh-dot--colorAt { background-color: hsl(1deg, 100%, 61%) } .oh-dot--colorClosed { background-color: hsl(204deg, 70%, 53%) } - + .oh-dot--colorNot { background-color: hsla(270, 5%, 48%, 0.709) } - {% trans instance.status %} \ No newline at end of file + {% trans instance.status %} diff --git a/pms/templates/cbv/360_feedback/due_in_col.html b/pms/templates/cbv/360_feedback/due_in_col.html index 8357dbeb9..5b3c92a43 100644 --- a/pms/templates/cbv/360_feedback/due_in_col.html +++ b/pms/templates/cbv/360_feedback/due_in_col.html @@ -1,2 +1,2 @@ {% load i18n %} -{{ current_date|timesince:instance.end_date }} \ No newline at end of file +{{ current_date|timesince:instance.end_date }} diff --git a/pms/templates/cbv/360_feedback/feedback_filter.html b/pms/templates/cbv/360_feedback/feedback_filter.html index 1ac33931f..15edac945 100644 --- a/pms/templates/cbv/360_feedback/feedback_filter.html +++ b/pms/templates/cbv/360_feedback/feedback_filter.html @@ -18,14 +18,14 @@
{% trans "Feedback" %}
-
+
{{feedback_filter_form.employee_id}}
- +
@@ -44,20 +44,20 @@ {{feedback_filter_form.colleague_id}}
- +
{{feedback_filter_form.start_date}}
- +
{{feedback_filter_form.end_date}}
-
+
@@ -77,10 +77,10 @@
- +
- +
{% trans "Advanced" %}
@@ -94,7 +94,7 @@ {{ feedback_filter_form.start_date_range.1 }}
- +
@@ -103,7 +103,7 @@ {{ feedback_filter_form.end_date_range.1 }}
- +
@@ -112,7 +112,7 @@ {{ feedback_filter_form.created_at_date_range.1 }}
- +
@@ -155,5 +155,3 @@
- - diff --git a/pms/templates/cbv/360_feedback/feedback_home.html b/pms/templates/cbv/360_feedback/feedback_home.html index c7bace653..cbc196e3a 100644 --- a/pms/templates/cbv/360_feedback/feedback_home.html +++ b/pms/templates/cbv/360_feedback/feedback_home.html @@ -4,7 +4,7 @@ {% block content %}
-
+ {% include "generic/components.html" %} @@ -58,9 +58,9 @@ {% comment %} {% endcomment %} {% comment %} archive=false {% endcomment %} -
-
+
@@ -100,4 +100,4 @@ aria-hidden="true"> $("#applyFilter").click(); } -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/pms/templates/cbv/360_feedback/form/form_inherit.html b/pms/templates/cbv/360_feedback/form/form_inherit.html index d46b8ba45..f2b2a6f97 100644 --- a/pms/templates/cbv/360_feedback/form/form_inherit.html +++ b/pms/templates/cbv/360_feedback/form/form_inherit.html @@ -1,4 +1,4 @@ - + {% load i18n %}
{% include 'generic/horilla_form.html' %} @@ -21,7 +21,7 @@ $(document).ready(function () { if (!$('#id_cyclic_feedback').is(':checked')) { $("#id_cyclic_feedback_days_count_parent_div").hide(); - $("#id_cyclic_feedback_period_parent_div").hide(); + $("#id_cyclic_feedback_period_parent_div").hide(); } $("#id_cyclic_feedback").on("change", function () { if (this.checked) { @@ -41,5 +41,3 @@ - - \ No newline at end of file diff --git a/pms/templates/cbv/360_feedback/inherit.html b/pms/templates/cbv/360_feedback/inherit.html index acc00a5c4..d735cdebf 100644 --- a/pms/templates/cbv/360_feedback/inherit.html +++ b/pms/templates/cbv/360_feedback/inherit.html @@ -8,10 +8,10 @@ "#id_department_id_parent_div", "#id_job_position_id_parent_div", ]; - + function updateFieldsVisibility() { var based_on = $("#id_based_on").val(); - + fields.forEach(function (field) { if (field.includes(based_on)) { $(field).show(); @@ -20,11 +20,11 @@ } }); } - + updateFieldsVisibility(); - + $("#id_based_on").change(function () { updateFieldsVisibility(); }); }); - \ No newline at end of file + diff --git a/pms/templates/cbv/dashboard/actions.html b/pms/templates/cbv/dashboard/actions.html index 7959c69a0..92c2b51a5 100644 --- a/pms/templates/cbv/dashboard/actions.html +++ b/pms/templates/cbv/dashboard/actions.html @@ -32,4 +32,4 @@ > -
\ No newline at end of file +
diff --git a/pms/templates/cbv/dashboard/current_value.html b/pms/templates/cbv/dashboard/current_value.html index af80e8f91..df1f73ea9 100644 --- a/pms/templates/cbv/dashboard/current_value.html +++ b/pms/templates/cbv/dashboard/current_value.html @@ -72,4 +72,4 @@ } } - \ No newline at end of file + diff --git a/pms/templates/cbv/key_results/actions.html b/pms/templates/cbv/key_results/actions.html index 1e6856a44..3e72671de 100644 --- a/pms/templates/cbv/key_results/actions.html +++ b/pms/templates/cbv/key_results/actions.html @@ -33,4 +33,3 @@ > - diff --git a/pms/templates/cbv/key_results/detail_view_actions.html b/pms/templates/cbv/key_results/detail_view_actions.html index 3e403d911..08baafcc3 100644 --- a/pms/templates/cbv/key_results/detail_view_actions.html +++ b/pms/templates/cbv/key_results/detail_view_actions.html @@ -37,5 +37,5 @@ {% if request.GET.deleted %} -{% endif %} \ No newline at end of file + +{% endif %} diff --git a/pms/templates/cbv/key_results/key_result_filter.html b/pms/templates/cbv/key_results/key_result_filter.html index c34d38943..6756fc052 100644 --- a/pms/templates/cbv/key_results/key_result_filter.html +++ b/pms/templates/cbv/key_results/key_result_filter.html @@ -57,4 +57,3 @@ // $('#field').attr('hx-vals',`{'data':${formData}}` ); }); - \ No newline at end of file diff --git a/pms/templates/cbv/key_results/key_result_home.html b/pms/templates/cbv/key_results/key_result_home.html index 10d22d9ae..98b568825 100644 --- a/pms/templates/cbv/key_results/key_result_home.html +++ b/pms/templates/cbv/key_results/key_result_home.html @@ -5,7 +5,7 @@
-
+ {% include "generic/components.html" %} @@ -13,15 +13,15 @@ -
-
+
+
-
- + -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/pms/templates/cbv/meetings/actions.html b/pms/templates/cbv/meetings/actions.html index 575f9b47d..82a1ce59d 100644 --- a/pms/templates/cbv/meetings/actions.html +++ b/pms/templates/cbv/meetings/actions.html @@ -8,8 +8,8 @@
{% if perms.pms.add_meetings or request.user.employee_get in instance.manager.all or request.user.employee_get in instance.answer_employees.all %} - -
- - \ No newline at end of file diff --git a/pms/templates/cbv/meetings/date.html b/pms/templates/cbv/meetings/date.html index 3c3f88dad..43d0644c4 100644 --- a/pms/templates/cbv/meetings/date.html +++ b/pms/templates/cbv/meetings/date.html @@ -1,3 +1,3 @@
{{instance.date}} -
\ No newline at end of file + diff --git a/pms/templates/cbv/meetings/employees.html b/pms/templates/cbv/meetings/employees.html index 5a7220424..0a5e28a07 100644 --- a/pms/templates/cbv/meetings/employees.html +++ b/pms/templates/cbv/meetings/employees.html @@ -30,4 +30,4 @@ {% endfor %} {{instance.employee_id.all|length}} {% trans "Employees" %} - \ No newline at end of file + diff --git a/pms/templates/cbv/meetings/forms/meet_create.html b/pms/templates/cbv/meetings/forms/meet_create.html index 695bf2f5a..818add99d 100644 --- a/pms/templates/cbv/meetings/forms/meet_create.html +++ b/pms/templates/cbv/meetings/forms/meet_create.html @@ -19,4 +19,3 @@ }); }); - diff --git a/pms/templates/cbv/meetings/managers.html b/pms/templates/cbv/meetings/managers.html index ae27b7ed2..603e9cd49 100644 --- a/pms/templates/cbv/meetings/managers.html +++ b/pms/templates/cbv/meetings/managers.html @@ -31,4 +31,4 @@ {% endfor %} {{instance.manager.all|length}} {% trans "Managers" %} - \ No newline at end of file + diff --git a/pms/templates/cbv/meetings/meetings.html b/pms/templates/cbv/meetings/meetings.html index f9a36f4d9..dbf354bbd 100644 --- a/pms/templates/cbv/meetings/meetings.html +++ b/pms/templates/cbv/meetings/meetings.html @@ -35,8 +35,8 @@ {% comment %} is_active=True {% endcomment %} -
{% endfor %} {{ instance.employee_objective.all|length}} {% trans "Assignees" %} - \ No newline at end of file + diff --git a/pms/templates/cbv/objectives/emp_obj_actions.html b/pms/templates/cbv/objectives/emp_obj_actions.html index 7adb0ccfa..117f1ebf4 100644 --- a/pms/templates/cbv/objectives/emp_obj_actions.html +++ b/pms/templates/cbv/objectives/emp_obj_actions.html @@ -53,4 +53,4 @@ {% endif %} - \ No newline at end of file + diff --git a/pms/templates/cbv/objectives/employee_objective_status.html b/pms/templates/cbv/objectives/employee_objective_status.html index 9532d558a..ad2e6d38e 100644 --- a/pms/templates/cbv/objectives/employee_objective_status.html +++ b/pms/templates/cbv/objectives/employee_objective_status.html @@ -10,4 +10,4 @@ {% else %} {{instance.get_status_display}} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/pms/templates/cbv/objectives/extended_objectives.html b/pms/templates/cbv/objectives/extended_objectives.html index ba6d36c51..e3b327ca8 100644 --- a/pms/templates/cbv/objectives/extended_objectives.html +++ b/pms/templates/cbv/objectives/extended_objectives.html @@ -5,7 +5,7 @@ \ No newline at end of file + diff --git a/pms/templates/cbv/objectives/filter.html b/pms/templates/cbv/objectives/filter.html index 2a880d594..d7918f763 100644 --- a/pms/templates/cbv/objectives/filter.html +++ b/pms/templates/cbv/objectives/filter.html @@ -37,4 +37,4 @@ - \ No newline at end of file + diff --git a/pms/templates/cbv/objectives/form.html b/pms/templates/cbv/objectives/form.html index 5a2772e02..06e7fb374 100644 --- a/pms/templates/cbv/objectives/form.html +++ b/pms/templates/cbv/objectives/form.html @@ -10,17 +10,17 @@ $(document).ready(function(){ $('#id_add_assignees').change(function(){ addAssignees() }) - + function addAssignees(){ if ($('#id_add_assignees').is(":checked")){ $('[id="id_start_date"]').parent().parent().show(); $('#id_assignees').closest('div.col-12').show(); - + } - else{ + else{ $('[id="id_start_date"]').parent().parent().hide(); $('#id_assignees').closest('div.col-12').hide(); - + } } - \ No newline at end of file + diff --git a/pms/templates/cbv/objectives/key_results.html b/pms/templates/cbv/objectives/key_results.html index 5cea3974f..f4ec6c72a 100644 --- a/pms/templates/cbv/objectives/key_results.html +++ b/pms/templates/cbv/objectives/key_results.html @@ -1,6 +1,6 @@ {% load i18n %}
- + {% for kr in instance.key_result_id.all %}
@@ -33,4 +33,4 @@ {% endfor %} {{instance.key_result_id.all|length}} {% trans "Key results" %} -
\ No newline at end of file +
diff --git a/pms/templates/cbv/objectives/manager.html b/pms/templates/cbv/objectives/manager.html index 2b4fd65bd..83dd5a142 100644 --- a/pms/templates/cbv/objectives/manager.html +++ b/pms/templates/cbv/objectives/manager.html @@ -30,4 +30,4 @@ {% endfor %} {{instance.managers.all|length}} {% trans "Managers" %} - \ No newline at end of file + diff --git a/pms/templates/cbv/objectives/objectives.html b/pms/templates/cbv/objectives/objectives.html index ed67fdd48..0e41592cf 100644 --- a/pms/templates/cbv/objectives/objectives.html +++ b/pms/templates/cbv/objectives/objectives.html @@ -62,7 +62,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -85,9 +85,9 @@ style="display: none" > - -
@@ -102,10 +102,10 @@ - + -{% endblock content %} \ No newline at end of file + +{% endblock content %} diff --git a/pms/templates/cbv/objectives/self_key_results.html b/pms/templates/cbv/objectives/self_key_results.html index ab914d1aa..895f89e78 100644 --- a/pms/templates/cbv/objectives/self_key_results.html +++ b/pms/templates/cbv/objectives/self_key_results.html @@ -1,6 +1,6 @@ {% load i18n %}
- + {% for kr in instance.get_employee_objective.key_result_id.all %}
@@ -33,4 +33,4 @@ {% endfor %} {{instance.get_employee_objective.key_result_id.all|length}} {% trans "Key results" %} -
\ No newline at end of file +
diff --git a/pms/templates/cbv/objectives/self_objective_action.html b/pms/templates/cbv/objectives/self_objective_action.html index 22380d32f..378525c81 100644 --- a/pms/templates/cbv/objectives/self_objective_action.html +++ b/pms/templates/cbv/objectives/self_objective_action.html @@ -49,4 +49,4 @@ {% endif %}
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/pms/templates/cbv/objectives/title.html b/pms/templates/cbv/objectives/title.html index 6e6e887d3..3fc43881d 100644 --- a/pms/templates/cbv/objectives/title.html +++ b/pms/templates/cbv/objectives/title.html @@ -11,7 +11,3 @@ {{instance.title}} - - - - diff --git a/pms/templates/cbv/period/actions.html b/pms/templates/cbv/period/actions.html index d9902e8a7..97de947b8 100644 --- a/pms/templates/cbv/period/actions.html +++ b/pms/templates/cbv/period/actions.html @@ -33,8 +33,8 @@ aria-label="trash outline" > - + {% endif %} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/pms/templates/cbv/period/detail_view_actions.html b/pms/templates/cbv/period/detail_view_actions.html index 41fb55689..8bd0675d6 100644 --- a/pms/templates/cbv/period/detail_view_actions.html +++ b/pms/templates/cbv/period/detail_view_actions.html @@ -1,10 +1,10 @@ {% load basefilters %} {% load i18n %} {% if perms.pms.change_period or request.user|filtersubordinates %} - @@ -19,7 +19,6 @@ style="display: contents;width:100%"> {% csrf_token %} - -{% endif %} + +{% endif %} diff --git a/pms/templates/cbv/period/period.html b/pms/templates/cbv/period/period.html index 6641065d5..80cf17e86 100644 --- a/pms/templates/cbv/period/period.html +++ b/pms/templates/cbv/period/period.html @@ -28,9 +28,9 @@ style="display: none" > - -
@@ -39,5 +39,5 @@ - -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/pms/templates/cbv/question_template/main.html b/pms/templates/cbv/question_template/main.html index 91eac89fb..b2c7a8339 100644 --- a/pms/templates/cbv/question_template/main.html +++ b/pms/templates/cbv/question_template/main.html @@ -1,4 +1,4 @@
{% include "generic/horilla_list.html" %} -
\ No newline at end of file +
diff --git a/pms/templates/cbv/question_template/question_template.html b/pms/templates/cbv/question_template/question_template.html index fa612903c..1976b208f 100644 --- a/pms/templates/cbv/question_template/question_template.html +++ b/pms/templates/cbv/question_template/question_template.html @@ -28,9 +28,9 @@ style="display: none" > - -
@@ -42,12 +42,12 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/recruitment/cbv/accessibility.py b/recruitment/cbv/accessibility.py index 5f8a453b6..0bbd9bc3a 100644 --- a/recruitment/cbv/accessibility.py +++ b/recruitment/cbv/accessibility.py @@ -4,6 +4,7 @@ Accessibility from django.contrib.auth.context_processors import PermWrapper from django.contrib.auth.models import User + from base.methods import check_manager from employee.models import Employee from recruitment.methods import ( @@ -99,7 +100,11 @@ def onboarding_accessibility( accessibility for onboarding tab in candidate individual view """ candidate = Candidate.objects.get(pk=instance.pk) - if candidate.cand_onboarding_task.exists() and in_all_managers(request) or request.user.has_perm("onboarding.view_onboardingtask"): + if ( + candidate.cand_onboarding_task.exists() + and in_all_managers(request) + or request.user.has_perm("onboarding.view_onboardingtask") + ): return True return False @@ -112,7 +117,11 @@ def rating_accessibility( """ candidate = Candidate.objects.get(pk=instance.pk) stage_manage = stage_manages(request.user.employee_get, candidate.recruitment_id) - if stage_manage or request.user.has_perm("recruitment.view_candidate") or request.user.has_perm("recruitment.view_candidate"): + if ( + stage_manage + or request.user.has_perm("recruitment.view_candidate") + or request.user.has_perm("recruitment.view_candidate") + ): return True return False @@ -121,7 +130,11 @@ def if_manager_accessibility(request, instance, *args, **kwargs): """ If manager accessibility """ - return is_recruitmentmanager(request) or is_stagemanager(request) or request.user.has_perm("recruitment.view_candidate") + return ( + is_recruitmentmanager(request) + or is_stagemanager(request) + or request.user.has_perm("recruitment.view_candidate") + ) def empl_scheduled_interview_accessibility( diff --git a/recruitment/cbv/candidate_mail_log.py b/recruitment/cbv/candidate_mail_log.py index 00fc73cd5..f548ee5b4 100644 --- a/recruitment/cbv/candidate_mail_log.py +++ b/recruitment/cbv/candidate_mail_log.py @@ -3,14 +3,16 @@ This page is handling the cbv methods of mail log tab in employee individual pag """ from typing import Any -from django.utils.translation import gettext_lazy as _ + from django.urls import reverse from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from base.cbv.mail_log_tab import MailLogTabList -from horilla_views.generic.cbv.views import HorillaListView from horilla_views.cbv_methods import login_required -from recruitment.models import Candidate +from horilla_views.generic.cbv.views import HorillaListView from recruitment.cbv_decorators import all_manager_can_enter +from recruitment.models import Candidate @method_decorator(login_required, name="dispatch") diff --git a/recruitment/cbv/candidate_profile.py b/recruitment/cbv/candidate_profile.py index 5c712f157..4817e6bfe 100644 --- a/recruitment/cbv/candidate_profile.py +++ b/recruitment/cbv/candidate_profile.py @@ -2,19 +2,20 @@ This page handles the cbv methods for canidate profile page """ -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from employee.cbv.employee_profile import EmployeeProfileView from horilla import settings -from horilla_views.generic.cbv.views import HorillaProfileView, HorillaListView -from recruitment.cbv.candidate_mail_log import CandidateMailLogTabList -from recruitment.filters import CandidateFilter -from recruitment.views import views -from recruitment.models import Candidate -from recruitment.cbv_decorators import all_manager_can_enter from horilla_views.cbv_methods import login_required -from onboarding.models import CandidateTask +from horilla_views.generic.cbv.views import HorillaListView, HorillaProfileView from onboarding.filters import CandidateTaskFilter +from onboarding.models import CandidateTask +from recruitment.cbv.candidate_mail_log import CandidateMailLogTabList +from recruitment.cbv_decorators import all_manager_can_enter +from recruitment.filters import CandidateFilter +from recruitment.models import Candidate +from recruitment.views import views @method_decorator(login_required, name="dispatch") diff --git a/recruitment/cbv/candidate_reject_reason.py b/recruitment/cbv/candidate_reject_reason.py index ed455a506..89a2fb8ba 100644 --- a/recruitment/cbv/candidate_reject_reason.py +++ b/recruitment/cbv/candidate_reject_reason.py @@ -3,18 +3,20 @@ This page handles reject reason in settings """ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse -from django.utils.translation import gettext_lazy as _ from django.utils.decorators import method_decorator -from django.contrib import messages -from recruitment.filters import RejectReasonFilter -from horilla_views.cbv_methods import permission_required, login_required +from django.utils.translation import gettext_lazy as _ + +from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaFormView, HorillaListView, HorillaNavView, ) +from recruitment.filters import RejectReasonFilter from recruitment.forms import RejectReasonForm from recruitment.models import RejectReason @@ -72,13 +74,14 @@ class RejectReasonListView(HorillaListView): header_attrs = { "title": """ style="width:200px !important" """, "description": """ style="width:200px !important" """, - "action": """ style="width:200px !important" """ + "action": """ style="width:200px !important" """, } row_attrs = """ id = "rejectReasonTr{get_instance_id}" """ + # onclick="deleteRejectReason('{get_delete_url}')" @method_decorator(login_required, name="dispatch") @method_decorator( @@ -141,7 +144,8 @@ class RejectReasonFormView(HorillaFormView): messages.success(self.request, _(message)) return self.HttpResponse() return super().form_valid(form) - + + class DynamicRejectReasonFormView(HorillaFormView): model = RejectReason diff --git a/recruitment/cbv/candidates.py b/recruitment/cbv/candidates.py index 92460c6a3..3f5c991c2 100644 --- a/recruitment/cbv/candidates.py +++ b/recruitment/cbv/candidates.py @@ -2,29 +2,43 @@ This module used for recruitment candidates """ -import io import ast +import io import json import re -from bs4 import BeautifulSoup -from xhtml2pdf import pisa -from openpyxl import Workbook -from openpyxl.styles import PatternFill, Font, Border, Side, Alignment -from openpyxl.utils import get_column_letter from typing import Any -from import_export import fields, resources + +from bs4 import BeautifulSoup +from django import forms +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render -from django.utils.decorators import method_decorator -from django.urls import reverse, reverse_lazy -from django.views import View -from django.utils.translation import gettext_lazy as _ -from django.contrib import messages -from django import forms from django.template.loader import render_to_string -from horilla.horilla_middlewares import _thread_locals +from django.urls import reverse, reverse_lazy +from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ +from django.views import View +from import_export import fields, resources +from openpyxl import Workbook +from openpyxl.styles import Alignment, Border, Font, PatternFill, Side +from openpyxl.utils import get_column_letter +from xhtml2pdf import pisa + from employee.forms import BulkUpdateFieldForm +from horilla.horilla_middlewares import _thread_locals +from horilla_views.cbv_methods import export_xlsx, login_required, permission_required +from horilla_views.forms import DynamicBulkUpdateForm +from horilla_views.generic.cbv.views import ( + HorillaCardView, + HorillaDetailedView, + HorillaFormView, + HorillaListView, + HorillaNavView, + TemplateView, +) +from horilla_views.templatetags.generic_template_filters import getattribute from recruitment.cbv.candidate_reject_reason import DynamicRejectReasonFormView +from recruitment.cbv_decorators import all_manager_can_enter, manager_can_enter from recruitment.filters import CandidateFilter from recruitment.forms import ( CandidateExportForm, @@ -33,23 +47,11 @@ from recruitment.forms import ( ) from recruitment.models import ( Candidate, - RejectedCandidate, - SkillZoneCandidate, RecruitmentSurvey, RecruitmentSurveyAnswer, + RejectedCandidate, + SkillZoneCandidate, ) -from recruitment.cbv_decorators import manager_can_enter, all_manager_can_enter -from horilla_views.forms import DynamicBulkUpdateForm -from horilla_views.templatetags.generic_template_filters import getattribute -from horilla_views.generic.cbv.views import ( - HorillaFormView, - HorillaListView, - TemplateView, - HorillaNavView, - HorillaCardView, - HorillaDetailedView, -) -from horilla_views.cbv_methods import export_xlsx, login_required, permission_required _getattribute = getattribute @@ -199,7 +201,7 @@ class ListCandidates(HorillaListView): "attrs": """ class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" onclick="event.stopPropagation() - archiveCandidate({get_archive_url}); " + archiveCandidate({get_archive_url}); " """, }, { @@ -209,7 +211,7 @@ class ListCandidates(HorillaListView): "attrs": """ class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" onclick="event.stopPropagation() - archiveCandidate({get_archive_url}); " + archiveCandidate({get_archive_url}); " """, }, { @@ -457,7 +459,9 @@ class ListCandidates(HorillaListView): ws.title = "Exported Data" # Styling - header_fill = PatternFill(start_color="FFD700", end_color="FFD700", fill_type="solid") + header_fill = PatternFill( + start_color="FFD700", end_color="FFD700", fill_type="solid" + ) bold_font = Font(bold=True) thin_border = Border( left=Side(style="thin"), @@ -473,7 +477,9 @@ class ListCandidates(HorillaListView): cell.fill = header_fill cell.font = bold_font cell.border = thin_border - cell.alignment = Alignment(horizontal="center", vertical="center", wrap_text=True) + cell.alignment = Alignment( + horizontal="center", vertical="center", wrap_text=True + ) # Write data rows for row_idx, item in enumerate(json_data, start=2): @@ -483,7 +489,9 @@ class ListCandidates(HorillaListView): if isinstance(value, list): value = "\n".join(str(v) for v in value) elif isinstance(value, dict): - value = json.dumps(value, ensure_ascii=False) # or format it as needed + value = json.dumps( + value, ensure_ascii=False + ) # or format it as needed cell = ws.cell(row=row_idx, column=col_idx, value=value) cell.border = thin_border cell.alignment = wrap_alignment @@ -536,7 +544,7 @@ class CardCandidates(HorillaCardView): return confirm('Are you sure you want to convert this candidate into an employee?')" href='{get_convert_to_emp}' class="oh-dropdown__link" - + """, }, { @@ -548,7 +556,7 @@ class CardCandidates(HorillaCardView): hx-get="{get_add_to_skill}" hx-target="#genericModalBody" class="oh-dropdown__link" - + """, }, { @@ -580,7 +588,7 @@ class CardCandidates(HorillaCardView): data-target="#genericModal" hx-get="{get_add_to_reject}" class="oh-dropdown__link" - + """, }, { @@ -593,7 +601,7 @@ class CardCandidates(HorillaCardView): data-target="#genericModal" hx-get="{get_add_to_reject}" class="oh-dropdown__link" - + """, }, { @@ -602,7 +610,7 @@ class CardCandidates(HorillaCardView): onclick="event.stopPropagation() window.location.href='{get_update_url}' " class="oh-dropdown__link" - + """, }, { @@ -610,8 +618,8 @@ class CardCandidates(HorillaCardView): "attrs": """ class="oh-dropdown__link" onclick="archiveCandidate({get_archive_url});" - - + + """, }, { @@ -620,7 +628,7 @@ class CardCandidates(HorillaCardView): class="oh-dropdown__link oh-dropdown__link--danger" onclick="event.stopPropagation(); deleteCandidate('{get_delete_url}'); " - + """, }, ] @@ -708,14 +716,14 @@ class CandidateNav(HorillaNavView): "action": "Archive", "attrs": """ id="archiveCandidates" - + """, }, { "action": "Un archive", "attrs": """ id="unArchiveCandidates" - + """, }, { diff --git a/recruitment/cbv/dashboard.py b/recruitment/cbv/dashboard.py index 108ff6e3c..8a4171901 100644 --- a/recruitment/cbv/dashboard.py +++ b/recruitment/cbv/dashboard.py @@ -3,14 +3,16 @@ Dashboard of recruitment """ from typing import Any -from django.urls import reverse + from django.db.models import Count, Q -from django.utils.translation import gettext_lazy as _ +from django.urls import reverse from django.utils.decorators import method_decorator +from django.utils.translation import gettext_lazy as _ + from base.filters import JobRoleFilter from base.models import JobPosition -from horilla_views.generic.cbv.views import HorillaListView from horilla_views.cbv_methods import login_required +from horilla_views.generic.cbv.views import HorillaListView from recruitment.cbv_decorators import manager_can_enter from recruitment.filters import CandidateFilter, RecruitmentFilter, SkillZoneFilter from recruitment.models import Candidate, Recruitment, SkillZone @@ -112,22 +114,22 @@ class CurrentHiringList(HorillaListView): header_attrs = { "job_position": """ - style = "width:100px !important " + style = "width:100px !important " """, "initial_count": """ - style = "width:55px !important" + style = "width:55px !important" """, "test_count": """ - style = "width:55px !important;" + style = "width:55px !important;" """, "interview_count": """ - style = "width:60px !important" + style = "width:60px !important" """, "hired_count": """ - style = "width:55px !important" + style = "width:55px !important" """, "cancelled_count": """ - style = "width:65px !important" + style = "width:65px !important" """, } diff --git a/recruitment/cbv/interview.py b/recruitment/cbv/interview.py index 2840f5362..24641ca03 100644 --- a/recruitment/cbv/interview.py +++ b/recruitment/cbv/interview.py @@ -19,8 +19,8 @@ from horilla_views.generic.cbv.views import ( HorillaNavView, TemplateView, ) -from recruitment.decorators import recruitment_manager_can_enter, manager_can_enter from notifications.signals import notify +from recruitment.decorators import manager_can_enter, recruitment_manager_can_enter from recruitment.filters import InterviewFilter from recruitment.forms import ScheduleInterviewForm from recruitment.models import Candidate, InterviewSchedule diff --git a/recruitment/cbv/pipeline.py b/recruitment/cbv/pipeline.py index 39e45b904..a8c1c80af 100644 --- a/recruitment/cbv/pipeline.py +++ b/recruitment/cbv/pipeline.py @@ -3,27 +3,29 @@ recruitment/cbv/pipeline.py """ from typing import Any + +from django.contrib import messages +from django.core.cache import cache as CACHE from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator -from django.utils.translation import gettext_lazy as _ from django.utils.http import urlencode -from django.core.cache import cache as CACHE -from django.contrib import messages +from django.utils.translation import gettext_lazy as _ + from horilla_views.cbv_methods import login_required from horilla_views.generic.cbv.views import ( HorillaFormView, HorillaListView, HorillaNavView, - TemplateView, HorillaTabView, + TemplateView, get_short_uuid, ) -from recruitment import models, filters, forms +from recruitment import filters, forms, models +from recruitment.cbv_decorators import manager_can_enter from recruitment.templatetags.recruitmentfilters import ( recruitment_manages, stage_manages, ) -from recruitment.cbv_decorators import manager_can_enter @method_decorator(login_required, name="dispatch") @@ -344,7 +346,7 @@ class CandidateList(HorillaListView): "icon": "document-outline", "attrs": """ class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" - href="{get_resume_url}" target="_blank" + href="{get_resume_url}" target="_blank" """, }, ] diff --git a/recruitment/cbv/recruitment_survey.py b/recruitment/cbv/recruitment_survey.py index d6dc1cc1a..005bb708e 100644 --- a/recruitment/cbv/recruitment_survey.py +++ b/recruitment/cbv/recruitment_survey.py @@ -1,25 +1,26 @@ """ This page handles the cbv methods for recruitment survey page """ + from typing import Any + from django import forms from django.contrib import messages from django.http import HttpResponse +from django.shortcuts import render from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from django.shortcuts import render -from horilla_views.generic.cbv.views import ( - HorillaDetailedView, - HorillaFormView, -) + from horilla_views.cbv_methods import login_required, permission_required -from recruitment.forms import QuestionForm,TemplateForm -from recruitment.models import RecruitmentSurvey,SurveyTemplate +from horilla_views.generic.cbv.views import HorillaDetailedView, HorillaFormView +from recruitment.forms import QuestionForm, TemplateForm +from recruitment.models import RecruitmentSurvey, SurveyTemplate - -@method_decorator(login_required,name="dispatch") -@method_decorator(permission_required("recruitment.add_recruitmentsurvey"),name="dispatch") +@method_decorator(login_required, name="dispatch") +@method_decorator( + permission_required("recruitment.add_recruitmentsurvey"), name="dispatch" +) class QuestionFormView(HorillaFormView): """ form view for create button @@ -49,13 +50,15 @@ class QuestionFormView(HorillaFormView): messages.success(self.request, _(message)) return HttpResponse("") return super().form_valid(form) - -@method_decorator(login_required,name="dispatch") -@method_decorator(permission_required("recruitment.add_recruitmentsurvey"),name="dispatch") + +@method_decorator(login_required, name="dispatch") +@method_decorator( + permission_required("recruitment.add_recruitmentsurvey"), name="dispatch" +) class QuestionDuplicateFormView(HorillaFormView): """ - form view for create duplicate for asset + form view for create duplicate for asset """ form_class = QuestionForm @@ -91,10 +94,10 @@ class QuestionDuplicateFormView(HorillaFormView): return super().form_valid(form) - - @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("recruitment.add_surveytemplate"),name="dispatch") +@method_decorator( + permission_required("recruitment.add_surveytemplate"), name="dispatch" +) class SurveyTemplateFormView(HorillaFormView): """ form view for create and edit survey templates @@ -108,12 +111,11 @@ class SurveyTemplateFormView(HorillaFormView): instance = SurveyTemplate.objects.filter(title=title).first() if not self.request.POST: - self.form = self.form_class(instance=instance) + self.form = self.form_class(instance=instance) else: - self.form = self.form_class(self.request.POST,instance=instance) + self.form = self.form_class(self.request.POST, instance=instance) return self.form - def form_invalid(self, form: Any) -> HttpResponse: if not form.is_valid(): errors = form.errors.as_data() @@ -131,9 +133,10 @@ class SurveyTemplateFormView(HorillaFormView): return super().form_valid(form) - @method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("recruitment.add_surveytemplate"),name="dispatch") +@method_decorator( + permission_required("recruitment.add_surveytemplate"), name="dispatch" +) class RecruitmentSurveyDetailView(HorillaDetailedView): """ detail view of the page @@ -142,19 +145,16 @@ class RecruitmentSurveyDetailView(HorillaDetailedView): model = RecruitmentSurvey title = _("Details") body = [ - (_("Question"),"question"), - (_("Question Type"),"get_question_type"), - (_("Sequence"),"sequence"), - (_("Recruitment"),"recruitment_col"), - (_("Options"),"options_col",True), + (_("Question"), "question"), + (_("Question Type"), "get_question_type"), + (_("Sequence"), "sequence"), + (_("Recruitment"), "recruitment_col"), + (_("Options"), "options_col", True), ] - header = {"title": "question", "subtitle": "","avatar":""} + header = {"title": "question", "subtitle": "", "avatar": ""} - - cols = { - "question" : 12 - } + cols = {"question": 12} actions = [ { @@ -165,7 +165,7 @@ class RecruitmentSurveyDetailView(HorillaDetailedView): hx-get="{get_edit_url}" hx-target ="#genericModalBody" data-target = "#genericModal" - data-toggle ="oh-modal-toggle" + data-toggle ="oh-modal-toggle" """, }, { @@ -178,6 +178,3 @@ class RecruitmentSurveyDetailView(HorillaDetailedView): """, }, ] - - - diff --git a/recruitment/cbv/recruitment_view.py b/recruitment/cbv/recruitment_view.py index 79d5c2956..07a1e7916 100644 --- a/recruitment/cbv/recruitment_view.py +++ b/recruitment/cbv/recruitment_view.py @@ -1,21 +1,23 @@ """ -recruitment +recruitment """ from typing import Any + +from django import forms +from django.contrib import messages from django.http import HttpResponse from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from django.contrib import messages -from django import forms + from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaDetailedView, + HorillaFormView, HorillaListView, HorillaNavView, TemplateView, - HorillaFormView, ) from recruitment.filters import RecruitmentFilter from recruitment.forms import AddCandidateForm, RecruitmentCreationForm, SkillsForm @@ -69,7 +71,7 @@ class RecruitmentList(HorillaListView): action_method = "rec_actions" header_attrs = { - "recruitment_column" : """ + "recruitment_column": """ style="width : 200px !important" """ } @@ -82,7 +84,7 @@ class RecruitmentList(HorillaListView): onclick=" $('#applyFilter').closest('form').find('[name=closed]').val('true'); $('#applyFilter').click(); - + " """, ), @@ -93,7 +95,7 @@ class RecruitmentList(HorillaListView): onclick=" $('#applyFilter').closest('form').find('[name=closed]').val('false'); $('#applyFilter').click(); - + " """, ), @@ -149,10 +151,13 @@ class RecruitmentCreationFormExtended(RecruitmentCreationForm): extended form view for create """ - cols = {"title": 12, "description": 12, - "is_published":4, - "optional_profile_image":4, - "optional_resume":4,} + cols = { + "title": 12, + "description": 12, + "is_published": 4, + "optional_profile_image": 4, + "optional_resume": 4, + } class Meta: """ @@ -174,8 +179,8 @@ class RecruitmentCreationFormExtended(RecruitmentCreationForm): "is_published", "optional_profile_image", "optional_resume", - 'publish_in_linkedin', - 'linkedin_account_id', + "publish_in_linkedin", + "linkedin_account_id", ] exclude = ["is_active"] widgets = { @@ -192,8 +197,8 @@ class RecruitmentCreationFormExtended(RecruitmentCreationForm): "vacancy": _("Vacancy"), "open_positions": _("Job Position"), "recruitment_managers": _("Managers"), - "optional_profile_image":_("Optional Profile Image?"), - "optional_resume": _("Optional Resume?") + "optional_profile_image": _("Optional Profile Image?"), + "optional_resume": _("Optional Resume?"), } @@ -231,8 +236,6 @@ class RecruitmentForm(HorillaFormView): dynamic_create_fields = [("skills", RecruitmentNewSkillForm)] template_name = "cbv/recruitment/recruitment_form.html" - - def get_context_data(self, **kwargs): """ Return context data with optional verbose name for form based on instance state. @@ -253,26 +256,29 @@ class RecruitmentForm(HorillaFormView): recruitment_managers = self.request.POST.getlist("recruitment_managers") if recruitment_managers: recruitment.recruitment_managers.set(recruitment_managers) - if (recruitment.publish_in_linkedin and recruitment.linkedin_account_id): + if recruitment.publish_in_linkedin and recruitment.linkedin_account_id: delete_post(recruitment) - post_recruitment_in_linkedin(self.request,recruitment,recruitment.linkedin_account_id) + post_recruitment_in_linkedin( + self.request, recruitment, recruitment.linkedin_account_id + ) message = _("Recruitment Updated Successfully") else: recruitment = form.save() recruitment_managers = self.request.POST.getlist("recruitment_managers") if recruitment_managers: recruitment.recruitment_managers.set(recruitment_managers) - if (recruitment.publish_in_linkedin and recruitment.linkedin_account_id): - post_recruitment_in_linkedin(self.request,recruitment,recruitment.linkedin_account_id) + if recruitment.publish_in_linkedin and recruitment.linkedin_account_id: + post_recruitment_in_linkedin( + self.request, recruitment, recruitment.linkedin_account_id + ) message = _("Recruitment Created Successfully") messages.success(self.request, message) - if self.request.GET.get("pipeline") == "true" : + if self.request.GET.get("pipeline") == "true": return HttpResponse("") return self.HttpResponse() return super().form_valid(form) - class AddCandidateFormView(HorillaFormView): """ form view for add candidate diff --git a/recruitment/cbv/skill_zone.py b/recruitment/cbv/skill_zone.py index 7287fed59..b0cf2dfac 100644 --- a/recruitment/cbv/skill_zone.py +++ b/recruitment/cbv/skill_zone.py @@ -6,18 +6,16 @@ from django.contrib import messages from django.http import HttpResponse from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ + from horilla_views.cbv_methods import login_required +from horilla_views.generic.cbv.views import HorillaFormView from recruitment.cbv_decorators import manager_can_enter -from horilla_views.generic.cbv.views import ( - HorillaFormView, -) from recruitment.forms import SkillZoneCandidateForm, SkillZoneCreateForm from recruitment.models import SkillZone, SkillZoneCandidate - -@method_decorator(login_required,name="dispatch") -@method_decorator(manager_can_enter("recruitment.add_skillzone"),name="dispatch") +@method_decorator(login_required, name="dispatch") +@method_decorator(manager_can_enter("recruitment.add_skillzone"), name="dispatch") class SkillZoneFormView(HorillaFormView): """ form view for create skill zone @@ -47,8 +45,10 @@ class SkillZoneFormView(HorillaFormView): return super().form_valid(form) -@method_decorator(login_required,name="dispatch") -@method_decorator(manager_can_enter("recruitment.add_skillzonecandidate"),name="dispatch") +@method_decorator(login_required, name="dispatch") +@method_decorator( + manager_can_enter("recruitment.add_skillzonecandidate"), name="dispatch" +) class SkillZoneCandidateFormView(HorillaFormView): """ form view for create skill zone candidate diff --git a/recruitment/cbv/skills.py b/recruitment/cbv/skills.py index c0418129f..761b9ec67 100644 --- a/recruitment/cbv/skills.py +++ b/recruitment/cbv/skills.py @@ -3,21 +3,23 @@ this page is handling the cbv methods for skills in settings """ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse -from django.contrib import messages from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from recruitment.filters import SkillsFilter -from recruitment.forms import SkillsForm -from recruitment.models import Skill + from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaFormView, HorillaListView, HorillaNavView, ) +from recruitment.filters import SkillsFilter +from recruitment.forms import SkillsForm +from recruitment.models import Skill @method_decorator(login_required, name="dispatch") @@ -41,7 +43,7 @@ class SkillsListView(HorillaListView): row_attrs = """ id="skillsTr{get_delete_instance}" """ - + actions = [ { "action": _("Edit"), @@ -62,14 +64,14 @@ class SkillsListView(HorillaListView): hx-post="{get_delete_url}" hx-swap="delete" hx-confirm="Are you sure want to delete this skill?" - hx-target="#skillsTr{get_delete_instance}" + hx-target="#skillsTr{get_delete_instance}" """, }, ] header_attrs = { "title": """ style="width:200px !important" """, - "action": """ style="width:200px !important" """ + "action": """ style="width:200px !important" """, } diff --git a/recruitment/cbv/stage_view.py b/recruitment/cbv/stage_view.py index dc57a9d16..69dd7cec1 100644 --- a/recruitment/cbv/stage_view.py +++ b/recruitment/cbv/stage_view.py @@ -2,16 +2,17 @@ Stage.py """ -from typing import Any import contextlib +from typing import Any + from django import forms +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy as _ -from django.contrib import messages -from notifications.signals import notify + from employee.models import Employee from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( @@ -21,6 +22,7 @@ from horilla_views.generic.cbv.views import ( HorillaNavView, TemplateView, ) +from notifications.signals import notify from recruitment.filters import StageFilter from recruitment.forms import StageCreationForm from recruitment.models import Stage @@ -136,7 +138,7 @@ class StageList(HorillaListView): style='width:250px !important' """, "action": """ - style="width:250px !important" + style="width:250px !important" """, } diff --git a/recruitment/cbv_decorators.py b/recruitment/cbv_decorators.py index 74c5add19..eb0b26f67 100644 --- a/recruitment/cbv_decorators.py +++ b/recruitment/cbv_decorators.py @@ -1,10 +1,11 @@ +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render -from django.contrib import messages + from employee.models import Employee +from horilla.horilla_middlewares import _thread_locals from horilla_views.cbv_methods import decorator_with_arguments from recruitment.models import Recruitment, Stage -from horilla.horilla_middlewares import _thread_locals @decorator_with_arguments diff --git a/recruitment/templates/cbv/candidates/candidates.html b/recruitment/templates/cbv/candidates/candidates.html index e1c5bf385..d9ab2af2c 100644 --- a/recruitment/templates/cbv/candidates/candidates.html +++ b/recruitment/templates/cbv/candidates/candidates.html @@ -64,9 +64,9 @@ style="display: none" >
- -
@@ -105,7 +105,7 @@ }).then((result) => { if (result.isConfirmed) { window.location.href = url; - } + } }); } @@ -126,13 +126,13 @@ function deleteCandidate(url) { const form = document.createElement('form'); form.setAttribute('action', url); form.setAttribute('method', 'post'); - + const csrfTokenInput = document.createElement('input'); csrfTokenInput.setAttribute('type', 'hidden'); csrfTokenInput.setAttribute('name', 'csrfmiddlewaretoken'); csrfTokenInput.value = getCSRFToken(); form.appendChild(csrfTokenInput); - + document.body.appendChild(form); form.submit(); } @@ -157,7 +157,7 @@ function toEmployee(url) { }); } -$(document).on('click', '#archiveCandidates', function(e) { +$(document).on('click', '#archiveCandidates', function(e) { e.preventDefault(); var languageCode = null; getCurrentLanguageCode(function (code) { @@ -311,4 +311,4 @@ $(document).on('click', '#deleteCandidates', function(e) { -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/recruitment/templates/cbv/candidates/export.html b/recruitment/templates/cbv/candidates/export.html index 27f419c18..95437b69a 100644 --- a/recruitment/templates/cbv/candidates/export.html +++ b/recruitment/templates/cbv/candidates/export.html @@ -27,4 +27,4 @@
- \ No newline at end of file + diff --git a/recruitment/templates/cbv/candidates/filter.html b/recruitment/templates/cbv/candidates/filter.html index fb1e17f7f..f06152ccb 100644 --- a/recruitment/templates/cbv/candidates/filter.html +++ b/recruitment/templates/cbv/candidates/filter.html @@ -181,4 +181,4 @@ \ No newline at end of file + diff --git a/recruitment/templates/cbv/candidates/option.html b/recruitment/templates/cbv/candidates/option.html index e3c9ad584..764475f6a 100644 --- a/recruitment/templates/cbv/candidates/option.html +++ b/recruitment/templates/cbv/candidates/option.html @@ -33,12 +33,12 @@ {% if perms.recruitment.view_candidate or request.user|is_stagemanager %} - {% endif %} - {% endif %} + {% endif %} + {% endif %} {% if instance.email in emp_list %} @@ -74,4 +74,4 @@ - {% endif %} \ No newline at end of file + {% endif %} diff --git a/recruitment/templates/cbv/candidates/profile_interview_tab.html b/recruitment/templates/cbv/candidates/profile_interview_tab.html index f81bbf17d..ab85043aa 100644 --- a/recruitment/templates/cbv/candidates/profile_interview_tab.html +++ b/recruitment/templates/cbv/candidates/profile_interview_tab.html @@ -43,7 +43,7 @@ {% endfor %}
{% if interview_schedule.description %} - {% trans "Description" %} : {{ interview_schedule.description }} + {% trans "Description" %} : {{ interview_schedule.description }} {% endif %} {% if interview_schedule.completed %} @@ -101,4 +101,4 @@
{% trans "No interviews are scheduled for this candidate" %}
{% endcomment %} {% endif %} - \ No newline at end of file + diff --git a/recruitment/templates/cbv/candidates/profile_notes_tab.html b/recruitment/templates/cbv/candidates/profile_notes_tab.html index 43b0b2dce..f238f6641 100644 --- a/recruitment/templates/cbv/candidates/profile_notes_tab.html +++ b/recruitment/templates/cbv/candidates/profile_notes_tab.html @@ -1,4 +1,4 @@ {% load i18n %}
{% include "candidate/individual_view_note.html" %} -
\ No newline at end of file + diff --git a/recruitment/templates/cbv/candidates/profile_onboarding_tab.html b/recruitment/templates/cbv/candidates/profile_onboarding_tab.html index 2ba0e7ce9..8dc9408b6 100644 --- a/recruitment/templates/cbv/candidates/profile_onboarding_tab.html +++ b/recruitment/templates/cbv/candidates/profile_onboarding_tab.html @@ -79,4 +79,4 @@ - \ No newline at end of file + diff --git a/recruitment/templates/cbv/candidates/profile_resume_tab.html b/recruitment/templates/cbv/candidates/profile_resume_tab.html index 6dccdd86b..95fa32113 100644 --- a/recruitment/templates/cbv/candidates/profile_resume_tab.html +++ b/recruitment/templates/cbv/candidates/profile_resume_tab.html @@ -14,4 +14,3 @@ {% endif %} - diff --git a/recruitment/templates/cbv/candidates/profile_survey_tab.html b/recruitment/templates/cbv/candidates/profile_survey_tab.html index 04907118c..d0961991b 100644 --- a/recruitment/templates/cbv/candidates/profile_survey_tab.html +++ b/recruitment/templates/cbv/candidates/profile_survey_tab.html @@ -64,4 +64,4 @@
{% trans "No survey templates have been established yet." %}
{% endcomment %} - \ No newline at end of file + diff --git a/recruitment/templates/cbv/candidates/rating.html b/recruitment/templates/cbv/candidates/rating.html index ddbb8edb7..f091621c4 100644 --- a/recruitment/templates/cbv/candidates/rating.html +++ b/recruitment/templates/cbv/candidates/rating.html @@ -13,4 +13,4 @@ -{% endwith %} \ No newline at end of file +{% endwith %} diff --git a/recruitment/templates/cbv/candidates/resume.html b/recruitment/templates/cbv/candidates/resume.html index d140c02fe..8e074a2e8 100644 --- a/recruitment/templates/cbv/candidates/resume.html +++ b/recruitment/templates/cbv/candidates/resume.html @@ -10,4 +10,4 @@ >   View - \ No newline at end of file + diff --git a/recruitment/templates/cbv/interview/candidate_custom_col.html b/recruitment/templates/cbv/interview/candidate_custom_col.html index 0e482796a..14a4000ca 100644 --- a/recruitment/templates/cbv/interview/candidate_custom_col.html +++ b/recruitment/templates/cbv/interview/candidate_custom_col.html @@ -8,5 +8,3 @@ {{instance.candidate_id}} - - diff --git a/recruitment/templates/cbv/interview/detail_view_actions.html b/recruitment/templates/cbv/interview/detail_view_actions.html index 129d8962e..b9e669365 100644 --- a/recruitment/templates/cbv/interview/detail_view_actions.html +++ b/recruitment/templates/cbv/interview/detail_view_actions.html @@ -1,10 +1,10 @@ {% load basefilters %} {% load i18n %} {% if perms.recruitment.change_interviewschedule or request.user.employee_get in instance.employee_id.all %} - @@ -19,9 +19,8 @@ style="display: contents;width:100%"> {% csrf_token %} + + - {% endif %} - diff --git a/recruitment/templates/cbv/interview/forms/form_hx.html b/recruitment/templates/cbv/interview/forms/form_hx.html index 35019d51a..fdfabc238 100644 --- a/recruitment/templates/cbv/interview/forms/form_hx.html +++ b/recruitment/templates/cbv/interview/forms/form_hx.html @@ -5,4 +5,4 @@ $(this).closest("select")[0].dispatchEvent(new Event("change")); }); }); - \ No newline at end of file + diff --git a/recruitment/templates/cbv/interview/inherit_script.html b/recruitment/templates/cbv/interview/inherit_script.html index aac8782ce..0e1f39a87 100644 --- a/recruitment/templates/cbv/interview/inherit_script.html +++ b/recruitment/templates/cbv/interview/inherit_script.html @@ -9,4 +9,4 @@ span = recViewContainer.find(".count-span").toggle() }); }) - \ No newline at end of file + diff --git a/recruitment/templates/cbv/interview/interview_home_view.html b/recruitment/templates/cbv/interview/interview_home_view.html index bd094a877..507b8c836 100644 --- a/recruitment/templates/cbv/interview/interview_home_view.html +++ b/recruitment/templates/cbv/interview/interview_home_view.html @@ -4,7 +4,7 @@ {% block content %}
-
+ {% include "generic/components.html" %} @@ -14,9 +14,9 @@
-
+
+
-
@@ -24,20 +24,20 @@
- + -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/recruitment/templates/cbv/interview/interviewer_custom_col.html b/recruitment/templates/cbv/interview/interviewer_custom_col.html index 1f9b5dbd1..4ec83ab7d 100644 --- a/recruitment/templates/cbv/interview/interviewer_custom_col.html +++ b/recruitment/templates/cbv/interview/interviewer_custom_col.html @@ -31,5 +31,3 @@ {% endfor %} {{instance.employee_id.all|length}} {% trans "Interviewers" %} - - \ No newline at end of file diff --git a/recruitment/templates/cbv/interview/status_custom_col.html b/recruitment/templates/cbv/interview/status_custom_col.html index 5d94283fb..edc8ecd30 100644 --- a/recruitment/templates/cbv/interview/status_custom_col.html +++ b/recruitment/templates/cbv/interview/status_custom_col.html @@ -21,4 +21,4 @@ {% trans "Interview Today" %} {% endif %} - \ No newline at end of file + diff --git a/recruitment/templates/cbv/pipeline/candidate_column.html b/recruitment/templates/cbv/pipeline/candidate_column.html index 7ad6fb7e9..e9a47f052 100644 --- a/recruitment/templates/cbv/pipeline/candidate_column.html +++ b/recruitment/templates/cbv/pipeline/candidate_column.html @@ -17,7 +17,7 @@ {% endif %} {% endfor %} - + {{instance|truncatechars:15}} - - \ No newline at end of file + + diff --git a/recruitment/templates/cbv/pipeline/count_of_interviews.html b/recruitment/templates/cbv/pipeline/count_of_interviews.html index 0da64711f..9c85f876b 100644 --- a/recruitment/templates/cbv/pipeline/count_of_interviews.html +++ b/recruitment/templates/cbv/pipeline/count_of_interviews.html @@ -1,4 +1,4 @@ {% load i18n %}
{% trans "Interviews Scheduled" %} : {{instance.candidate_interview.count}} -
\ No newline at end of file + diff --git a/recruitment/templates/cbv/pipeline/empty.html b/recruitment/templates/cbv/pipeline/empty.html index 9dccecfa4..071189b98 100644 --- a/recruitment/templates/cbv/pipeline/empty.html +++ b/recruitment/templates/cbv/pipeline/empty.html @@ -6,4 +6,4 @@ {% trans "No records found." %}

- \ No newline at end of file + diff --git a/recruitment/templates/cbv/pipeline/pipeline.html b/recruitment/templates/cbv/pipeline/pipeline.html index e0b0cd9f5..5b0ef413b 100644 --- a/recruitment/templates/cbv/pipeline/pipeline.html +++ b/recruitment/templates/cbv/pipeline/pipeline.html @@ -36,8 +36,8 @@ visibility: visible; opacity: 1; - - + + } @@ -45,10 +45,10 @@
-
@@ -92,4 +92,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/recruitment/templates/cbv/pipeline/rating.html b/recruitment/templates/cbv/pipeline/rating.html index fea6f6f4f..1d3c3eee4 100644 --- a/recruitment/templates/cbv/pipeline/rating.html +++ b/recruitment/templates/cbv/pipeline/rating.html @@ -33,4 +33,4 @@ {% endif %} {% endwith %} - \ No newline at end of file + diff --git a/recruitment/templates/cbv/pipeline/recruitment_tabs.html b/recruitment/templates/cbv/pipeline/recruitment_tabs.html index 0a1c8248b..3116ec5dd 100644 --- a/recruitment/templates/cbv/pipeline/recruitment_tabs.html +++ b/recruitment/templates/cbv/pipeline/recruitment_tabs.html @@ -87,10 +87,10 @@ - + - \ No newline at end of file diff --git a/recruitment/templates/cbv/recruitment/actions.html b/recruitment/templates/cbv/recruitment/actions.html index e79ebb76d..013b8aa12 100644 --- a/recruitment/templates/cbv/recruitment/actions.html +++ b/recruitment/templates/cbv/recruitment/actions.html @@ -17,8 +17,8 @@ {% if perms.recruitment.delete_recruitment %} @@ -28,4 +28,4 @@ {% endif %} - \ No newline at end of file + diff --git a/recruitment/templates/cbv/recruitment/detail_action.html b/recruitment/templates/cbv/recruitment/detail_action.html index 774de8102..92268a83e 100644 --- a/recruitment/templates/cbv/recruitment/detail_action.html +++ b/recruitment/templates/cbv/recruitment/detail_action.html @@ -1,6 +1,6 @@ {% load i18n %}
- + {% if perms.recruitment.change_recruitment %} - + {% endif %} -
\ No newline at end of file + diff --git a/recruitment/templates/cbv/recruitment/managers_col.html b/recruitment/templates/cbv/recruitment/managers_col.html index e16f56115..63085a3c8 100644 --- a/recruitment/templates/cbv/recruitment/managers_col.html +++ b/recruitment/templates/cbv/recruitment/managers_col.html @@ -27,11 +27,11 @@ >{{manager.employee_first_name|truncatechars:4}}
- {% endfor %} {{instance.recruitment_managers.all|length}} {% trans "Managers" %} - \ No newline at end of file + diff --git a/recruitment/templates/cbv/recruitment/open_jobs.html b/recruitment/templates/cbv/recruitment/open_jobs.html index c8f94a93c..5a9279cbb 100644 --- a/recruitment/templates/cbv/recruitment/open_jobs.html +++ b/recruitment/templates/cbv/recruitment/open_jobs.html @@ -18,4 +18,4 @@ {% endfor %} {{instance.open_positions.all|length}} {% trans "Jobs" %} - \ No newline at end of file + diff --git a/recruitment/templates/cbv/recruitment/rec_main.html b/recruitment/templates/cbv/recruitment/rec_main.html index 1882f78a0..bc2910ad1 100644 --- a/recruitment/templates/cbv/recruitment/rec_main.html +++ b/recruitment/templates/cbv/recruitment/rec_main.html @@ -4,7 +4,7 @@ - diff --git a/recruitment/templates/cbv/recruitment/recruitment.html b/recruitment/templates/cbv/recruitment/recruitment.html index 7ceffa098..7fb565c49 100644 --- a/recruitment/templates/cbv/recruitment/recruitment.html +++ b/recruitment/templates/cbv/recruitment/recruitment.html @@ -28,13 +28,13 @@ .closed-True{ border-left: 3.4px solid red !important; border-radius: 4px 0 0 4px; - + } .closed-False { - + border-left: 3.4px solid yellowgreen !important; border-radius: 4px 0 0 4px; - + } .oh-permission-table--collapsed .oh-permission-panel, .oh-permission-table--collapsed .oh-user-panel { @@ -87,7 +87,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -103,9 +103,9 @@ style="display: none" > - -
@@ -115,4 +115,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/recruitment/templates/cbv/recruitment/recruitment_col.html b/recruitment/templates/cbv/recruitment/recruitment_col.html index c88c394af..5c1d1bfae 100644 --- a/recruitment/templates/cbv/recruitment/recruitment_col.html +++ b/recruitment/templates/cbv/recruitment/recruitment_col.html @@ -16,11 +16,3 @@ {% endif %}
- - - - - - - - \ No newline at end of file diff --git a/recruitment/templates/cbv/recruitment/recruitment_form.html b/recruitment/templates/cbv/recruitment/recruitment_form.html index 17a780bad..2ffe245a8 100644 --- a/recruitment/templates/cbv/recruitment/recruitment_form.html +++ b/recruitment/templates/cbv/recruitment/recruitment_form.html @@ -5,4 +5,4 @@ toggleLinkedIn() } }); - \ No newline at end of file + diff --git a/recruitment/templates/cbv/recruitment/total_hires.html b/recruitment/templates/cbv/recruitment/total_hires.html index 3ca2c2c41..85124cf02 100644 --- a/recruitment/templates/cbv/recruitment/total_hires.html +++ b/recruitment/templates/cbv/recruitment/total_hires.html @@ -1,4 +1,4 @@ {% load i18n %}
{{instance.total_hires}} {% trans "Hired" %} {% trans "of" %} {{instance.candidate.all|length}} {% trans "Candidates" %} -
\ No newline at end of file + diff --git a/recruitment/templates/cbv/recruitment_survey/survey_form.html b/recruitment/templates/cbv/recruitment_survey/survey_form.html index bb25e8ebf..bbfca6538 100644 --- a/recruitment/templates/cbv/recruitment_survey/survey_form.html +++ b/recruitment/templates/cbv/recruitment_survey/survey_form.html @@ -19,7 +19,7 @@ $("#id_options_parent_div").show(); $('[id^="moreOptionContainer_"]').remove(); var optionCount = {{ form.option_count }} - + for (var i = 1; i < optionCount; i++) { var parentDivId = "id_options"+ i +"_parent_div"; var parentDiv = document.getElementById(parentDivId); @@ -28,7 +28,7 @@ $(parentDiv).find('.oh-label__info').remove(); } } - + // Check if "Add more options" button already exists var test = document.getElementById('addOptions') if (!document.getElementById('addOptions')) { @@ -36,32 +36,32 @@ divElement.id = 'moreOptionContainer_' + optionCount; divElement.className = 'pt-2'; divElement.style.textAlign = 'end'; - + var anchorElement = document.createElement('a'); anchorElement.setAttribute('role', 'button'); anchorElement.setAttribute('id', 'addOptions'); anchorElement.style.color = 'green'; anchorElement.innerText = 'Add more options..'; - + divElement.appendChild(anchorElement); - + //var parentDiv = document.getElementById('id_options_parent_div'); if (parentDiv) { parentDiv.insertAdjacentElement('afterend', divElement); - - } + + } else { var parentDivMain = document.getElementById('id_options_parent_div'); parentDivMain.insertAdjacentElement('afterend', divElement); var nextDiv = parentDivMain.nextElementSibling; - nextDiv.id = 'moreOptionContainer_1'; + nextDiv.id = 'moreOptionContainer_1'; } - + } else{ $("#addOptions").show(); } - + } else { $("#id_options_parent_div").hide(); $("#addOptions").hide(); @@ -80,4 +80,3 @@ toggleOpt(); }); - \ No newline at end of file diff --git a/recruitment/templates/cbv/stages/actions.html b/recruitment/templates/cbv/stages/actions.html index 36c84e458..3e768ad0a 100644 --- a/recruitment/templates/cbv/stages/actions.html +++ b/recruitment/templates/cbv/stages/actions.html @@ -40,4 +40,4 @@ {% endif %} - \ No newline at end of file + diff --git a/recruitment/templates/cbv/stages/filter.html b/recruitment/templates/cbv/stages/filter.html index e1b7991b9..8bdff850c 100644 --- a/recruitment/templates/cbv/stages/filter.html +++ b/recruitment/templates/cbv/stages/filter.html @@ -44,4 +44,4 @@ - \ No newline at end of file + diff --git a/recruitment/templates/cbv/stages/managers.html b/recruitment/templates/cbv/stages/managers.html index 24302bd04..41f4e5383 100644 --- a/recruitment/templates/cbv/stages/managers.html +++ b/recruitment/templates/cbv/stages/managers.html @@ -27,4 +27,3 @@ {{instance.stage_managers.all|length}} {% trans "Managers"%} - \ No newline at end of file diff --git a/recruitment/templates/cbv/stages/stage_main.html b/recruitment/templates/cbv/stages/stage_main.html index 6f514cdf6..19b6dd2e1 100644 --- a/recruitment/templates/cbv/stages/stage_main.html +++ b/recruitment/templates/cbv/stages/stage_main.html @@ -4,10 +4,10 @@ \ No newline at end of file + + diff --git a/recruitment/templates/cbv/stages/stages.html b/recruitment/templates/cbv/stages/stages.html index 642a3df1e..83063d2a9 100644 --- a/recruitment/templates/cbv/stages/stages.html +++ b/recruitment/templates/cbv/stages/stages.html @@ -33,35 +33,35 @@ .initial--dot{ background-color:cyan; } - - + + .stage-type-initial{ border-left: 3.4px solid cyan !important; border-radius: 4px 0 0 4px; - + } .stage-type-test{ border-left: 3.4px solid blue !important; border-radius: 4px 0 0 4px; - + } .stage-type-interview{ border-left: 3.4px solid orange !important; border-radius: 4px 0 0 4px; - + } .stage-type-cancelled{ border-left: 3.4px solid red !important; border-radius: 4px 0 0 4px; - + } .stage-type-hired{ border-left: 3.4px solid yellowgreen !important; border-radius: 4px 0 0 4px; - + } - + @@ -69,7 +69,7 @@
-
+ {% comment %} my_app/templates/my_app/generic/index.html {% endcomment %} @@ -85,13 +85,13 @@ style="display: none" > - -
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/recruitment/templates/cbv/stages/title.html b/recruitment/templates/cbv/stages/title.html index 97d6d27d5..ff36d63a6 100644 --- a/recruitment/templates/cbv/stages/title.html +++ b/recruitment/templates/cbv/stages/title.html @@ -7,11 +7,11 @@ - + - + {{instance}} @@ -19,15 +19,14 @@ - \ No newline at end of file diff --git a/templates/filter_country.js b/templates/filter_country.js index 83cee0f0d..03a73f68b 100644 --- a/templates/filter_country.js +++ b/templates/filter_country.js @@ -288,7 +288,7 @@ function populateStates(countryElementId, stateElementId) { } function populateCountries(countryElementId, stateElementId) { - + // Get the country select element by its ID var countryElement = document.getElementById(countryElementId); @@ -329,5 +329,3 @@ function populateCountries(countryElementId, stateElementId) { } populateCountries("country", "state"); - - diff --git a/whatsapp/admin.py b/whatsapp/admin.py index 2e287f6ba..a743d0b01 100644 --- a/whatsapp/admin.py +++ b/whatsapp/admin.py @@ -4,4 +4,4 @@ from whatsapp.models import WhatsappCredientials, WhatsappFlowDetails # Register your models here. admin.site.register(WhatsappCredientials) -admin.site.register(WhatsappFlowDetails) \ No newline at end of file +admin.site.register(WhatsappFlowDetails) diff --git a/whatsapp/apps.py b/whatsapp/apps.py index 89758820c..bf121b72c 100644 --- a/whatsapp/apps.py +++ b/whatsapp/apps.py @@ -2,14 +2,15 @@ from django.apps import AppConfig class WhatsappConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'whatsapp' + default_auto_field = "django.db.models.BigAutoField" + name = "whatsapp" def ready(self): from django.urls import include, path + from horilla.urls import urlpatterns urlpatterns.append( path("whatsapp/", include("whatsapp.urls")), ) - super().ready() \ No newline at end of file + super().ready() diff --git a/whatsapp/cbv/whatsapp.py b/whatsapp/cbv/whatsapp.py index 01b34c1b3..15162a310 100644 --- a/whatsapp/cbv/whatsapp.py +++ b/whatsapp/cbv/whatsapp.py @@ -1,7 +1,11 @@ from typing import Any + +from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render from django.urls import reverse +from django.utils.translation import gettext_lazy as _trans + from horilla_views.generic.cbv.views import ( HorillaFormView, HorillaListView, @@ -10,9 +14,6 @@ from horilla_views.generic.cbv.views import ( from whatsapp.filters import CredentialsViewFilter from whatsapp.forms import WhatsappForm from whatsapp.models import WhatsappCredientials -from django.utils.translation import gettext_lazy as _trans -from django.contrib import messages - from whatsapp.utils import send_text_message @@ -33,7 +34,7 @@ class CredentialListView(HorillaListView): row_attrs = """ id = "credential{get_instance}" """ - option_method ="get_publish_button" + option_method = "get_publish_button" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/whatsapp/encryption.py b/whatsapp/encryption.py index b5ac09fa7..e8e13ceca 100644 --- a/whatsapp/encryption.py +++ b/whatsapp/encryption.py @@ -1,13 +1,11 @@ -import json import base64 -from cryptography.hazmat.primitives import hashes -from cryptography.hazmat.primitives.asymmetric import rsa, padding -from cryptography.hazmat.primitives import serialization +import json + from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric import padding, rsa from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes - - PRIVATE_KEY = """-----BEGIN PRIVATE KEY----- MIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQCitHXNMGC04pSI di+ynQjLDQd1LrExd1nYMxdOFnX/CnVEJGVEUKPdDm5M300ULugeFPx76MsjQx97 @@ -49,14 +47,12 @@ class FlowEndpointException(Exception): def decrypt_request(body, private_pem, passphrase): # Extract encrypted data from the request body - encrypted_aes_key = body['encrypted_aes_key'] - encrypted_flow_data = body['encrypted_flow_data'] - initial_vector = body['initial_vector'] + encrypted_aes_key = body["encrypted_aes_key"] + encrypted_flow_data = body["encrypted_flow_data"] + initial_vector = body["initial_vector"] private_key = serialization.load_pem_private_key( - private_pem.encode(), - password=None, - backend=default_backend() + private_pem.encode(), password=None, backend=default_backend() ) decrypted_aes_key = private_key.decrypt( @@ -64,8 +60,8 @@ def decrypt_request(body, private_pem, passphrase): padding.OAEP( mgf=padding.MGF1(algorithm=hashes.SHA256()), algorithm=hashes.SHA256(), - label=None - ) + label=None, + ), ) flow_data_buffer = base64.b64decode(encrypted_flow_data) @@ -75,48 +71,55 @@ def decrypt_request(body, private_pem, passphrase): encrypted_flow_data_body = flow_data_buffer[:-TAG_LENGTH] encrypted_flow_data_tag = flow_data_buffer[-TAG_LENGTH:] - cipher = Cipher(algorithms.AES(decrypted_aes_key), modes.GCM(iv_buffer, encrypted_flow_data_tag), backend=default_backend()) + cipher = Cipher( + algorithms.AES(decrypted_aes_key), + modes.GCM(iv_buffer, encrypted_flow_data_tag), + backend=default_backend(), + ) decryptor = cipher.decryptor() - decrypted_json_string = decryptor.update(encrypted_flow_data_body) + decryptor.finalize() + decrypted_json_string = ( + decryptor.update(encrypted_flow_data_body) + decryptor.finalize() + ) return { - 'decrypted_body': json.loads(decrypted_json_string.decode('utf-8')), - 'aes_key_buffer': decrypted_aes_key, - 'initial_vector_buffer': iv_buffer + "decrypted_body": json.loads(decrypted_json_string.decode("utf-8")), + "aes_key_buffer": decrypted_aes_key, + "initial_vector_buffer": iv_buffer, } + def encrypt_response(response, aes_key_buffer, initial_vector_buffer): - response_bytes = json.dumps(response).encode('utf-8') + response_bytes = json.dumps(response).encode("utf-8") flipped_iv = bytearray((b ^ 0xFF) for b in initial_vector_buffer) cipher = Cipher( algorithms.AES(aes_key_buffer), modes.GCM(bytes(flipped_iv)), - backend=default_backend() + backend=default_backend(), ) encryptor = cipher.encryptor() ciphertext = encryptor.update(response_bytes) + encryptor.finalize() ciphertext_with_tag = ciphertext + encryptor.tag - encrypted_message = base64.b64encode(ciphertext_with_tag).decode('utf-8') + encrypted_message = base64.b64encode(ciphertext_with_tag).decode("utf-8") return encrypted_message + # -------------------------------------------------views.py ------------------------------------------------ import base64 import hashlib import hmac - import json import os from base64 import b64decode, b64encode -from cryptography.hazmat.primitives.asymmetric.padding import OAEP, MGF1, hashes -from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes + +from cryptography.hazmat.primitives.asymmetric.padding import MGF1, OAEP, hashes +from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives.serialization import load_pem_private_key -from django.http import HttpResponse -from django.http import JsonResponse +from django.http import HttpResponse, JsonResponse from django.views.decorators.csrf import csrf_exempt # Load the private key string @@ -278,4 +281,5 @@ def is_request_signature_valid(request, app_secret, request_body): return hmac.compare_digest(signature, hmac_digest) -# ---------------------------------------------------------------------------------------------------------- \ No newline at end of file + +# ---------------------------------------------------------------------------------------------------------- diff --git a/whatsapp/filters.py b/whatsapp/filters.py index 38d249f10..f90d000c2 100644 --- a/whatsapp/filters.py +++ b/whatsapp/filters.py @@ -1,10 +1,13 @@ import django_filters + from horilla.filters import HorillaFilterSet from whatsapp.models import WhatsappCredientials class CredentialsViewFilter(HorillaFilterSet): - search = django_filters.CharFilter(field_name="meta_phone_number", lookup_expr="icontains") + search = django_filters.CharFilter( + field_name="meta_phone_number", lookup_expr="icontains" + ) class Meta: model = WhatsappCredientials diff --git a/whatsapp/flows.py b/whatsapp/flows.py index b440cf1fe..7ba125bca 100644 --- a/whatsapp/flows.py +++ b/whatsapp/flows.py @@ -1,4 +1,5 @@ import json + from asset.models import AssetCategory from base.models import Department, EmployeeShift, JobPosition, Tags, WorkType from employee.models import Employee @@ -114,7 +115,7 @@ def get_attendance_request_json(): {"id": "1", "title": "WFH"}, {"id": "2", "title": "WFO"}, ], - } + }, }, "layout": { "type": "SingleColumnLayout", diff --git a/whatsapp/forms.py b/whatsapp/forms.py index 01f1fe65f..c978b5f58 100644 --- a/whatsapp/forms.py +++ b/whatsapp/forms.py @@ -1,5 +1,6 @@ # forms.py from typing import Any + from django.forms import ValidationError from django.template.loader import render_to_string @@ -8,13 +9,13 @@ from whatsapp.models import WhatsappCredientials class WhatsappForm(ModelForm): - cols = {"meta_token":12} + cols = {"meta_token": 12} + class Meta: model = WhatsappCredientials - fields = '__all__' + fields = "__all__" exclude = ["is_active", "created_templates"] - def as_p(self): """ Render the form fields as HTML table rows with Bootstrap styling. @@ -22,8 +23,7 @@ class WhatsappForm(ModelForm): context = {"form": self} table_html = render_to_string("horilla_form.html", context) return table_html - - + def clean(self): cleaned_data = super().clean() companies = cleaned_data.get("company_id") @@ -37,7 +37,9 @@ class WhatsappForm(ModelForm): if is_primary: if existing_primary.exists(): - raise ValidationError(f"Company '{company.company}' already has a primary credential.") + raise ValidationError( + f"Company '{company.company}' already has a primary credential." + ) else: if not existing_primary.exists(): cleaned_data["is_primary"] = True diff --git a/whatsapp/templates/whatsapp/credentials_view.html b/whatsapp/templates/whatsapp/credentials_view.html index d65689a8a..1ebc85503 100644 --- a/whatsapp/templates/whatsapp/credentials_view.html +++ b/whatsapp/templates/whatsapp/credentials_view.html @@ -1,5 +1,5 @@ -{% extends 'settings.html' %} -{% load i18n static %} +{% extends 'settings.html' %} +{% load i18n static %} {% block settings %} {% for path in style_path %} @@ -27,7 +27,7 @@ data-clicked="" style="display: none" > -
@@ -44,10 +44,10 @@ -{% endblock settings %} \ No newline at end of file +{% endblock settings %} diff --git a/whatsapp/templates/whatsapp/send_test_message_form.html b/whatsapp/templates/whatsapp/send_test_message_form.html index a01bb1f5a..65ba937ce 100644 --- a/whatsapp/templates/whatsapp/send_test_message_form.html +++ b/whatsapp/templates/whatsapp/send_test_message_form.html @@ -24,4 +24,4 @@
- \ No newline at end of file + diff --git a/whatsapp/urls.py b/whatsapp/urls.py index dec63ecc4..bbaf3c43e 100644 --- a/whatsapp/urls.py +++ b/whatsapp/urls.py @@ -1,7 +1,9 @@ from django.urls import path -from . import views + from whatsapp.cbv import whatsapp +from . import views + urlpatterns = [ path("", views.whatsapp, name="whatsapp"), path( @@ -24,7 +26,6 @@ urlpatterns = [ # views.end_point, # name="leave-request", # ), - path( "whatsapp-credential-view/", views.whatsapp_credential_view, diff --git a/whatsapp/utils.py b/whatsapp/utils.py index 70eacd599..910938f9b 100644 --- a/whatsapp/utils.py +++ b/whatsapp/utils.py @@ -1,16 +1,16 @@ -import json -import requests import inspect +import json -from django.http import QueryDict -from django.test import RequestFactory -from django.middleware.csrf import get_token -from django.utils.datastructures import MultiValueDict -from django.core.files.base import ContentFile -from django.core.files.uploadedfile import SimpleUploadedFile +import requests +from django.contrib.messages.storage.fallback import FallbackStorage from django.contrib.sessions.backends.db import SessionStore from django.contrib.sessions.middleware import SessionMiddleware -from django.contrib.messages.storage.fallback import FallbackStorage +from django.core.files.base import ContentFile +from django.core.files.uploadedfile import SimpleUploadedFile +from django.http import QueryDict +from django.middleware.csrf import get_token +from django.test import RequestFactory +from django.utils.datastructures import MultiValueDict from asset.models import AssetCategory from base.models import Company, EmployeeShift, WorkType @@ -18,11 +18,11 @@ from employee.models import Employee from horilla.horilla_middlewares import _thread_locals from whatsapp.models import WhatsappCredientials, WhatsappFlowDetails - # PERM_TOKEN = "EAAM3cI4xxBkBO6fvkk6TjpkZC0TKLeFk4YBGUp6ZBJZCmNhcjcrmcX0VMrUnvlYgnmErFWMNlZAvRfnZAboFDl4eTuuuO3a4LH8ZB5CWFuiF9GDXdHw1NYB9UCHKMBGIVsVH1GNb3JVqmcrokfq7iABRtZBPEZA3pyDPWXmkN06gu1RyfjV6hQe6cl9wvO1AgmkhLgZDZD" # META_TOKEN = "EAAM3cI4xxBkBOwevhATEliQ7GI4S2WMZCdmX lJ5wiZCu1o3xSvQUZCAlVL7scfbUXlZBkIHEbaFJGw094vR4v7CmgBtXNqy68InXJZCg9sL2ZB4ZCgORUNZCWd7o92cNzZBQ07pgj8vF0ZB4KRNQMoUVlFZAqLGA5EOLEgsXjZAbZAndiqKRUBeZA3ytpICIVuVuWPGuRTGa8lDLAgZBIwCRqhnM5oZD" # META_TOKEN = PERM_TOKEN + class CustomRequestFactory(RequestFactory): """ Custom request factory to create mock POST requests with session and messages enabled. diff --git a/whatsapp/views.py b/whatsapp/views.py index b40833bf9..bf72fe8e0 100644 --- a/whatsapp/views.py +++ b/whatsapp/views.py @@ -2,16 +2,15 @@ import json import logging import string import threading -from bs4 import BeautifulSoup +from typing import Iterable +from bs4 import BeautifulSoup +from django.contrib import messages +from django.db.models.signals import post_save +from django.dispatch import receiver from django.http.response import HttpResponse from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt -from django.dispatch import receiver -from django.db.models.signals import post_save -from django.contrib import messages - -from typing import Iterable from base.models import Announcement from employee.models import Employee @@ -40,15 +39,14 @@ from whatsapp.utils import ( reimbursement_create, send_document_message, send_flow_message, + send_image_message, send_template_message, send_text_message, - send_image_message, shift_create, update_flow, work_type_create, ) - DETAILED_FLOW = [ { "template_name": "leave", @@ -246,7 +244,7 @@ def whatsapp(request): return HttpResponse("error", status=200) -def create_generic_templates(request,id): +def create_generic_templates(request, id): """ Creates generic message templates for WhatsApp. @@ -267,9 +265,9 @@ def create_generic_templates(request,id): credential.created_templates = True credential.save() - messages.success(request,"Message templates and flows created successfully.") + messages.success(request, "Message templates and flows created successfully.") except: - messages.error(request,"Message templates and flows creation failed.") + messages.error(request, "Message templates and flows creation failed.") return HttpResponse("") @@ -305,7 +303,7 @@ def create_flows(cred_id): ) # Update flow - update_response = update_flow(flow_id, flow_json,credential.meta_token) + update_response = update_flow(flow_id, flow_json, credential.meta_token) update_response_data = update_response.json() if update_response_data.get("validation_error", {}): return HttpResponse( @@ -315,7 +313,7 @@ def create_flows(cred_id): ) # Publish flow - publish_response = publish_flow(flow_id,credential.meta_token) + publish_response = publish_flow(flow_id, credential.meta_token) publish_response_data = publish_response.json() if publish_response_data.get("error", {}): return HttpResponse(