From 2d97d9ebdf68fdfa20ae3599ea63b3938dcdd7fb Mon Sep 17 00:00:00 2001 From: Akshay-Pahuja <115891272+Akshay-Pahuja@users.noreply.github.com> Date: Sat, 9 Mar 2024 00:27:17 +0530 Subject: [PATCH] cpda and ltc forms implemented --- FusionIIIT/applications/hr2/forms.py | 48 +- FusionIIIT/applications/hr2/models.py | 88 ++ FusionIIIT/applications/hr2/urls.py | 36 + FusionIIIT/applications/hr2/views.py | 1316 ++++++++++++++++- FusionIIIT/templates/hr2Module/cpda_form.html | 197 +++ .../templates/hr2Module/cpda_form_edit.html | 175 +++ FusionIIIT/templates/hr2Module/dashboard.html | 74 + .../hr2Module/hr_admin_cpda_view.html | 97 ++ FusionIIIT/templates/hr2Module/ltc_form.html | 197 +++ .../templates/hr2Module/ltc_form_edit.html | 397 +++++ .../templates/hr2Module/view_cpda_form.html | 361 +++++ .../hr2Module/view_cpda_form_hrAdmin.html | 97 ++ .../hr2Module/view_cpda_request_hr.html | 33 + .../hr2Module/view_cpda_requests.html | 111 ++ .../templates/hr2Module/view_ltc_form.html | 507 +++++++ .../hr2Module/view_ltc_requests.html | 90 ++ 16 files changed, 3822 insertions(+), 2 deletions(-) create mode 100644 FusionIIIT/templates/hr2Module/cpda_form.html create mode 100644 FusionIIIT/templates/hr2Module/cpda_form_edit.html create mode 100644 FusionIIIT/templates/hr2Module/dashboard.html create mode 100644 FusionIIIT/templates/hr2Module/hr_admin_cpda_view.html create mode 100644 FusionIIIT/templates/hr2Module/ltc_form.html create mode 100644 FusionIIIT/templates/hr2Module/ltc_form_edit.html create mode 100644 FusionIIIT/templates/hr2Module/view_cpda_form.html create mode 100644 FusionIIIT/templates/hr2Module/view_cpda_form_hrAdmin.html create mode 100644 FusionIIIT/templates/hr2Module/view_cpda_request_hr.html create mode 100644 FusionIIIT/templates/hr2Module/view_cpda_requests.html create mode 100644 FusionIIIT/templates/hr2Module/view_ltc_form.html create mode 100644 FusionIIIT/templates/hr2Module/view_ltc_requests.html diff --git a/FusionIIIT/applications/hr2/forms.py b/FusionIIIT/applications/hr2/forms.py index d0b80b92a..148890b61 100644 --- a/FusionIIIT/applications/hr2/forms.py +++ b/FusionIIIT/applications/hr2/forms.py @@ -1,5 +1,5 @@ from django import forms -from .models import Employee, EmpConfidentialDetails, ForeignService +from .models import Employee, EmpConfidentialDetails, ForeignService , CPDAform,LTCform from applications.globals.models import ExtraInfo from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User @@ -76,3 +76,49 @@ class Meta: def __init__(self, *args, **kwargs): super(AddExtraInfo, self).__init__(*args, **kwargs) + + +class CPDAForm(forms.ModelForm): + class Meta: + model = CPDAform + fields = ['name', 'designation', 'pf_no', 'purpose', 'amount_required', + 'adjusted_pda', 'achievements_uploaded_date', 'submission_date', + 'recomm_hod_confirm', 'date_rspc_confirm', 'balance_available', + 'advance_amount_pda', 'dealing_asstt_name', 'ar_dr_name', + 'check_amount', 'dealing_asstt_ia_name', 'ar_dr_ia_name', + 'sanction_status', 'copy_to', 'id', 'employee_id'] + + # Optionally, you can add widgets here for customizing the form fields' appearance or behavior + widgets = { + 'achievements_uploaded_date': DateInput(), + 'submission_date': DateInput(), + } + + def _init_(self, *args, **kwargs): + super(CPDAForm, self)._init_(*args, **kwargs) + + + +class LTCForm(forms.ModelForm): + class Meta: + model = LTCform + fields = ['name', 'block_year', 'pf_no', 'basic_pay_salary', 'designation', + 'department_info', 'leave_availability', 'leave_start_date', 'leave_end_date', + 'date_of_leave_for_family', 'nature_of_leave', 'purpose_of_leave', 'hometown_or_not', + 'place_of_visit', 'address_during_leave', 'mode_for_vacation', + 'details_of_family_members_already_done', 'family_members_about_to_avail', + 'details_of_family_members', 'details_of_dependents', 'amount_of_advance_required', + 'certified_family_dependents', 'certified_advance', 'adjusted_month', 'date', + 'phone_number_for_contact'] + + # Optionally, you can add widgets here for customizing the form fields' appearance or behavior + widgets = { + 'leave_start_date': DateInput(), + 'leave_end_date': DateInput(), + 'date_of_leave_for_family': DateInput(), + 'date': DateInput(), + } + + + def init(self, *args, **kwargs): + super(LTCForm, self).init(*args, **kwargs) \ No newline at end of file diff --git a/FusionIIIT/applications/hr2/models.py b/FusionIIIT/applications/hr2/models.py index cf7e0ee8c..b0bc3b6d1 100644 --- a/FusionIIIT/applications/hr2/models.py +++ b/FusionIIIT/applications/hr2/models.py @@ -141,3 +141,91 @@ class WorkAssignemnt(models.Model): end_date = models.DateField(max_length=6, null=True, blank=True) job_title = models.CharField(max_length=50, default='') orders_copy = models.FileField(blank=True, null=True) + + +class CPDAform(models.Model): + id = models.AutoField(primary_key=True) + employee_id = models.IntegerField(max_length=22,null=True) + name = models.CharField(max_length=40,null=True) + designation = models.CharField(max_length=40,null=True) + pf_no = models.CharField(max_length=30,null=True) + purpose = models.CharField(max_length=40,null=True) + amount_required = models.DecimalField(max_digits=10, decimal_places=2, null=True) + adjusted_pda = models.DecimalField(max_digits=10, decimal_places=2, null=True) + achievements_uploaded_date = models.DateField(blank=True, null=True) + submission_date = models.DateField(blank=True, null=True) + recomm_hod_confirm = models.BooleanField(default=False) + date_rspc_confirm = models.BooleanField(default=False) + balance_available = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) + advance_amount_pda = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) + dealing_asstt_name = models.CharField(max_length=40, blank=True, null=True) + ar_dr_name = models.CharField(max_length=40, blank=True, null=True) + check_amount = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) + dealing_asstt_ia_name = models.CharField(max_length=40, blank=True, null=True) + ar_dr_ia_name = models.CharField(max_length=40, blank=True, null=True) + sanction_status = models.BooleanField(default=False) + copy_to = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) + + +class LTCform(models.Model): + id = models.AutoField(primary_key=True) + employee_id = models.IntegerField(max_length=22,null=True) + name = models.CharField(max_length=100, null=True) + block_year = models.CharField(max_length=100, null=True) + pf_no = models.IntegerField(max_length=22, null=True) + basic_pay_salary = models.IntegerField(max_length=10, null=True) + designation = models.CharField(max_length=50, null=True) + department_info = models.CharField(max_length=20, null=True) + leave_availability = models.BooleanField(default=False) + leave_start_date = models.DateField(max_length=6, null=True, blank=True) + leave_end_date = models.DateField(max_length=6, null=True, blank=True) + date_of_leave_for_family = models.DateField(max_length=6, null=True, blank=True) + nature_of_leave = models.TextField(null=True) + purpose_of_leave = models.TextField(null=True) + hometown_or_not = models.BooleanField(default=False, null=True) + place_of_visit = models.CharField(max_length=100, null=True, blank=True) + address_during_leave = models.TextField(null=True) + mode_for_vacation = models.BooleanField(null=True) + details_of_family_members_already_done = models.TextField(null=True) + family_members_about_to_avail = models.CharField(max_length=100, null=True) + details_of_family_members = models.TextField(null=True) + details_of_dependents = models.TextField(null=True) + amount_of_advance_required = models.IntegerField(null=True, blank=True) + certified_family_dependents = models.TextField(null=True) + certified_advance = models.TextField(null=True) + adjusted_month = models.TextField(null=True) + date = models.DateField(max_length=6, null=True) + phone_number_for_contact = models.IntegerField(max_length=100, null=True) + + + +# class LTCform(models.Model): +# id = models.AutoField(primary_key=True) +# employee_id = models.IntegerField(max_length=22,null=True) +# name = models.CharField(max_length=40, null=True) +# block_year = models.IntegerField(null=True) +# pf_no = models.IntegerField(null=True) +# basic_pay_salary = models.DecimalField(max_digits=10, decimal_places=2, null=True) +# designation = models.CharField(max_length=40, null=True) +# department_info = models.CharField(max_length=40, null=True) +# leave_availability = models.BooleanField(null=True) +# leave_start_date = models.DateField(null=True) +# leave_end_date = models.DateField(null=True) +# date_of_leave_for_family = models.DateField(null=True) +# nature_of_leave = models.CharField(max_length=40, null=True) +# purpose_of_leave = models.CharField(max_length=40, null=True) +# hometown_or_not = models.BooleanField(null=True) +# place_of_visit = models.CharField(max_length=40, null=True) +# address_during_leave = models.CharField(max_length=80, null=True) +# mode_for_vacation = models.BooleanField(null=True) +# family_members_about_to_avail = models.CharField(max_length=40, null=True) +# details_of_dependents = models.CharField(max_length=40, null=True) +# amount_of_advance_required = models.DecimalField(max_digits=10, decimal_places=2, null=True) +# certified_family_dependents = models.CharField(max_length=40, null=True) +# certified_advance = models.CharField(max_length=40, null=True) +# adjusted_month = models.CharField(max_length=40, null=True) +# date = models.DateField(null=True) +# phone_number_for_contact = models.CharField(max_length=40, null=True) +# serialNumber = models.IntegerField(null=True) # Field for serial number +# fullName = models.CharField(max_length=40, null=True) # Field for full name +# age = models.IntegerField(null=True) # Field for age diff --git a/FusionIIIT/applications/hr2/urls.py b/FusionIIIT/applications/hr2/urls.py index 56918efb7..cbdbbd4bd 100644 --- a/FusionIIIT/applications/hr2/urls.py +++ b/FusionIIIT/applications/hr2/urls.py @@ -17,5 +17,41 @@ url(r'^administrativeProfile/$', views.administrative_profile, name='administrativeProfile'), url(r'^addnew/$', views.add_new_user, name='addnew'), + url(r'dashboard/', views.dashboard, name='dashboard'), + url(r'^cpda_form/(?P\d+)/$', views.cpda_form, + name='cpdaForm'), + url(r'^view_cpda_form/(?P\d+)/$', views.view_cpda_form, + name='view_cpda_form'), + + url(r'^form_mangement_cpda/',views.form_mangement_cpda, name='form_mangement_cpda'), + url(r'^form_mangement_cpda_hr/(?P\d+)/$',views.form_mangement_cpda_hr, name='form_mangement_cpda_hr'), + url(r'^form_mangement_cpda_get_hod/',views.form_mangement_cpda_get_hod, name='form_mangement_cpda_get_hod'), + + + url(r'^form_mangement_cpda_hod/(?P\d+)/$',views.form_mangement_cpda_hod, name='form_mangement_cpda_hod'), + # url(r'^form_mangement_cpda_get_ar/',views.form_mangement_cpda_get_ar, name='form_mangement_cpda_get_ar'), + + # url(r'^form_mangement_cpda_director/(?P\d+)/$',views.form_mangement_cpda_director, name='form_mangement_cpda_director'), + url(r'^form_mangement_cpda_get_director/',views.form_mangement_cpda_get_director, name='form_mangement_cpda_get_director'), + + url(r'^ltc_form/(?P\d+)/$', views.ltc_form, + name='ltcForm'), + + url(r'^view_ltc_form/(?P\d+)/$', views.view_ltc_form, + name='view_ltc_form'), + + url(r'^form_mangement_ltc/',views.form_mangement_ltc, name='form_mangement_ltc'), + url(r'^form_mangement_ltc_hr_/(?P\d+)/$',views.form_mangement_ltc_hr, name='form_mangement_ltc_hr'), + url(r'^form_mangement_ltc_get_hod/',views.form_mangement_ltc_get_hod, name='form_mangement_ltc_get_hod'), + + + url(r'^form_mangement_ltc_hod/(?P\d+)/$',views.form_mangement_ltc_hod, name='form_mangement_ltc_hod'), + # url(r'^form_mangement_ltc_get_ar/',views.form_mangement_ltc_get_ar, name='form_mangement_ltc_get_ar'), + # url(r'^form_mangement_ltc_director/(?P\d+)/$',views.form_mangement_ltc_director, name='form_mangement_ltc_director'), + url(r'^form_mangement_ltc_get_director/',views.form_mangement_ltc_get_director, name='form_mangement_ltc_get_director'), + + + + ] diff --git a/FusionIIIT/applications/hr2/views.py b/FusionIIIT/applications/hr2/views.py index f2f9d4fcd..7a1e449ec 100644 --- a/FusionIIIT/applications/hr2/views.py +++ b/FusionIIIT/applications/hr2/views.py @@ -4,7 +4,7 @@ from applications.globals.models import * from django.db.models import Q from django.http import Http404 -from .forms import EditDetailsForm, EditConfidentialDetailsForm, EditServiceBookForm, NewUserForm, AddExtraInfo +from .forms import EditDetailsForm, EditConfidentialDetailsForm, EditServiceBookForm, NewUserForm, AddExtraInfo, CPDAForm from django.contrib import messages from applications.eis.models import * from django.http import HttpResponse, HttpResponseRedirect @@ -15,6 +15,8 @@ from html import escape from io import BytesIO import re +from applications.filetracking.sdk.methods import * +from django.views.decorators.csrf import csrf_exempt from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect @@ -315,6 +317,11 @@ def chkValidity(password): if flag ==-1: return False + +def dashboard(request): + template = 'hr2Module/new_dashboard.html' + return render(request, template) + def add_new_user(request): """ Views for edit Service Book details""" template = 'hr2Module/add_new_employee.html' @@ -374,3 +381,1310 @@ def add_new_user(request): } return render(request, template, context) + + +# def cpda_form(request, id): +# """ Views for edit details""" +# template = 'hr2Module/cpda_form.html' + +# try: +# employee = ExtraInfo.objects.get(user__id=id) +# except ExtraInfo.DoesNotExist: +# raise Http404("Employee does not exist") + +# if(employee.user_type == 'faculty'): +# if request.method == "POST": +# form = CPDAForm(request.POST) +# if form.is_valid(): +# cpda_instance = form.save(commit=False) +# cpda_instance.extra_info = employee +# cpda_instance.save() + +# print("Created Cpda Object!") + + +# uploader = "21BCS183" +# uploader_designation = "student" +# receiver = "21BCS185" +# receiver_designation = "hradmin" +# src_module = "HR" +# src_object_id = str(cpda_instance.id) +# file_extra_JSON = {"key": "value"} + +# # Create a file representing the LTC form and send it to HR admin +# file_id = create_file( +# uploader=uploader, +# uploader_designation=uploader_designation, +# receiver=receiver, +# receiver_designation=receiver_designation, +# src_module=src_module, +# src_object_id=src_object_id, +# file_extra_JSON=file_extra_JSON, +# attached_file=None # Attach any file if necessary +# ) + +# print("Sent the file to Hradmin!") + +# messages.success(request, "CPDA Form submitted successfully") + +# else: +# messages.warning(request, "Error in submitting form") +# else: +# form = CPDAForm() + +# context = {'form': form, 'employee': employee} +# return render(request, template, context) + +# def view_cpda_form(request, id): + +# cpda_request = get_object_or_404(CPDAform, id=id) +# context = { +# 'cpda_form': [cpda_request] +# } +# # print("cpda object: ", cpda_request) +# return render(request, 'hr2Module/view_cpda_form.html', context) + + +# def faculty_cpda_form_view(request, id): + +# cpda_request = get_object_or_404(CPDAform, name = id) +# context = { +# 'cpda_request': cpda_request +# } +# print("cpda object: ", cpda_request) +# return render(request, 'hr2Module/view_cpda_form.html', context) + +# def view_cpda_hr_admin(request): +# if request.method == "GET": +# # Replace the following line with your logic to retrieve the list of submitted forms +# cpda_requests = CPDAform.objects.all() # Query all CPDAform objects + +# context = { +# 'cpda_requests': cpda_requests +# } +# return render(request, 'hr2Module/view_cpda_form_hrAdmin.html', context) + + + + +# +# +# +# +# def reverse_cpda_pre_processing(cpda_form_data): +# reversed_data = {} + +# # Reverse general information +# reversed_data['name'] = [cpda_form_data['name']] +# reversed_data['block_year'] = [str(cpda_form_data['block_year'])] +# reversed_data['pf_no'] = [str(ltc_form_data['pf_no'])] +# reversed_data['basic_pay_salary'] = [str(ltc_form_data['basic_pay_salary'])] +# reversed_data['designation'] = [ltc_form_data['designation']] +# reversed_data['department_info'] = [ltc_form_data['department_info']] +# reversed_data['leave_availability'] = ['True'] if ltc_form_data['leave_availability'] else ['False'] +# reversed_data['leave_start_date'] = [ltc_form_data['leave_start_date']] +# reversed_data['leave_end_date'] = [ltc_form_data['leave_end_date']] +# reversed_data['date_of_leave_for_family'] = [ltc_form_data['date_of_leave_for_family']] +# reversed_data['nature_of_leave'] = [ltc_form_data['nature_of_leave']] +# reversed_data['purpose_of_leave'] = [ltc_form_data['purpose_of_leave']] +# reversed_data['hometown_or_not'] = ['True'] if ltc_form_data['hometown_or_not'] else ['False'] +# reversed_data['place_of_visit'] = [ltc_form_data['place_of_visit']] +# reversed_data['address_during_leave'] = [ltc_form_data['address_during_leave']] + +# # Reverse details of family members +# print("no") +# family_members = ltc_form_data['[details_of_family_members_already_done]'].split(',') +# print("ywa",family_members) +# for i, member in enumerate(family_members, start=1): +# reversed_data[f'info_{i}_1'] = [member.split(',')[0]] +# reversed_data[f'info_{i}_2'] = [member.split(',')[1]] +# reversed_data[f'info_{i}_3'] = [member.split(',')[2]] + +# # Reverse details of dependents +# dependents = ltc_form_data['details_of_dependents'].split(',') +# for i, dependent in enumerate(dependents, start=1): +# reversed_data[f'd_info_{i}_1'] = [dependent.split(',')[0]] +# reversed_data[f'd_info_{i}_2'] = [dependent.split(',')[1]] +# reversed_data[f'd_info_{i}_3'] = [dependent.split(',')[2]] +# reversed_data[f'd_info_{i}_4'] = [dependent.split(',')[3]] + +# # Reverse remaining fields +# reversed_data['amount_of_advance_required'] = [str(ltc_form_data['amount_of_advance_required'])] +# reversed_data['certified_family_dependents'] = [ltc_form_data['certified_family_dependents']] +# reversed_data['certified_advance'] = [str(ltc_form_data['certified_advance'])] +# reversed_data['adjusted_month'] = [ltc_form_data['adjusted_month']] +# reversed_data['date'] = [ltc_form_data['date']] +# reversed_data['phone_number_for_contact'] = [str(ltc_form_data['phone_number_for_contact'])] + +# return reversed_data + + + + +# def cpda_pre_processing(request): +# ltc_form_data = {} + +# # Extract general information +# ltc_form_data['name'] = request.POST.get('name') +# ltc_form_data['block_year'] = int(request.POST.get('block_year')) +# ltc_form_data['pf_no'] = int(request.POST.get('pf_no')) +# ltc_form_data['basic_pay_salary'] = int(request.POST.get('basic_pay_salary')) +# ltc_form_data['designation'] = request.POST.get('designation') +# ltc_form_data['department_info'] = request.POST.get('department_info') +# ltc_form_data['leave_availability'] = request.POST.getlist('leave_availability') == ['True', 'True'] +# ltc_form_data['leave_start_date'] = request.POST.get('leave_start_date') +# ltc_form_data['leave_end_date'] = request.POST.get('leave_end_date') +# ltc_form_data['date_of_leave_for_family'] = request.POST.get('date_of_leave_for_family') +# ltc_form_data['nature_of_leave'] = request.POST.get('nature_of_leave') +# ltc_form_data['purpose_of_leave'] = request.POST.get('purpose_of_leave') +# ltc_form_data['hometown_or_not'] = request.POST.get('hometown_or_not') == 'True' +# ltc_form_data['place_of_visit'] = request.POST.get('place_of_visit') +# ltc_form_data['address_during_leave'] = request.POST.get('address_during_leave') + +# # Extract details of family members +# family_members = [] +# for i in range(1, 7): +# if request.POST.get(f'info_{i}_1'): +# family_member = ','.join(request.POST.getlist(f'info_{i}_{j}')[0] for j in range(1, 4)) +# family_members.append(family_member) +# ltc_form_data['details_of_family_members_already_done'] = ','.join(family_members) + +# # Extract details of dependents +# dependents = [] +# for i in range(1, 7): +# if request.POST.get(f'd_info_{i}_1'): +# dependent = ','.join(request.POST.getlist(f'd_info_{i}_{j}')[0] for j in range(1, 5)) +# dependents.append(dependent) +# ltc_form_data['details_of_dependents'] = ','.join(dependents) + +# # Extract remaining fields +# ltc_form_data['amount_of_advance_required'] = int(request.POST.get('amount_of_advance_required')) +# ltc_form_data['certified_family_dependents'] = request.POST.get('certified_family_dependents') +# ltc_form_data['certified_advance'] = int(request.POST.get('certified_advance')) +# ltc_form_data['adjusted_month'] = request.POST.get('adjusted_month') +# ltc_form_data['date'] = request.POST.get('date') +# ltc_form_data['phone_number_for_contact'] = int(request.POST.get('phone_number_for_contact')) + +# return ltc_form_data + + + +def cpda_form(request, id): + """ Views for edit details""" + try: + employee = ExtraInfo.objects.get(user__id=id) + except: + raise Http404("Employee does not exist! id doesnt exist") + + print(employee.user_type) + + + if(employee.user_type == 'faculty'): + template = 'hr2Module/cpda_form.html' + + if request.method == "POST": + try: + print("Creating cpda object!") + + # print(ltc_pre_processing(request)) + sanction_status_str = request.POST.get('sanction_status') + if sanction_status_str.lower() == 'true': + sanction_status = True + elif sanction_status_str.lower() == 'false': + sanction_status = False + else: + # Handle invalid value here, maybe raise an error or set a default value + sanction_status = False # Setting a default value of False + + + # ltc_form_data = ltc_pre_processing(request) + name = request.POST.get('name') + designation = request.POST.get('designation') + pf_no = request.POST.get('pf_no') + purpose = request.POST.get('purpose') + amount_required = request.POST.get('amount_required') + adjusted_pda = request.POST.get('adjusted_pda') + achievements_uploaded_date = request.POST.get('achievements_uploaded_date') + submission_date = request.POST.get('submission_date') + recomm_hod_confirm = request.POST.get('recomm_hod_confirm') + date_rspc_confirm = request.POST.get('date_rspc_confirm') + balance_available = request.POST.get('balance_available') + advance_amount_pda = request.POST.get('advance_amount_pda') + dealing_asstt_name = request.POST.get('dealing_asstt_name') + ar_dr_name = request.POST.get('ar_dr_name') + check_amount = request.POST.get('check_amount') + dealing_asstt_ia_name = request.POST.get('dealing_asstt_ia_name') + ar_dr_ia_name = request.POST.get('ar_dr_ia_name') + # sanction_status = request.POST.get('sanction_status') + copy_to = request.POST.get('copy_to') + + cpda_form = CPDAform.objects.create( + # id=id, + name=name, + designation=designation, + pf_no=pf_no, + purpose=purpose, + amount_required=amount_required, + adjusted_pda=adjusted_pda, + achievements_uploaded_date=achievements_uploaded_date, + submission_date=submission_date, + recomm_hod_confirm=recomm_hod_confirm, + date_rspc_confirm=date_rspc_confirm, + balance_available=balance_available, + advance_amount_pda=advance_amount_pda, + dealing_asstt_name=dealing_asstt_name, + ar_dr_name=ar_dr_name, + check_amount=check_amount, + dealing_asstt_ia_name=dealing_asstt_ia_name, + ar_dr_ia_name=ar_dr_ia_name, + sanction_status=sanction_status, + copy_to=copy_to + ) + + print("Created Cpda Object!") + + + uploader = "21BCS183" + uploader_designation = "student" + receiver = "21BCS185" + receiver_designation = "hradmin" + src_module = "HR" + src_object_id = str(cpda_form.id) + file_extra_JSON = {"key": "value"} + + # Create a file representing the LTC form and send it to HR admin + file_id = create_file( + uploader=uploader, + uploader_designation=uploader_designation, + receiver=receiver, + receiver_designation=receiver_designation, + src_module=src_module, + src_object_id=src_object_id, + file_extra_JSON=file_extra_JSON, + attached_file=None # Attach any file if necessary + ) + print("Sent the file to Hradmin!") + + messages.success(request, "CPDA form filled successfully") + + except Exception as e: + print("error" , e) + messages.warning(request, "Fill not correctly") + context = {'employee': employee} + return render(request, template, context) + + + + # Query all CPDA requests + name = "aojha" + cpda_requests = CPDAform.objects.filter(name=name) + + context = {'employee': employee, 'cpda_requests': cpda_requests} + + return render(request, template, context) + else: + return render(request, 'hr2Module/edit.html') + +# def view_ltc_form(request, id): +# ltc_request = get_object_or_404(LTCform, id=id) + + # # Preprocessing data + # family_mem_a = ltc_form.family_members_about_to_avail.split(',')[0].strip() if ltc_form.family_members_about_to_avail else '' + # family_mem_b = ltc_form.family_members_about_to_avail.split(',')[1].strip() if ltc_form.family_members_about_to_avail else '' + # family_mem_c = ltc_form.family_members_about_to_avail.split(',')[2].strip() if ltc_form.family_members_about_to_avail else '' + # ltc_form.details_of_family_members_already_done = ', '.join(filter(None, [family_mem_a, family_mem_b, family_mem_c])) + + # family_members = [] + # for i in range(1, 7): + # name = getattr(ltc_form, f'info_{i}_2', '') + # age = getattr(ltc_form, f'info_{i}_3', '') + # if name and age: + # family_members.append(f"{name} ({age} years)") + # ltc_form.family_members_about_to_avail = ', '.join(family_members) + + # dependents = [] + # for i in range(1, 7): + # name = getattr(ltc_form, f'd_info_{i}_2', '') + # age = getattr(ltc_form, f'd_info_{i}_3', '') + # why_dependent = getattr(ltc_form, f'd_info_{i}_4', '') + # if name and age: + # dependents.append(f"{name} ({age} years), {why_dependent}") + # ltc_form.details_of_dependents = ', '.join(dependents) + + + # context = { + # 'ltc_form': [ltc_request] + # } + + +# def view_ltc_form(request, id): + +# ltc_request = get_object_or_404(LTCform, id=id) +# context = { +# 'ltc_form': [ltc_request] +# } + +# return render(request, 'hr2Module/view_ltc_form.html', context) + + +def view_cpda_form(request, id): + + cpda_request = get_object_or_404(CPDAform, id=id) + + # print("cpda object: ", cpda_request) + # print(cpda_request['details_of_family_members_already_done']) + # print("cpda object: ", reverse_cpda_pre_processing(cpda_request)) + # cpda_request = reverse_cpda_pre_processing(cpda_request) + + # print(cpda_request) + + context = { + + # 'name' : cpda_request.name, + # 'pf_no': cpda_request.pf_no, + # 'designation': cpda_request.designation, + # 'purpose': cpda_request.purpose, + # 'amount_required': cpda_request.amount_required, + # 'adjusted_pda': cpda_request.adjusted_pda, + # 'achievements_uploaded_date': cpda_request.achievements_uploaded_date, + # 'submission_date': cpda_request.submission_date, + # 'recomm_hod_confirm': cpda_request.recomm_hod_confirm, + # 'date_rspc_confirm': cpda_request.date_rspc_confirm, + # 'balance_available': cpda_request.balance_available, + # 'advance_amount_pda': cpda_request.advance_amount_pda, + # 'dealing_asstt_name': cpda_request.dealing_asstt_name, + # 'ar_dr_name': cpda_request.ar_dr_name, + # 'check_amount': cpda_request.check_amount, + # 'dealing_asstt_ia_name': cpda_request.dealing_asstt_ia_name, + # 'ar_dr_ia_name': cpda_request.ar_dr_ia_name, + # 'sanction_status': cpda_request.sanction_status, + # 'copy_to': cpda_request.copy_to, + # 'id': cpda_request.id, + + 'cpda_form' : [cpda_request] + } + + return render(request, 'hr2Module/view_cpda_form.html',context) + +# def reverse_cpda_pre_processing(cpda_form_data): +# reversed_data = {} + +# # Reverse general information +# reversed_data['name'] = [cpda_form_data.name] +# reversed_data['block_year'] = [str(cpda_form_data.block_year)] +# reversed_data['pf_no'] = [str(cpda_form_data.pf_no)] +# reversed_data['basic_pay_salary'] = [str(cpda_form_data.basic_pay_salary)] +# reversed_data['designation'] = [cpda_form_data.designation] +# reversed_data['department_info'] = [cpda_form_data.department_info] +# reversed_data['leave_availability'] = ['True'] if cpda_form_data.leave_availability else ['False'] +# reversed_data['leave_start_date'] = [cpda_form_data.leave_start_date] +# reversed_data['leave_end_date'] = [cpda_form_data.leave_end_date] +# reversed_data['date_of_leave_for_family'] = [cpda_form_data.date_of_leave_for_family] +# reversed_data['nature_of_leave'] = [cpda_form_data.nature_of_leave] +# reversed_data['purpose_of_leave'] = [cpda_form_data.purpose_of_leave] +# reversed_data['hometown_or_not'] = ['True'] if cpda_form_data.hometown_or_not else ['False'] +# reversed_data['place_of_visit'] = [cpda_form_data.place_of_visit] +# reversed_data['address_during_leave'] = [cpda_form_data.address_during_leave] + +# # Reverse details of family members +# family_members = cpda_form_data.details_of_family_members_already_done.split(',') + +# count = 0 + +# for i in range(1, 7): +# if(len(family_members) > count+3): +# reversed_data[f'info_{i}_1'] = [family_members[count]] +# reversed_data[f'info_{i}_2'] = [family_members[count+1]] +# reversed_data[f'info_{i}_3'] = [family_members[count+2]] +# count+=3 +# else: +# reversed_data[f'info_{i}_1'] = [''] +# reversed_data[f'info_{i}_2'] = [''] +# reversed_data[f'info_{i}_3'] = [''] +# count+=3 + +# # for i, member in enumerate(family_members, start=1): +# # if member: +# # reversed_data[f'info_{i}_1'] = [member.split(',')[0]] +# # reversed_data[f'info_{i}_2'] = [member.split(',')[1]] +# # reversed_data[f'info_{i}_3'] = [member.split(',')[2]] +# # else: +# # # If family member information is not provided, use empty strings +# # reversed_data[f'info_{i}_1'] = [''] +# # reversed_data[f'info_{i}_2'] = [''] +# # reversed_data[f'info_{i}_3'] = [''] + +# # Reverse details of dependents +# dependents = cpda_form_data.details_of_dependents.split(',') + +# count=0 + +# for i in range(1, 7): +# if(len(dependents) > count+4): +# reversed_data[f'd_info_{i}_1'] = [dependents[count]] +# reversed_data[f'd_info_{i}_2'] = [dependents[count+1]] +# reversed_data[f'd_info_{i}_3'] = [dependents[count+2]] +# reversed_data[f'd_info_{i}_4'] = [dependents[count+3]] +# count+=4 +# else: +# reversed_data[f'd_info_{i}_1'] = [''] +# reversed_data[f'd_info_{i}_2'] = [''] +# reversed_data[f'd_info_{i}_3'] = [''] +# reversed_data[f'd_info_{i}_4'] = [''] +# count+=4 + + +# # for i, dependent in enumerate(dependents, start=1): +# # if dependent: +# # reversed_data[f'd_info_{i}_1'] = [dependent.split(',')[0]] +# # reversed_data[f'd_info_{i}_2'] = [dependent.split(',')[1]] +# # reversed_data[f'd_info_{i}_3'] = [dependent.split(',')[2]] +# # reversed_data[f'd_info_{i}_4'] = [dependent.split(',')[3]] +# # else: +# # # If dependent information is not provided, use empty strings +# # reversed_data[f'd_info_{i}_1'] = [''] +# # reversed_data[f'd_info_{i}_2'] = [''] +# # reversed_data[f'd_info_{i}_3'] = [''] +# # reversed_data[f'd_info_{i}_4'] = [''] + +# # Reverse remaining fields +# reversed_data['amount_of_advance_required'] = [str(cpda_form_data.amount_of_advance_required)] +# reversed_data['certified_family_dependents'] = [cpda_form_data.certified_family_dependents] +# reversed_data['certified_advance'] = [str(cpda_form_data.certified_advance)] +# reversed_data['adjusted_month'] = [cpda_form_data.adjusted_month] +# reversed_data['date'] = [cpda_form_data.date] +# reversed_data['phone_number_for_contact'] = [str(cpda_form_data.phone_number_for_contact)] + +# return reversed_data + +# hr admin get +def form_mangement_cpda(request): + if(request.method == "GET"): + username = "21BCS185" + designation = "hradmin" + inbox = view_inbox(username = username, designation = designation, src_module = "HR") + + # print(inbox) + + # Extract src_object_id values + src_object_ids = [item['src_object_id'] for item in inbox] + print(src_object_ids) + + # src_object_ids = [14,15,19] + + cpda_requests = [] + + for src_object_id in src_object_ids: + cpda_request = get_object_or_404(CPDAform, id=src_object_id) + cpda_requests.append(cpda_request) + + context= { + 'cpda_requests' : cpda_requests, + 'hr' : "1", + 'dire': "1", + } + + print(cpda_requests[0].name) + + return render(request, 'hr2Module/cpda_form.html',context) + +def form_mangement_cpda_hr(request,id): + print("Request of forward!") + uploader = "21BCS183" + uploader_designation = "student" + receiver = "21BCS181" + receiver_designation = "HOD" + src_module = "HR" + src_object_id = id, + file_extra_JSON = {"key": "value"} + + # Create a file representing the cpda form and send it to HR admin + file_id = create_file( + uploader=uploader, + uploader_designation=uploader_designation, + receiver=receiver, + receiver_designation=receiver_designation, + src_module=src_module, + src_object_id=src_object_id, + file_extra_JSON=file_extra_JSON, + attached_file=None # Attach any file if necessary + ) + + print("Sent the file to Hod!") + + messages.success(request, "cpda form filled successfully") + + return HttpResponse("Sucess") +# hod ne get kiya +def form_mangement_cpda_get_hod(request): + if request.method == "GET": + username = "21BCS181" + designation = "HOD" + inbox = view_inbox(username=username, designation=designation, src_module="HR") + + # Extract src_object_id values + # src_object_ids = [(item['src_object_id']) for item in inbox] + + src_object_ids = [] + for item in inbox: + src_object_ids.append(int(item['src_object_id'][2:3])) + + print(src_object_ids) + + cpda_requests = [] + + for src_object_id in src_object_ids: + cpda_request = get_object_or_404(CPDAform, id=src_object_id) + cpda_requests.append(cpda_request) + + context = { + 'cpda_requests': cpda_requests, + 'hr': "1", + 'user_designation': designation, + 'dire': "1", + } + + print(cpda_requests[0].name) + + return render(request, 'hr2Module/cpda_form.html', context) + + +def form_mangement_cpda_hod(request,id): + print("Request of forward!") + uploader = "21BCS183" + uploader_designation = "student" + receiver = "21BCS017" + # isko sahi krna h + receiver_designation = "Director" + src_module = "HR" + src_object_id = id, + file_extra_JSON = {"key": "value"} + + # Create a file representing the cpda form and send it to HR admin + file_id = create_file( + uploader=uploader, + uploader_designation=uploader_designation, + receiver=receiver, + receiver_designation=receiver_designation, + src_module=src_module, + src_object_id=src_object_id, + file_extra_JSON=file_extra_JSON, + attached_file=None # Attach any file if necessary + ) + + print("Sent the file to Director!") + + messages.success(request, "cpda form filled successfully") + + return HttpResponse("Success") + +# def form_mangement_cpda_get_ar(request): +# if request.method == "GET": +# username = "21BCS187" +# # isko bhi sahi krna h +# designation = "Dealing Assistant" +# inbox = view_inbox(username=username, designation=designation, src_module="HR") + +# # Extract src_object_id values +# # src_object_ids = [(item['src_object_id']) for item in inbox] + +# src_object_ids = [] +# for item in inbox: +# src_object_ids.append(int(item['src_object_id'][2:4])) + +# print(src_object_ids) + +# ltc_requests = [] + +# for src_object_id in src_object_ids: +# ltc_request = get_object_or_404(LTCform, id=src_object_id) +# ltc_requests.append(ltc_request) + +# context = { +# 'ltc_requests': ltc_requests, +# 'hr': "1", +# } + +# print(ltc_requests[0].name) + +# return render(request, 'hr2Module/ltc_form.html', context) + +def form_mangement_cpda_director(request,id): + print("Request of forward!") + uploader = "21BCS187" + uploader_designation = "student" + receiver = "21BCS017" + # isko sahi krna h + receiver_designation = "AR/DR" + src_module = "HR" + src_object_id = id, + file_extra_JSON = {"key": "value"} + + # Create a file representing the cpda form and send it to HR admin + file_id = create_file( + uploader=uploader, + uploader_designation=uploader_designation, + receiver=receiver, + receiver_designation=receiver_designation, + src_module=src_module, + src_object_id=src_object_id, + file_extra_JSON=file_extra_JSON, + attached_file=None # Attach any file if necessary + ) + + print("Sent the file to AR/DR!") + + messages.success(request, "cpda form filled successfully") + + return HttpResponse("Sucess") + +def form_mangement_cpda_get_director(request): + if request.method == "GET": + username = "21BCS017" + # isko bhi sahi krna h + designation = "Director" + inbox = view_inbox(username=username, designation=designation, src_module="HR") + + # Extract src_object_id values + # src_object_ids = [(item['src_object_id']) for item in inbox] + + # src_object_ids = [19] + + src_object_ids = [] + for item in inbox: + src_object_ids.append(int(item['src_object_id'][2:3])) + + print(src_object_ids) + + cpda_requests = [] + + for src_object_id in src_object_ids: + cpda_request = get_object_or_404(CPDAform, id=src_object_id) + cpda_requests.append(cpda_request) + + context = { + 'cpda_requests': cpda_requests, + 'hr': "1", + 'dire': "2" + } + + print(cpda_requests[0].name) + + return render(request, 'hr2Module/cpda_form.html', context) + + +def reverse_ltc_pre_processing(ltc_form_data): + reversed_data = {} + + # Reverse general information + reversed_data['name'] = [ltc_form_data['name']] + reversed_data['block_year'] = [str(ltc_form_data['block_year'])] + reversed_data['pf_no'] = [str(ltc_form_data['pf_no'])] + reversed_data['basic_pay_salary'] = [str(ltc_form_data['basic_pay_salary'])] + reversed_data['designation'] = [ltc_form_data['designation']] + reversed_data['department_info'] = [ltc_form_data['department_info']] + reversed_data['leave_availability'] = ['True'] if ltc_form_data['leave_availability'] else ['False'] + reversed_data['leave_start_date'] = [ltc_form_data['leave_start_date']] + reversed_data['leave_end_date'] = [ltc_form_data['leave_end_date']] + reversed_data['date_of_leave_for_family'] = [ltc_form_data['date_of_leave_for_family']] + reversed_data['nature_of_leave'] = [ltc_form_data['nature_of_leave']] + reversed_data['purpose_of_leave'] = [ltc_form_data['purpose_of_leave']] + reversed_data['hometown_or_not'] = ['True'] if ltc_form_data['hometown_or_not'] else ['False'] + reversed_data['place_of_visit'] = [ltc_form_data['place_of_visit']] + reversed_data['address_during_leave'] = [ltc_form_data['address_during_leave']] + # reversed_data['serialNumber'] = [ltc_form_data['serialNumber']] + # reversed_data['fullName'] = [ltc_form_data['fullName']] + # reversed_data['age'] = [ltc_form_data['age']] + + # Reverse details of family members + print("no") + family_members = ltc_form_data['[details_of_family_members_already_done]'].split(',') + print("ywa",family_members) + for i, member in enumerate(family_members, start=1): + reversed_data[f'info_{i}_1'] = [member.split(',')[0]] + reversed_data[f'info_{i}_2'] = [member.split(',')[1]] + reversed_data[f'info_{i}_3'] = [member.split(',')[2]] + + # Reverse details of dependents + dependents = ltc_form_data['details_of_dependents'].split(',') + for i, dependent in enumerate(dependents, start=1): + reversed_data[f'd_info_{i}_1'] = [dependent.split(',')[0]] + reversed_data[f'd_info_{i}_2'] = [dependent.split(',')[1]] + reversed_data[f'd_info_{i}_3'] = [dependent.split(',')[2]] + reversed_data[f'd_info_{i}_4'] = [dependent.split(',')[3]] + + # Reverse remaining fields + reversed_data['amount_of_advance_required'] = [str(ltc_form_data['amount_of_advance_required'])] + reversed_data['certified_family_dependents'] = [ltc_form_data['certified_family_dependents']] + reversed_data['certified_advance'] = [str(ltc_form_data['certified_advance'])] + reversed_data['adjusted_month'] = [ltc_form_data['adjusted_month']] + reversed_data['date'] = [ltc_form_data['date']] + reversed_data['phone_number_for_contact'] = [str(ltc_form_data['phone_number_for_contact'])] + + return reversed_data + + + + +def ltc_pre_processing(request): + ltc_form_data = {} + + # Extract general information + ltc_form_data['name'] = request.POST.get('name') + ltc_form_data['block_year'] = int(request.POST.get('block_year')) + ltc_form_data['pf_no'] = int(request.POST.get('pf_no')) + ltc_form_data['basic_pay_salary'] = int(request.POST.get('basic_pay_salary')) + ltc_form_data['designation'] = request.POST.get('designation') + ltc_form_data['department_info'] = request.POST.get('department_info') + ltc_form_data['leave_availability'] = request.POST.getlist('leave_availability') == ['True', 'True'] + ltc_form_data['leave_start_date'] = request.POST.get('leave_start_date') + ltc_form_data['leave_end_date'] = request.POST.get('leave_end_date') + ltc_form_data['date_of_leave_for_family'] = request.POST.get('date_of_leave_for_family') + ltc_form_data['nature_of_leave'] = request.POST.get('nature_of_leave') + ltc_form_data['purpose_of_leave'] = request.POST.get('purpose_of_leave') + ltc_form_data['hometown_or_not'] = request.POST.get('hometown_or_not') == 'True' + ltc_form_data['place_of_visit'] = request.POST.get('place_of_visit') + ltc_form_data['address_during_leave'] = request.POST.get('address_during_leave') + # ltc_form_data['serialNumber'] = request.POST.get('serialNumber') + # ltc_form_data['fullName'] = request.POST.get('fullName') + # ltc_form_data['age'] = request.POST.get('age') + + # Extract details of family members + family_members = [] + for i in range(1, 7): + if request.POST.get(f'info_{i}_1'): + family_member = ','.join(request.POST.getlist(f'info_{i}_{j}')[0] for j in range(1, 4)) + family_members.append(family_member) + ltc_form_data['details_of_family_members_already_done'] = ','.join(family_members) + + # Extract details of dependents + dependents = [] + for i in range(1, 7): + if request.POST.get(f'd_info_{i}_1'): + dependent = ','.join(request.POST.getlist(f'd_info_{i}_{j}')[0] for j in range(1, 5)) + dependents.append(dependent) + ltc_form_data['details_of_dependents'] = ','.join(dependents) + + # Extract remaining fields + ltc_form_data['amount_of_advance_required'] = int(request.POST.get('amount_of_advance_required')) + ltc_form_data['certified_family_dependents'] = request.POST.get('certified_family_dependents') + ltc_form_data['certified_advance'] = int(request.POST.get('certified_advance')) + ltc_form_data['adjusted_month'] = request.POST.get('adjusted_month') + ltc_form_data['date'] = request.POST.get('date') + ltc_form_data['phone_number_for_contact'] = int(request.POST.get('phone_number_for_contact')) + + return ltc_form_data + +@csrf_exempt +def ltc_form(request): + if request.method == "POST": + data = json.loads(request.body) + for item in data: + LTCform.objects.create( + serial_number=item['serialNumber'], + full_name=item['fullName'], + age=item['age'] + ) + return JsonResponse({'message': 'Data saved successfully'}) + else: + return JsonResponse({'error': 'Invalid request method'}) + + +def ltc_form(request, id): + """ Views for edit details""" + try: + employee = ExtraInfo.objects.get(user__id=id) + except: + raise Http404("Employee does not exist! id doesnt exist") + + print(employee.user_type) + + + if(employee.user_type == 'faculty'): + template = 'hr2Module/ltc_form.html' + + if request.method == "POST": + try: + print("Creating ltc object!") + + print(ltc_pre_processing(request)) + + + ltc_form_data = ltc_pre_processing(request) + + ltc_form = LTCform.objects.create( + employee_id=id, + name=ltc_form_data['name'], + block_year=ltc_form_data['block_year'], + pf_no=ltc_form_data['pf_no'], + basic_pay_salary=ltc_form_data['basic_pay_salary'], + designation=ltc_form_data['designation'], + department_info=ltc_form_data['department_info'], + leave_availability=ltc_form_data['leave_availability'], + leave_start_date=ltc_form_data['leave_start_date'], + leave_end_date=ltc_form_data['leave_end_date'], + date_of_leave_for_family=ltc_form_data['date_of_leave_for_family'], + nature_of_leave=ltc_form_data['nature_of_leave'], + purpose_of_leave=ltc_form_data['purpose_of_leave'], + hometown_or_not=ltc_form_data['hometown_or_not'], + place_of_visit=ltc_form_data['place_of_visit'], + address_during_leave=ltc_form_data['address_during_leave'], + details_of_family_members_already_done=ltc_form_data['details_of_family_members_already_done'], + details_of_dependents=ltc_form_data['details_of_dependents'], + amount_of_advance_required=ltc_form_data['amount_of_advance_required'], + certified_family_dependents=ltc_form_data['certified_family_dependents'], + certified_advance=ltc_form_data['certified_advance'], + adjusted_month=ltc_form_data['adjusted_month'], + date=ltc_form_data['date'], + phone_number_for_contact=ltc_form_data['phone_number_for_contact'], + # serialNumber=ltc_form_data['serialNumber'], + # fullName=ltc_form_data['fullName'], + # age=ltc_form_data['age'] + ) + + print("Created Ltc Object!") + + + uploader = "21BCS183" + uploader_designation = "student" + receiver = "21BCS185" + receiver_designation = "hradmin" + src_module = "HR_ltc" + src_object_id = str(ltc_form.id) + file_extra_JSON = {"key": "value"} + + # Create a file representing the LTC form and send it to HR admin + file_id = create_file( + uploader=uploader, + uploader_designation=uploader_designation, + receiver=receiver, + receiver_designation=receiver_designation, + src_module=src_module, + src_object_id=src_object_id, + file_extra_JSON=file_extra_JSON, + attached_file=None # Attach any file if necessary + ) + + print("Sent the file to Hradmin!") + + messages.success(request, "Ltc form filled successfully") + + except Exception as e: + print("error" , e) + messages.warning(request, "Fill not correctly") + context = {'employee': employee} + return render(request, template, context) + + + + # Query all LTC requests + ltc_requests = LTCform.objects.filter(employee_id=id) + + context = {'employee': employee, 'ltc_requests': ltc_requests} + + return render(request, template, context) + else: + return render(request, 'hr2Module/edit.html') + +# def view_ltc_form(request, id): +# ltc_request = get_object_or_404(LTCform, id=id) + + # # Preprocessing data + # family_mem_a = ltc_form.family_members_about_to_avail.split(',')[0].strip() if ltc_form.family_members_about_to_avail else '' + # family_mem_b = ltc_form.family_members_about_to_avail.split(',')[1].strip() if ltc_form.family_members_about_to_avail else '' + # family_mem_c = ltc_form.family_members_about_to_avail.split(',')[2].strip() if ltc_form.family_members_about_to_avail else '' + # ltc_form.details_of_family_members_already_done = ', '.join(filter(None, [family_mem_a, family_mem_b, family_mem_c])) + + # family_members = [] + # for i in range(1, 7): + # name = getattr(ltc_form, f'info_{i}_2', '') + # age = getattr(ltc_form, f'info_{i}_3', '') + # if name and age: + # family_members.append(f"{name} ({age} years)") + # ltc_form.family_members_about_to_avail = ', '.join(family_members) + + # dependents = [] + # for i in range(1, 7): + # name = getattr(ltc_form, f'd_info_{i}_2', '') + # age = getattr(ltc_form, f'd_info_{i}_3', '') + # why_dependent = getattr(ltc_form, f'd_info_{i}_4', '') + # if name and age: + # dependents.append(f"{name} ({age} years), {why_dependent}") + # ltc_form.details_of_dependents = ', '.join(dependents) + + + # context = { + # 'ltc_form': [ltc_request] + # } + + +# def view_ltc_form(request, id): + +# ltc_request = get_object_or_404(LTCform, id=id) +# context = { +# 'ltc_form': [ltc_request] +# } + +# return render(request, 'hr2Module/view_ltc_form.html', context) + + +def view_ltc_form(request, id): + + ltc_request = get_object_or_404(LTCform, id=id) + + # print("ltc object: ", ltc_request) + # print(ltc_request['details_of_family_members_already_done']) + # print("ltc object: ", reverse_ltc_pre_processing(ltc_request)) + ltc_request = reverse_ltc_pre_processing(ltc_request) + + print(ltc_request) + + context = { + 'block_year' : ltc_request["block_year"][0], + 'pf_no': ltc_request["pf_no"][0], + 'designation': ltc_request["designation"][0], + 'name': ltc_request["name"][0], + 'basic_pay_salary': ltc_request["basic_pay_salary"][0], + 'department_info': ltc_request["department_info"][0], + 'date_of_leave_for_family': ltc_request["date_of_leave_for_family"][0], + 'leave_end_date': ltc_request["leave_end_date"][0], + 'leave_start_date': ltc_request["leave_start_date"][0], + 'nature_of_leave': ltc_request["nature_of_leave"][0], + 'purpose_of_leave': ltc_request["purpose_of_leave"][0], + 'place_of_visit': ltc_request["place_of_visit"][0], + 'address_during_leave': ltc_request["address_during_leave"][0], + + + 'details_of_family_members_already_done': ltc_request["name"][0], + + 'info_1_2': ltc_request["info_1_2"][0], + + 'info_1_1': ltc_request["info_1_1"][0], + + 'amount_of_advance_required': ltc_request["amount_of_advance_required"][0], + 'certified_family_dependents': ltc_request["certified_family_dependents"][0], + 'certified_advance': ltc_request["certified_advance"][0], + 'date': ltc_request["date"][0], + 'adjusted_month': ltc_request["adjusted_month"][0], + 'phone_number_for_contact': ltc_request["phone_number_for_contact"][0], + + + 'ltc_form' : ltc_request + } + + return render(request, 'hr2Module/view_ltc_form.html',context) + +def reverse_ltc_pre_processing(ltc_form_data): + reversed_data = {} + + # Reverse general information + reversed_data['name'] = [ltc_form_data.name] + reversed_data['block_year'] = [str(ltc_form_data.block_year)] + reversed_data['pf_no'] = [str(ltc_form_data.pf_no)] + reversed_data['basic_pay_salary'] = [str(ltc_form_data.basic_pay_salary)] + reversed_data['designation'] = [ltc_form_data.designation] + reversed_data['department_info'] = [ltc_form_data.department_info] + reversed_data['leave_availability'] = ['True'] if ltc_form_data.leave_availability else ['False'] + reversed_data['leave_start_date'] = [ltc_form_data.leave_start_date] + reversed_data['leave_end_date'] = [ltc_form_data.leave_end_date] + reversed_data['date_of_leave_for_family'] = [ltc_form_data.date_of_leave_for_family] + reversed_data['nature_of_leave'] = [ltc_form_data.nature_of_leave] + reversed_data['purpose_of_leave'] = [ltc_form_data.purpose_of_leave] + reversed_data['hometown_or_not'] = ['True'] if ltc_form_data.hometown_or_not else ['False'] + reversed_data['place_of_visit'] = [ltc_form_data.place_of_visit] + reversed_data['address_during_leave'] = [ltc_form_data.address_during_leave] + + # Reverse details of family members + family_members = ltc_form_data.details_of_family_members_already_done.split(',') + + count = 0 + + for i in range(1, 7): + if(len(family_members) > count+3): + reversed_data[f'info_{i}_1'] = [family_members[count]] + reversed_data[f'info_{i}_2'] = [family_members[count+1]] + reversed_data[f'info_{i}_3'] = [family_members[count+2]] + count+=3 + else: + reversed_data[f'info_{i}_1'] = [''] + reversed_data[f'info_{i}_2'] = [''] + reversed_data[f'info_{i}_3'] = [''] + count+=3 + + # for i, member in enumerate(family_members, start=1): + # if member: + # reversed_data[f'info_{i}_1'] = [member.split(',')[0]] + # reversed_data[f'info_{i}_2'] = [member.split(',')[1]] + # reversed_data[f'info_{i}_3'] = [member.split(',')[2]] + # else: + # # If family member information is not provided, use empty strings + # reversed_data[f'info_{i}_1'] = [''] + # reversed_data[f'info_{i}_2'] = [''] + # reversed_data[f'info_{i}_3'] = [''] + + # Reverse details of dependents + dependents = ltc_form_data.details_of_dependents.split(',') + + count=0 + + for i in range(1, 7): + if(len(dependents) > count+4): + reversed_data[f'd_info_{i}_1'] = [dependents[count]] + reversed_data[f'd_info_{i}_2'] = [dependents[count+1]] + reversed_data[f'd_info_{i}_3'] = [dependents[count+2]] + reversed_data[f'd_info_{i}_4'] = [dependents[count+3]] + count+=4 + else: + reversed_data[f'd_info_{i}_1'] = [''] + reversed_data[f'd_info_{i}_2'] = [''] + reversed_data[f'd_info_{i}_3'] = [''] + reversed_data[f'd_info_{i}_4'] = [''] + count+=4 + + + # for i, dependent in enumerate(dependents, start=1): + # if dependent: + # reversed_data[f'd_info_{i}_1'] = [dependent.split(',')[0]] + # reversed_data[f'd_info_{i}_2'] = [dependent.split(',')[1]] + # reversed_data[f'd_info_{i}_3'] = [dependent.split(',')[2]] + # reversed_data[f'd_info_{i}_4'] = [dependent.split(',')[3]] + # else: + # # If dependent information is not provided, use empty strings + # reversed_data[f'd_info_{i}_1'] = [''] + # reversed_data[f'd_info_{i}_2'] = [''] + # reversed_data[f'd_info_{i}_3'] = [''] + # reversed_data[f'd_info_{i}_4'] = [''] + + # Reverse remaining fields + reversed_data['amount_of_advance_required'] = [str(ltc_form_data.amount_of_advance_required)] + reversed_data['certified_family_dependents'] = [ltc_form_data.certified_family_dependents] + reversed_data['certified_advance'] = [str(ltc_form_data.certified_advance)] + reversed_data['adjusted_month'] = [ltc_form_data.adjusted_month] + reversed_data['date'] = [ltc_form_data.date] + reversed_data['phone_number_for_contact'] = [str(ltc_form_data.phone_number_for_contact)] + + return reversed_data + +# hr admin get +def form_mangement_ltc(request): + if(request.method == "GET"): + username = "21BCS185" + designation = "hradmin" + inbox = view_inbox(username = username, designation = designation, src_module = "HR_ltc") + + # print(inbox) + + # Extract src_object_id values + src_object_ids = [item['src_object_id'] for item in inbox] + print(src_object_ids) + + # src_object_ids = [14,15,19] + + ltc_requests = [] + + for src_object_id in src_object_ids: + ltc_request = get_object_or_404(LTCform, id=src_object_id) + ltc_requests.append(ltc_request) + + context= { + 'ltc_requests' : ltc_requests, + 'hr' : "1", + } + + print(ltc_requests[0].name) + + return render(request, 'hr2Module/ltc_form.html',context) + +def form_mangement_ltc_hr(request,id): + print("Request of forward!") + uploader = "21BCS183" + uploader_designation = "student" + receiver = "21BCS181" + receiver_designation = "HOD" + src_module = "HR_ltc" + src_object_id = id, + file_extra_JSON = {"key": "value"} + + # Create a file representing the LTC form and send it to HR admin + file_id = create_file( + uploader=uploader, + uploader_designation=uploader_designation, + receiver=receiver, + receiver_designation=receiver_designation, + src_module=src_module, + src_object_id=src_object_id, + file_extra_JSON=file_extra_JSON, + attached_file=None # Attach any file if necessary + ) + + print("Sent the file to Hod!") + + messages.success(request, "Ltc form filled successfully") + + return HttpResponse("Sucess") +# hod ne get kiya +def form_mangement_ltc_get_hod(request): + if request.method == "GET": + username = "21BCS181" + designation = "HOD" + inbox = view_inbox(username=username, designation=designation, src_module="HR_ltc") + + # Extract src_object_id values + # src_object_ids = [(item['src_object_id']) for item in inbox] + + src_object_ids = [] + for item in inbox: + src_object_ids.append(int(item['src_object_id'][2:3])) + + print(src_object_ids) + + ltc_requests = [] + + for src_object_id in src_object_ids: + ltc_request = get_object_or_404(LTCform, id=src_object_id) + ltc_requests.append(ltc_request) + + context = { + 'ltc_requests': ltc_requests, + 'hr': "1", + 'user_designation': designation, + } + + print(ltc_requests[0].name) + + return render(request, 'hr2Module/ltc_form.html', context) + + +def form_mangement_ltc_hod(request,id): + print("Request of forward!") + uploader = "21BCS183" + uploader_designation = "student" + receiver = "21BCS017" + # isko sahi krna h + receiver_designation = "Director" + src_module = "HR_ltc" + src_object_id = id, + file_extra_JSON = {"key": "value"} + + # Create a file representing the LTC form and send it to HR admin + file_id = create_file( + uploader=uploader, + uploader_designation=uploader_designation, + receiver=receiver, + receiver_designation=receiver_designation, + src_module=src_module, + src_object_id=src_object_id, + file_extra_JSON=file_extra_JSON, + attached_file=None # Attach any file if necessary + ) + + print("Sent the file to Director!") + + messages.success(request, "Ltc form filled successfully") + + return HttpResponse("Sucess") + +# def form_mangement_ltc_get_ar(request): +# if request.method == "GET": +# username = "21BCS187" +# # isko bhi sahi krna h +# designation = "Dealing Assistant" +# inbox = view_inbox(username=username, designation=designation, src_module="HR_ltc") + +# # Extract src_object_id values +# # src_object_ids = [(item['src_object_id']) for item in inbox] + +# src_object_ids = [] +# for item in inbox: +# src_object_ids.append(int(item['src_object_id'][2:4])) + +# print(src_object_ids) + +# ltc_requests = [] + +# for src_object_id in src_object_ids: +# ltc_request = get_object_or_404(LTCform, id=src_object_id) +# ltc_requests.append(ltc_request) + +# context = { +# 'ltc_requests': ltc_requests, +# 'hr': "1", +# } + +# print(ltc_requests[0].name) + +# return render(request, 'hr2Module/ltc_form.html', context) + +def form_mangement_ltc_director(request,id): + print("Request of forward!") + uploader = "21BCS187" + uploader_designation = "student" + receiver = "21BCS017" + # isko sahi krna h + receiver_designation = "AR/DR" + src_module = "HR_ltc" + src_object_id = id, + file_extra_JSON = {"key": "value"} + + # Create a file representing the LTC form and send it to HR admin + file_id = create_file( + uploader=uploader, + uploader_designation=uploader_designation, + receiver=receiver, + receiver_designation=receiver_designation, + src_module=src_module, + src_object_id=src_object_id, + file_extra_JSON=file_extra_JSON, + attached_file=None # Attach any file if necessary + ) + + print("Sent the file to AR/DR!") + + messages.success(request, "Ltc form filled successfully") + + return HttpResponse("Sucess") + +def form_mangement_ltc_get_director(request): + if request.method == "GET": + username = "21BCS017" + # isko bhi sahi krna h + designation = "Director" + inbox = view_inbox(username=username, designation=designation, src_module="HR_ltc") + + # Extract src_object_id values + # src_object_ids = [(item['src_object_id']) for item in inbox] + + # src_object_ids = [19] + + src_object_ids = [] + for item in inbox: + src_object_ids.append(int(item['src_object_id'][2:3])) + + print(src_object_ids) + + ltc_requests = [] + + for src_object_id in src_object_ids: + ltc_request = get_object_or_404(LTCform, id=src_object_id) + ltc_requests.append(ltc_request) + + context = { + 'ltc_requests': ltc_requests, + 'hr': "1", + } + + print(ltc_requests[0].name) + + return render(request, 'hr2Module/ltc_form.html', context) + + +@login_required(login_url='/accounts/login') +def dashboard(request): + user = request.user + print(request.user) + + user_id = ExtraInfo.objects.get(user=user).user_id + print(user_id) + context = {'user_id': user_id} + print("context",user_id) + return render(request, 'hr2Module/dashboard.html',context) \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/cpda_form.html b/FusionIIIT/templates/hr2Module/cpda_form.html new file mode 100644 index 000000000..4bfa69d4a --- /dev/null +++ b/FusionIIIT/templates/hr2Module/cpda_form.html @@ -0,0 +1,197 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Module +{% endblock %} + + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + +
+ +
+ +
+ +
+ {% comment %} + TODO: Add a If-Else here! + {% endcomment %} + {% if employee %} +
+ {{ employee.user.first_name}} + {{ employee.user.last_name}} + + {{ employee.department.name}} + +
+ {% else %} +
+ {{ request.user.first_name}} + {{ request.user.last_name}} + + {{ request.user.extrainfo.department.name}} + +
+ {% endif %} + +
+ {% for i in Curr_desig %} + {% comment %}Should this be inside if else?{% endcomment %} + {% if i == "co-ordinator" or i == "co co-ordinator" %} + {{ i }} of {{ club_details }} club + {% else %} + {{ i }} + {% endif %} + +
+ {% endfor %} +
+
+
+ + + + + + + + {% comment %}The user image card ends here!{% endcomment %} + +
+ + + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + + + {% comment %} + The central-rail segment starts here! + {% endcomment %} + + + +
+ +
+
+ {% comment %} + TODO: Loader required? +
+ Loading ... +
+ {% endcomment %} +
+ {% block alerts %} + {% include 'hr2Module/cpda_form_edit.html' %} + {% endblock %} +
+
+
+ +
+
+ {% comment %} + TODO: Loader required? +
+ Loading ... +
+ {% endcomment %} +
+ {% block second_tab_alerts %} + {% include 'hr2Module/view_cpda_requests.html' %} + {% endblock %} +
+
+
+ + +
+ + {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %}The Modules:{% endcomment %} + {% block modules %} + {% include 'dashboard/modules.html' %} + {% endblock %} +
+ +
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + + +
+{% comment %}The grid ends here!{% endcomment %} + + + +{% endblock %} + +{% block javascript %} + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/cpda_form_edit.html b/FusionIIIT/templates/hr2Module/cpda_form_edit.html new file mode 100644 index 000000000..20a2cf790 --- /dev/null +++ b/FusionIIIT/templates/hr2Module/cpda_form_edit.html @@ -0,0 +1,175 @@ +
+
+ + + +
+ {% csrf_token %} + + +
+ + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ +
+ +
+
+
+ + +
+ +
+ + +
+
+







+ +
+ +
+ + +
+
+
+ +
+ + +
+ +
+ +
+ +
+

Estt. Section

+
+

+ +
+ + +
+
+ + +
+

+ +
+
+ + +
+
+ + +
+
+ +
+ +
+

Internal Audit

+
+

+ +
+ + +
+

+ +
+
+ + +
+
+ + +
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+ + + +
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
\ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/dashboard.html b/FusionIIIT/templates/hr2Module/dashboard.html new file mode 100644 index 000000000..d59f0b828 --- /dev/null +++ b/FusionIIIT/templates/hr2Module/dashboard.html @@ -0,0 +1,74 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Administrative Profile +{% endblock %} + +{% block css %} + +{% endblock %} + + + +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+
+
+ {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} +
+ + + +
+
+ +
+ {% comment %}The right-rail segment starts here!{% endcomment %} +
+ {% if request.user == user %} +
+
+ Generate Report
+
+ + {% endif %} + + +
+ {% comment %}The Modules:{% endcomment %} + {% block modules %} + {% include 'dashboard/modules.html' %} + {% endblock %} +
+ +
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/hr_admin_cpda_view.html b/FusionIIIT/templates/hr2Module/hr_admin_cpda_view.html new file mode 100644 index 000000000..e5bf04b57 --- /dev/null +++ b/FusionIIIT/templates/hr2Module/hr_admin_cpda_view.html @@ -0,0 +1,97 @@ + + +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Module +{% endblock %} + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+
+ +
+
+
+ +
+ +
+ {% if employee %} +
+ {{ employee.user.first_name}} + {{ employee.user.last_name}} + + {{ employee.department.name}} + +
+ {% else %} +
+ {{ request.user.first_name}} + {{ request.user.last_name}} + + {{ request.user.extrainfo.department.name}} + +
+ {% endif %} + +
+ {% for i in Curr_desig %} + + {% if i == "co-ordinator" or i == "co co-ordinator" %} + {{ i }} of {{ club_details }} club + {% else %} + {{ i }} + {% endif %} + +
+ {% endfor %} +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ {% csrf_token %} + {% for cpda_request in cpda_request %} +
+
+ +
{{ cpda_request.id }}
+
+ +
+ {% endfor %} +
+
+
+
+
+
+
+ +
+
+ {% include 'dashboard/modules.html' %} +
+
+
+ +{% endblock %} diff --git a/FusionIIIT/templates/hr2Module/ltc_form.html b/FusionIIIT/templates/hr2Module/ltc_form.html new file mode 100644 index 000000000..717728126 --- /dev/null +++ b/FusionIIIT/templates/hr2Module/ltc_form.html @@ -0,0 +1,197 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Module +{% endblock %} + + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + +
+ +
+ +
+ +
+ {% comment %} + TODO: Add a If-Else here! + {% endcomment %} + {% if employee %} +
+ {{ employee.user.first_name}} + {{ employee.user.last_name}} + + {{ employee.department.name}} + +
+ {% else %} +
+ {{ request.user.first_name}} + {{ request.user.last_name}} + + {{ request.user.extrainfo.department.name}} + +
+ {% endif %} + +
+ {% for i in Curr_desig %} + {% comment %}Should this be inside if else?{% endcomment %} + {% if i == "co-ordinator" or i == "co co-ordinator" %} + {{ i }} of {{ club_details }} club + {% else %} + {{ i }} + {% endif %} + +
+ {% endfor %} +
+
+
+ + + + + + + + {% comment %}The user image card ends here!{% endcomment %} + +
+ + + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + + + {% comment %} + The central-rail segment starts here! + {% endcomment %} + + + +
+ +
+
+ {% comment %} + TODO: Loader required? +
+ Loading ... +
+ {% endcomment %} +
+ {% block alerts %} + {% include 'hr2Module/ltc_form_edit.html' %} + {% endblock %} +
+
+
+ +
+
+ {% comment %} + TODO: Loader required? +
+ Loading ... +
+ {% endcomment %} +
+ {% block second_tab_alerts %} + {% include 'hr2Module/view_ltc_requests.html' %} + {% endblock %} +
+
+
+ + +
+ + {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %}The Modules:{% endcomment %} + {% block modules %} + {% include 'dashboard/modules.html' %} + {% endblock %} +
+ +
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + + +
+{% comment %}The grid ends here!{% endcomment %} + + + +{% endblock %} + +{% block javascript %} + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/ltc_form_edit.html b/FusionIIIT/templates/hr2Module/ltc_form_edit.html new file mode 100644 index 000000000..00d5d63c3 --- /dev/null +++ b/FusionIIIT/templates/hr2Module/ltc_form_edit.html @@ -0,0 +1,397 @@ +
+
+
+ {% csrf_token %} + +
+
+
+ + +
+
+ + +
+
+ +
+ + +
+



+
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + + +
+
+ +
+ + + +
+
+
+ + + + + +
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+ + + + +
+ +
+ +
+
+ + + + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + + + + + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoFull NameAge
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoFull NameAgeWhy fully dependent?
+ +
+ +
+ + +
+
+
+ + +
+ +
+ + + + + +
+
+ +
+ + +
+ +
+
+ + +
+ +
+ + + + + +
+ +
+
+
+ + + + +
+
+ + +
+
+
+
\ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/view_cpda_form.html b/FusionIIIT/templates/hr2Module/view_cpda_form.html new file mode 100644 index 000000000..e00adc8ac --- /dev/null +++ b/FusionIIIT/templates/hr2Module/view_cpda_form.html @@ -0,0 +1,361 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Module +{% endblock %} + + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + +
+ +
+ +
+ +
+ {% comment %} + TODO: Add a If-Else here! + {% endcomment %} + {% if employee %} +
+ {{ employee.user.first_name}} + {{ employee.user.last_name}} + + {{ employee.department.name}} + +
+ {% else %} +
+ {{ request.user.first_name}} + {{ request.user.last_name}} + + {{ request.user.extrainfo.department.name}} + +
+ {% endif %} + +
+ {% for i in Curr_desig %} + {% comment %}Should this be inside if else?{% endcomment %} + {% if i == "co-ordinator" or i == "co co-ordinator" %} + {{ i }} of {{ club_details }} club + {% else %} + {{ i }} + {% endif %} + +
+ {% endfor %} +
+
+
+ + + + {% comment %}The user image card ends here!{% endcomment %} + +
+ + + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + + + {% comment %} + The central-rail segment starts here! + {% endcomment %} + + + +
+ +
+
+ {% comment %} + TODO: Loader required? +
+ Loading ... +
+ {% endcomment %} +
+ {% block alerts %} + +
+
+ + + +
+ {% csrf_token %} + + {% for cpda_form in cpda_form %} + + +
+ + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ +
+ +
+
+
+ + +
+ +
+ + +
+
+







+ +
+ +
+ + +
+
+
+ +
+ + +
+ +
+ +
+ +
+

Estt. Section

+
+

+ +
+ + +
+
+ + +
+

+ +
+
+ + +
+
+ + +
+
+ +
+ +
+

Internal Audit

+
+

+ +
+ + +
+

+ +
+
+ + +
+
+ + +
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+ + + +
+ +
+ +
+
+ {% endfor %} + +
+ +
+
+ + +
+
+
+
+ {% endblock %} +
+
+
+ + +
+ + {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %}The Modules:{% endcomment %} + {% block modules %} + {% include 'dashboard/modules.html' %} + {% endblock %} +
+ +
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + + +
+{% comment %}The grid ends here!{% endcomment %} + + + +{% endblock %} + +{% block javascript %} + + +{% endblock %} + + + + + + \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/view_cpda_form_hrAdmin.html b/FusionIIIT/templates/hr2Module/view_cpda_form_hrAdmin.html new file mode 100644 index 000000000..da0796212 --- /dev/null +++ b/FusionIIIT/templates/hr2Module/view_cpda_form_hrAdmin.html @@ -0,0 +1,97 @@ + diff --git a/FusionIIIT/templates/hr2Module/view_cpda_request_hr.html b/FusionIIIT/templates/hr2Module/view_cpda_request_hr.html new file mode 100644 index 000000000..ece04b42e --- /dev/null +++ b/FusionIIIT/templates/hr2Module/view_cpda_request_hr.html @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/view_cpda_requests.html b/FusionIIIT/templates/hr2Module/view_cpda_requests.html new file mode 100644 index 000000000..a5467c535 --- /dev/null +++ b/FusionIIIT/templates/hr2Module/view_cpda_requests.html @@ -0,0 +1,111 @@ + + + + +
+
+
+
+
+ + + + + + + {% if dire == "2" and hr == "1" %} + + {% elif hr == "1" %} + + {% endif %} + {% if hr == "1" %} + + {% endif %} + + + + + + {% for cpda_request in cpda_requests %} + + + + + + {% if dire == "2" and hr == "1" %} + + + + {% elif hr == "1" %} + + + {% endif %} + {% if hr == "1" %} + + {% endif %} + + {% empty %} + + + + {% endfor %} + +
+

Form Id

+
+

View

+
+

Approve

+
+

Forward

+
+

Reject

+
{{ cpda_request.id }}View + +
No CPDA requests found
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/view_ltc_form.html b/FusionIIIT/templates/hr2Module/view_ltc_form.html new file mode 100644 index 000000000..7a26f7889 --- /dev/null +++ b/FusionIIIT/templates/hr2Module/view_ltc_form.html @@ -0,0 +1,507 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Module +{% endblock %} + + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + +
+ +
+ +
+ +
+ {% comment %} + TODO: Add a If-Else here! + {% endcomment %} + {% if employee %} +
+ {{ employee.user.first_name}} + {{ employee.user.last_name}} + + {{ employee.department.name}} + +
+ {% else %} +
+ {{ request.user.first_name}} + {{ request.user.last_name}} + + {{ request.user.extrainfo.department.name}} + +
+ {% endif %} + +
+ {% for i in Curr_desig %} + {% comment %}Should this be inside if else?{% endcomment %} + {% if i == "co-ordinator" or i == "co co-ordinator" %} + {{ i }} of {{ club_details }} club + {% else %} + {{ i }} + {% endif %} + +
+ {% endfor %} +
+
+
+ + + + {% comment %}The user image card ends here!{% endcomment %} + +
+ + + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + + + {% comment %} + The central-rail segment starts here! + {% endcomment %} + + + +
+ +
+
+ {% comment %} + TODO: Loader required? +
+ Loading ... +
+ {% endcomment %} +
+ {% block alerts %} + +
+
+
+ {% csrf_token %} + +
+
+
+ + +
+
+ + +
+ +
+ +
+ + +
+



+
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ +
+ +
+
+
+ + +
+
+ + + + + + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+ + +
+ +
+ + + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoFull NameAge
+ +
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoFull NameAgeWhy fully dependent?
+ +
+ +
+ + +
+
+
+ + +
+ +
+ + + + + +
+
+ +
+ + +
+ +
+
+ + +
+ +
+ + + + + +
+ +
+
+
+ + + + +
+
+ + +
+
+
+
+ {% endblock %} +
+
+
+ + +
+ + {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %}The Modules:{% endcomment %} + {% block modules %} + {% include 'dashboard/modules.html' %} + {% endblock %} +
+ +
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + + +
+{% comment %}The grid ends here!{% endcomment %} + + + +{% endblock %} + +{% block javascript %} + + + +{% endblock %} + + + + + + \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/view_ltc_requests.html b/FusionIIIT/templates/hr2Module/view_ltc_requests.html new file mode 100644 index 000000000..6ff904a2d --- /dev/null +++ b/FusionIIIT/templates/hr2Module/view_ltc_requests.html @@ -0,0 +1,90 @@ + + + + +
+
+
+
+
+ + + + + + + {% if hr == "1" %} + + {% endif %} + {% if hr == "1" %} + + {% endif %} + + + + + + {% for ltc_request in ltc_requests %} + + + + + + {% if hr == "1" %} + + {% endif %} + {% if hr == "1" %} + + {% endif %} + + {% empty %} + + + + {% endfor %} + +

Form Id

View

Forward

Reject

{{ ltc_request.id }}View
No LTC requests found
+
+
+
+
+
+ + + \ No newline at end of file