diff --git a/.gitignore b/.gitignore index 13184f251..bc7a548db 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,5 @@ FusionIIIT/static/ package-lock.json +.DS_Store + diff --git a/FusionIIIT/applications/academic_information/migrations/0001_initial.py b/FusionIIIT/applications/academic_information/migrations/0001_initial.py index f75d3119c..4b0f359c3 100644 --- a/FusionIIIT/applications/academic_information/migrations/0001_initial.py +++ b/FusionIIIT/applications/academic_information/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.db import migrations, models import django.db.models.deletion @@ -9,8 +9,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('programme_curriculum', '0001_initial'), ('globals', '0001_initial'), + ('programme_curriculum', '0001_initial'), ] operations = [ @@ -117,8 +117,8 @@ class Migration(migrations.Migration): ('batch', models.IntegerField(default=2016)), ('cpi', models.FloatField(default=0)), ('category', models.CharField(choices=[('GEN', 'General'), ('SC', 'Scheduled Castes'), ('ST', 'Scheduled Tribes'), ('OBC', 'Other Backward Classes')], max_length=10)), - ('father_name', models.CharField(default='', max_length=40)), - ('mother_name', models.CharField(default='', max_length=40)), + ('father_name', models.CharField(default='', max_length=40, null=True)), + ('mother_name', models.CharField(default='', max_length=40, null=True)), ('hall_no', models.IntegerField(default=0)), ('room_no', models.CharField(blank=True, max_length=10, null=True)), ('specialization', models.CharField(choices=[('Power and Control', 'Power and Control'), ('Microwave and Communication Engineering', 'Microwave and Communication Engineering'), ('Micro-nano Electronics', 'Micro-nano Electronics'), ('CAD/CAM', 'CAD/CAM'), ('Design', 'Design'), ('Manufacturing', 'Manufacturing'), ('CSE', 'CSE'), ('Mechatronics', 'Mechatronics'), ('MDes', 'MDes'), ('None', 'None')], default='', max_length=40, null=True)), diff --git a/FusionIIIT/applications/academic_procedures/migrations/0001_initial.py b/FusionIIIT/applications/academic_procedures/migrations/0001_initial.py index c9dc22290..42142593d 100644 --- a/FusionIIIT/applications/academic_procedures/migrations/0001_initial.py +++ b/FusionIIIT/applications/academic_procedures/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.db import migrations, models @@ -11,9 +11,9 @@ class Migration(migrations.Migration): initial = True dependencies = [ + ('globals', '0001_initial'), ('academic_information', '0001_initial'), ('programme_curriculum', '0001_initial'), - ('globals', '0001_initial'), ] operations = [ @@ -188,7 +188,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('month', models.CharField(choices=[('Jan', 'January'), ('Feb', 'Febuary'), ('Mar', 'March'), ('Apr', 'April'), ('May', 'May'), ('Jun', 'June'), ('Jul', 'July'), ('Aug', 'August'), ('Sep', 'September'), ('Oct', 'October'), ('Nov', 'November'), ('Dec', 'December')], max_length=10)), - ('year', models.IntegerField(choices=[(2023, 2023), (2022, 2022)])), + ('year', models.IntegerField(choices=[(2024, 2024), (2023, 2023)])), ('description', models.CharField(choices=[('Stu_paid', 'Paid'), ('Stu_due', 'Due')], max_length=15)), ('amount', models.IntegerField()), ('remaining_amount', models.IntegerField()), @@ -243,7 +243,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('semester', models.IntegerField()), - ('batch', models.IntegerField(default=2023)), + ('batch', models.IntegerField(default=2024)), ('verified', models.BooleanField(default=False)), ('curr_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.curriculum')), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), @@ -334,7 +334,7 @@ class Migration(migrations.Migration): name='course_registration', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('working_year', models.IntegerField(blank=True, choices=[(2023, 2023), (2022, 2022)], null=True)), + ('working_year', models.IntegerField(blank=True, choices=[(2024, 2024), (2023, 2023)], null=True)), ('course_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='programme_curriculum.course')), ('course_slot_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='programme_curriculum.courseslot')), ('semester_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='programme_curriculum.semester')), @@ -374,7 +374,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date', models.DateTimeField(auto_now_add=True)), ('month', models.CharField(choices=[('Jan', 'January'), ('Feb', 'Febuary'), ('Mar', 'March'), ('Apr', 'April'), ('May', 'May'), ('Jun', 'June'), ('Jul', 'July'), ('Aug', 'August'), ('Sep', 'September'), ('Oct', 'October'), ('Nov', 'November'), ('Dec', 'December')], max_length=10)), - ('year', models.IntegerField(choices=[(2023, 2023), (2022, 2022)])), + ('year', models.IntegerField(choices=[(2024, 2024), (2023, 2023)])), ('bank_account', models.CharField(max_length=11)), ('applicability', models.CharField(choices=[('GATE', 'GATE'), ('NET', 'NET'), ('CEED', 'CEED')], max_length=5)), ('ta_supervisor_remark', models.BooleanField(default=False)), @@ -392,7 +392,7 @@ class Migration(migrations.Migration): name='Register', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('year', models.IntegerField(default=2023)), + ('year', models.IntegerField(default=2024)), ('semester', models.IntegerField()), ('curr_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.curriculum')), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), diff --git a/FusionIIIT/applications/central_mess/migrations/0001_initial.py b/FusionIIIT/applications/central_mess/migrations/0001_initial.py index 2a5bce41c..c197e0231 100644 --- a/FusionIIIT/applications/central_mess/migrations/0001_initial.py +++ b/FusionIIIT/applications/central_mess/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import applications.central_mess.models import datetime @@ -19,7 +19,7 @@ class Migration(migrations.Migration): name='Menu', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('mess_option', models.CharField(choices=[('mess1', 'Veg_mess'), ('mess2', 'Non_veg_mess')], default='mess2', max_length=20)), + ('mess_option', models.CharField(choices=[('mess1', 'Mess1'), ('mess2', 'Mess2')], default='mess2', max_length=20)), ('meal_time', models.CharField(choices=[('MB', 'Monday Breakfast'), ('ML', 'Monday Lunch'), ('MD', 'Monday Dinner'), ('TB', 'Tuesday Breakfast'), ('TL', 'Tuesday Lunch'), ('TD', 'Tuesday Dinner'), ('WB', 'Wednesday Breakfast'), ('WL', 'Wednesday Lunch'), ('WD', 'Wednesday Dinner'), ('THB', 'Thursday Breakfast'), ('THL', 'Thursday Lunch'), ('THD', 'Thursday Dinner'), ('FB', 'Friday Breakfast'), ('FL', 'Friday Lunch'), ('FD', 'Friday Dinner'), ('SB', 'Saturday Breakfast'), ('SL', 'Saturday Lunch'), ('SD', 'Saturday Dinner'), ('SUB', 'Sunday Breakfast'), ('SUL', 'Sunday Lunch'), ('SUD', 'Sunday Dinner')], max_length=20)), ('dish', models.CharField(max_length=200)), ], @@ -51,15 +51,6 @@ class Migration(migrations.Migration): ('timestamp', models.DateTimeField(auto_now_add=True)), ], ), - migrations.CreateModel( - name='Nonveg_menu', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('dish', models.CharField(max_length=20)), - ('price', models.IntegerField()), - ('order_interval', models.CharField(choices=[('Breakfast', 'Breakfast'), ('Lunch', 'Lunch'), ('Dinner', 'Dinner')], default='Breakfast', max_length=20)), - ], - ), migrations.CreateModel( name='Vacation_food', fields=[ @@ -80,33 +71,68 @@ class Migration(migrations.Migration): ('end_date', models.DateField(default=datetime.date.today)), ('request', models.TextField()), ('status', models.CharField(choices=[('0', 'rejected'), ('1', 'pending'), ('2', 'accepted')], default='1', max_length=20)), - ('item1', models.CharField(max_length=50)), - ('item2', models.CharField(max_length=50)), + ('item1', models.CharField(choices=[('dal_chawal', 'Dal Chawal'), ('khicdi', 'Khicdi'), ('tomato_soup', 'Tomato Soup')], default='dal_chawal', max_length=50)), + ('item2', models.CharField(choices=[('breakfast', 'Breakfast'), ('lunch', 'Lunch'), ('dinner', 'Dinner')], default='breakfast', max_length=50)), ('app_date', models.DateField(default=datetime.date.today)), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), ], ), migrations.CreateModel( - name='Rebate', + name='Semdates', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('start_date', models.DateField(default=datetime.date.today)), ('end_date', models.DateField(default=datetime.date.today)), - ('purpose', models.TextField()), - ('status', models.CharField(choices=[('0', 'rejected'), ('1', 'pending'), ('2', 'accepted')], default='1', max_length=20)), - ('app_date', models.DateField(default=datetime.date.today)), - ('leave_type', models.CharField(choices=[('casual', 'Casual'), ('vacation', 'Vacation')], default='casual', max_length=20)), + ], + options={ + 'unique_together': {('start_date', 'end_date')}, + }, + ), + migrations.CreateModel( + name='Registration_Request', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('Txn_no', models.CharField(max_length=20)), + ('img', models.ImageField(default=None, upload_to='images/')), + ('amount', models.IntegerField(default=0)), + ('status', models.CharField(default='pending', max_length=10)), + ('registration_remark', models.CharField(default='NA', max_length=50)), + ('start_date', models.DateField(default=None, null=True)), + ('payment_date', models.DateField(default=None, null=True)), + ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), + ], + ), + migrations.CreateModel( + name='Reg_records', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('start_date', models.DateField(default=datetime.date.today)), + ('end_date', models.DateField(default=None, null=True)), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), ], ), migrations.CreateModel( - name='Nonveg_data', + name='Reg_main', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('order_date', models.DateField(default=datetime.date.today)), - ('order_interval', models.CharField(choices=[('Breakfast', 'Breakfast'), ('Lunch', 'Lunch'), ('Dinner', 'Dinner')], default='Breakfast', max_length=20)), + ('program', models.CharField(max_length=10)), + ('current_mess_status', models.CharField(default='Deregistered', max_length=20)), + ('balance', models.IntegerField(default=0)), + ('mess_option', models.CharField(default='mess2', max_length=20)), + ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), + ], + ), + migrations.CreateModel( + name='Rebate', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('start_date', models.DateField(default=datetime.date.today)), + ('end_date', models.DateField(default=datetime.date.today)), + ('purpose', models.TextField()), + ('status', models.CharField(choices=[('0', 'rejected'), ('1', 'pending'), ('2', 'accepted')], default='1', max_length=20)), ('app_date', models.DateField(default=datetime.date.today)), - ('dish', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='central_mess.nonveg_menu')), + ('leave_type', models.CharField(choices=[('casual', 'Casual'), ('vacation', 'Vacation')], default='casual', max_length=20)), + ('rebate_remark', models.CharField(default='NA', max_length=50)), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), ], ), @@ -134,11 +160,22 @@ class Migration(migrations.Migration): name='Feedback', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('mess', models.CharField(choices=[('mess1', 'Veg_mess'), ('mess2', 'Non_veg_mess')], default='mess1', max_length=10)), + ('mess', models.CharField(choices=[('mess1', 'Mess1'), ('mess2', 'Mess2')], default='mess1', max_length=10)), ('mess_rating', models.PositiveSmallIntegerField(default='5')), ('fdate', models.DateField(default=datetime.date.today)), ('description', models.TextField()), ('feedback_type', models.CharField(choices=[('maintenance', 'Maintenance'), ('food', 'Food'), ('cleanliness', 'Cleanliness & Hygiene'), ('others', 'Others')], max_length=20)), + ('feedback_remark', models.CharField(default='NA', max_length=50)), + ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), + ], + ), + migrations.CreateModel( + name='Deregistration_Request', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('status', models.CharField(default='pending', max_length=10)), + ('deregistration_remark', models.CharField(default='NA', max_length=50)), + ('end_date', models.DateField(default=None, null=True)), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), ], ), @@ -146,13 +183,14 @@ class Migration(migrations.Migration): name='Payments', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('sem', models.IntegerField()), - ('year', models.IntegerField(default=applications.central_mess.models.current_year)), ('amount_paid', models.IntegerField(default=0)), + ('payment_month', models.CharField(default=applications.central_mess.models.current_month, max_length=20)), + ('payment_year', models.IntegerField(default=applications.central_mess.models.current_year)), + ('payment_date', models.DateField(default=datetime.date(2024, 4, 15))), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), ], options={ - 'unique_together': {('student_id', 'sem', 'year')}, + 'unique_together': {('student_id', 'payment_date')}, }, ), migrations.CreateModel( @@ -164,8 +202,8 @@ class Migration(migrations.Migration): ('amount', models.IntegerField(default=0)), ('rebate_count', models.IntegerField(default=0)), ('rebate_amount', models.IntegerField(default=0)), - ('nonveg_total_bill', models.IntegerField(default=0)), ('total_bill', models.IntegerField(default=0)), + ('paid', models.BooleanField(default=False)), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), ], options={ @@ -176,7 +214,7 @@ class Migration(migrations.Migration): name='Messinfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('mess_option', models.CharField(choices=[('mess1', 'Veg_mess'), ('mess2', 'Non_veg_mess')], default='mess2', max_length=20)), + ('mess_option', models.CharField(choices=[('mess1', 'Mess1'), ('mess2', 'Mess2')], default='mess2', max_length=20)), ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), ], options={ diff --git a/FusionIIIT/applications/complaint_system/migrations/0001_initial.py b/FusionIIIT/applications/complaint_system/migrations/0001_initial.py index db74dd14d..44df90d3c 100644 --- a/FusionIIIT/applications/complaint_system/migrations/0001_initial.py +++ b/FusionIIIT/applications/complaint_system/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.db import migrations, models import django.db.models.deletion @@ -15,12 +15,10 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='Caretaker', + name='SectionIncharge', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('area', models.CharField(choices=[('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), ('CC1', 'CC1'), ('CC2', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), ('Panini Hostel', 'Panini Hostel')], default='hall-3', max_length=20)), - ('rating', models.IntegerField(default=0)), - ('myfeedback', models.CharField(default='this is my feedback', max_length=400)), + ('work_type', models.CharField(choices=[('Electricity', 'Electricity'), ('carpenter', 'carpenter'), ('plumber', 'plumber'), ('garbage', 'garbage'), ('dustbin', 'dustbin'), ('internet', 'internet'), ('other', 'other')], default='Electricity', max_length=20)), ('staff_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')), ], ), @@ -32,14 +30,14 @@ class Migration(migrations.Migration): ('age', models.CharField(max_length=10)), ('phone', models.BigIntegerField(blank=True)), ('worker_type', models.CharField(choices=[('Electricity', 'Electricity'), ('carpenter', 'carpenter'), ('plumber', 'plumber'), ('garbage', 'garbage'), ('dustbin', 'dustbin'), ('internet', 'internet'), ('other', 'other')], default='internet', max_length=20)), - ('caretaker_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='complaint_system.caretaker')), + ('secincharge_id', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='complaint_system.sectionincharge')), ], ), migrations.CreateModel( name='Supervisor', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('area', models.CharField(choices=[('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), ('CC1', 'CC1'), ('CC2', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), ('Panini Hostel', 'Panini Hostel')], max_length=20)), + ('type', models.CharField(choices=[('Electricity', 'Electricity'), ('carpenter', 'carpenter'), ('plumber', 'plumber'), ('garbage', 'garbage'), ('dustbin', 'dustbin'), ('internet', 'internet'), ('other', 'other')], default='Electricity', max_length=30)), ('sup_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')), ], ), @@ -50,7 +48,7 @@ class Migration(migrations.Migration): ('complaint_date', models.DateTimeField(default=django.utils.timezone.now)), ('complaint_finish', models.DateField(blank=True, null=True)), ('complaint_type', models.CharField(choices=[('Electricity', 'Electricity'), ('carpenter', 'carpenter'), ('plumber', 'plumber'), ('garbage', 'garbage'), ('dustbin', 'dustbin'), ('internet', 'internet'), ('other', 'other')], default='internet', max_length=20)), - ('location', models.CharField(choices=[('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), ('CC1', 'CC1'), ('CC2', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), ('Panini Hostel', 'Panini Hostel')], max_length=20)), + ('location', models.CharField(choices=[('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), ('library', 'CC1'), ('computer center', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), ('NR3', 'NR3'), ('Admin building', 'Admin building'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), ('Panini Hostel', 'Panini Hostel')], max_length=20)), ('specific_location', models.CharField(blank=True, max_length=50)), ('details', models.CharField(max_length=100)), ('status', models.IntegerField(default='0')), @@ -64,4 +62,14 @@ class Migration(migrations.Migration): ('worker_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='complaint_system.workers')), ], ), + migrations.CreateModel( + name='Caretaker', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('area', models.CharField(choices=[('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), ('library', 'CC1'), ('computer center', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), ('NR3', 'NR3'), ('Admin building', 'Admin building'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), ('Panini Hostel', 'Panini Hostel')], default='hall-3', max_length=20)), + ('rating', models.IntegerField(default=0)), + ('myfeedback', models.CharField(default='this is my feedback', max_length=400)), + ('staff_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')), + ], + ), ] diff --git a/FusionIIIT/applications/counselling_cell/migrations/0001_initial.py b/FusionIIIT/applications/counselling_cell/migrations/0001_initial.py index b87618488..f0214910c 100644 --- a/FusionIIIT/applications/counselling_cell/migrations/0001_initial.py +++ b/FusionIIIT/applications/counselling_cell/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.db import migrations, models @@ -10,8 +10,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('academic_information', '0001_initial'), ('globals', '0001_initial'), + ('academic_information', '0001_initial'), ] operations = [ diff --git a/FusionIIIT/applications/department/migrations/0001_initial.py b/FusionIIIT/applications/department/migrations/0001_initial.py index fc8a34834..cb016ad8b 100644 --- a/FusionIIIT/applications/department/migrations/0001_initial.py +++ b/FusionIIIT/applications/department/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.db import migrations, models diff --git a/FusionIIIT/applications/eis/migrations/0001_initial.py b/FusionIIIT/applications/eis/migrations/0001_initial.py index 2fd2e65d3..f3dbd4bf3 100644 --- a/FusionIIIT/applications/eis/migrations/0001_initial.py +++ b/FusionIIIT/applications/eis/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.conf import settings @@ -49,7 +49,7 @@ class Migration(migrations.Migration): name='emp_techtransfer', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('details', models.CharField(default=' ', max_length=500)), ('date_entry', models.DateField(blank=True, default=datetime.datetime.now, null=True)), ('start_date', models.DateField(blank=True, null=True)), @@ -61,7 +61,7 @@ class Migration(migrations.Migration): name='emp_session_chair', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('name', models.CharField(default=' ', max_length=500)), ('event', models.TextField(default=' ', max_length=2500)), ('s_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017)], null=True, verbose_name='year')), @@ -77,7 +77,7 @@ class Migration(migrations.Migration): name='emp_research_projects', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('ptype', models.CharField(default='Research', max_length=100)), ('pi', models.CharField(default=' ', max_length=1000)), ('co_pi', models.CharField(default=' ', max_length=1500)), @@ -96,7 +96,7 @@ class Migration(migrations.Migration): name='emp_research_papers', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('rtype', models.CharField(choices=[('Journal', 'Journal'), ('Conference', 'Conference')], default='Conference', max_length=500)), ('authors', models.CharField(blank=True, max_length=2500, null=True)), ('co_authors', models.CharField(blank=True, max_length=2500, null=True)), @@ -113,7 +113,7 @@ class Migration(migrations.Migration): ('end_date', models.DateField(blank=True, null=True)), ('date_acceptance', models.DateField(blank=True, null=True)), ('date_publication', models.DateField(blank=True, null=True)), - ('year', models.CharField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023)], max_length=10, null=True)), + ('year', models.CharField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024)], max_length=10, null=True)), ('a_month', models.CharField(blank=True, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12)], default=1, max_length=500, null=True)), ('doc_id', models.CharField(blank=True, max_length=50, null=True)), ('doc_description', models.CharField(blank=True, max_length=1000, null=True)), @@ -128,11 +128,11 @@ class Migration(migrations.Migration): name='emp_published_books', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('p_type', models.CharField(choices=[('Book', 'Book'), ('Monograph', 'Monograph'), ('Book Chapter', 'Book Chapter'), ('Handbook', 'Handbook'), ('Technical Report', 'Technical Report')], max_length=16)), ('title', models.CharField(default=' ', max_length=2500)), ('publisher', models.CharField(default=' ', max_length=2500)), - ('pyear', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023)], null=True, verbose_name='year')), + ('pyear', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024)], null=True, verbose_name='year')), ('authors', models.CharField(default=' ', max_length=250)), ('date_entry', models.DateField(blank=True, default=datetime.datetime.now, null=True)), ('publication_date', models.DateField(blank=True, null=True)), @@ -143,12 +143,12 @@ class Migration(migrations.Migration): name='emp_patents', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('p_no', models.CharField(max_length=150)), ('title', models.CharField(max_length=1500)), ('earnings', models.IntegerField(default=0)), ('status', models.CharField(choices=[('Filed', 'Filed'), ('Granted', 'Granted'), ('Published', 'Published'), ('Owned', 'Owned')], max_length=15)), - ('p_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023)], null=True, verbose_name='year')), + ('p_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024)], null=True, verbose_name='year')), ('a_month', models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12)], default=1, null=True, verbose_name='Month')), ('date_entry', models.DateField(blank=True, default=datetime.datetime.now, null=True)), ('start_date', models.DateField(blank=True, null=True)), @@ -160,14 +160,14 @@ class Migration(migrations.Migration): name='emp_mtechphd_thesis', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('degree_type', models.IntegerField(default=1)), ('title', models.CharField(max_length=250)), ('supervisors', models.CharField(max_length=250)), ('co_supervisors', models.CharField(blank=True, max_length=250, null=True)), ('rollno', models.CharField(max_length=200)), ('s_name', models.CharField(max_length=5000)), - ('s_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023)], null=True, verbose_name='year')), + ('s_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024)], null=True, verbose_name='year')), ('a_month', models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12)], default=1, null=True, verbose_name='Month')), ('date_entry', models.DateField(blank=True, default=datetime.datetime.now, null=True)), ('start_date', models.DateField(blank=True, null=True)), @@ -181,14 +181,14 @@ class Migration(migrations.Migration): name='emp_keynote_address', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('type', models.CharField(choices=[('Keynote', 'Keynote'), ('Plenary Address', 'Plenary Address')], default='Keynote', max_length=140)), ('title', models.CharField(max_length=1000)), ('name', models.CharField(max_length=1000)), ('venue', models.CharField(max_length=1000)), ('page_no', models.CharField(max_length=100)), ('isbn_no', models.CharField(max_length=200)), - ('k_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023)], null=True, verbose_name='year')), + ('k_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024)], null=True, verbose_name='year')), ('a_month', models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12)], default=1, null=True, verbose_name='Month')), ('start_date', models.DateField(blank=True, null=True)), ('end_date', models.DateField(blank=True, null=True)), @@ -200,12 +200,12 @@ class Migration(migrations.Migration): name='emp_expert_lectures', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('l_type', models.CharField(choices=[('Expert Lecture', 'Expert Lecture'), ('Invited Talk', 'Invited Talk')], default='Expert Lecture', max_length=14)), ('title', models.CharField(max_length=1000)), ('place', models.CharField(max_length=1000)), ('l_date', models.DateField(blank=True, null=True)), - ('l_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023)], null=True, verbose_name='year')), + ('l_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024)], null=True, verbose_name='year')), ('a_month', models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12)], default=1, null=True, verbose_name='Month')), ('date_entry', models.DateField(blank=True, default=datetime.datetime.now, null=True)), ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), @@ -215,7 +215,7 @@ class Migration(migrations.Migration): name='emp_event_organized', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('type', models.CharField(choices=[('Training Program', 'Training Program'), ('Seminar', 'Seminar'), ('Short Term Program', 'Short Term Program'), ('Workshop', 'Workshop'), ('Any Other', 'Any Other')], max_length=180)), ('name', models.CharField(max_length=1000)), ('sponsoring_agency', models.CharField(max_length=150)), @@ -231,7 +231,7 @@ class Migration(migrations.Migration): name='emp_consultancy_projects', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('consultants', models.CharField(max_length=150)), ('title', models.CharField(max_length=1000)), ('client', models.CharField(max_length=1000)), @@ -249,10 +249,10 @@ class Migration(migrations.Migration): name='emp_confrence_organised', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('name', models.CharField(max_length=500)), ('venue', models.CharField(max_length=500)), - ('k_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023)], null=True, verbose_name='year')), + ('k_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024)], null=True, verbose_name='year')), ('a_month', models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12)], default=1, null=True, verbose_name='Month')), ('start_date', models.DateField(blank=True, null=True)), ('end_date', models.DateField(blank=True, null=True)), @@ -266,12 +266,12 @@ class Migration(migrations.Migration): name='emp_achievement', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('pf_no', models.IntegerField()), + ('pf_no', models.CharField(max_length=20)), ('a_type', models.CharField(choices=[('Award', 'Award'), ('Honour', 'Honour'), ('Prize', 'Prize'), ('Other', 'Other')], default='Other', max_length=180)), ('details', models.TextField(default=' ', max_length=1550)), ('a_day', models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12), (13, 13), (14, 14), (15, 15), (16, 16), (17, 17), (18, 18), (19, 19), (20, 20), (21, 21), (22, 22), (23, 23), (24, 24), (25, 25), (26, 26), (27, 27), (28, 28), (29, 29), (30, 30), (31, 31)], null=True, verbose_name='Day')), ('a_month', models.IntegerField(blank=True, choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12)], null=True, verbose_name='Month')), - ('a_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023)], null=True, verbose_name='year')), + ('a_year', models.IntegerField(blank=True, choices=[(1995, 1995), (1996, 1996), (1997, 1997), (1998, 1998), (1999, 1999), (2000, 2000), (2001, 2001), (2002, 2002), (2003, 2003), (2004, 2004), (2005, 2005), (2006, 2006), (2007, 2007), (2008, 2008), (2009, 2009), (2010, 2010), (2011, 2011), (2012, 2012), (2013, 2013), (2014, 2014), (2015, 2015), (2016, 2016), (2017, 2017), (2018, 2018), (2019, 2019), (2020, 2020), (2021, 2021), (2022, 2022), (2023, 2023), (2024, 2024)], null=True, verbose_name='year')), ('date_entry', models.DateField(default=datetime.datetime.now)), ('achievment_date', models.DateField(blank=True, null=True)), ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), diff --git a/FusionIIIT/applications/establishment/migrations/0001_initial.py b/FusionIIIT/applications/establishment/migrations/0001_initial.py index e1449d3b3..d85fe198d 100644 --- a/FusionIIIT/applications/establishment/migrations/0001_initial.py +++ b/FusionIIIT/applications/establishment/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.conf import settings from django.db import migrations, models diff --git a/FusionIIIT/applications/estate_module/migrations/0001_initial.py b/FusionIIIT/applications/estate_module/migrations/0001_initial.py index 478a93b83..899dbfccc 100644 --- a/FusionIIIT/applications/estate_module/migrations/0001_initial.py +++ b/FusionIIIT/applications/estate_module/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.conf import settings from django.db import migrations, models diff --git a/FusionIIIT/applications/estate_module/static/estate_module/sidebar.js b/FusionIIIT/applications/estate_module/static/estate_module/sidebar.js index 462ebb004..449a7f5c8 100644 --- a/FusionIIIT/applications/estate_module/static/estate_module/sidebar.js +++ b/FusionIIIT/applications/estate_module/static/estate_module/sidebar.js @@ -36,7 +36,7 @@ $(document).ready(function () { .sidebar('setting', 'transition', 'overlay'); }); function newNotification() { - console.log('A new Notification added!'); + // console.log('A new Notification added!'); var notifactionName = document.createTextNode('Kanishka Munshi'); var notificationEmail = document.createTextNode('gmail@zlatan.com'); diff --git a/FusionIIIT/applications/feeds/migrations/0001_initial.py b/FusionIIIT/applications/feeds/migrations/0001_initial.py index 30ae94c92..e989d0101 100644 --- a/FusionIIIT/applications/feeds/migrations/0001_initial.py +++ b/FusionIIIT/applications/feeds/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.conf import settings from django.db import migrations, models diff --git a/FusionIIIT/applications/filetracking/migrations/0001_initial.py b/FusionIIIT/applications/filetracking/migrations/0001_initial.py index 6924ae1ff..3375630f7 100644 --- a/FusionIIIT/applications/filetracking/migrations/0001_initial.py +++ b/FusionIIIT/applications/filetracking/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.conf import settings from django.db import migrations, models @@ -24,6 +24,9 @@ class Migration(migrations.Migration): ('upload_date', models.DateTimeField(auto_now_add=True)), ('upload_file', models.FileField(blank=True, upload_to='')), ('is_read', models.BooleanField(default=False)), + ('src_module', models.CharField(default='filetracking', max_length=100)), + ('src_object_id', models.CharField(max_length=100, null=True)), + ('file_extra_JSON', models.JSONField(null=True)), ('designation', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='upload_designation', to='globals.designation')), ('uploader', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='uploaded_files', to='globals.extrainfo')), ], @@ -40,6 +43,7 @@ class Migration(migrations.Migration): ('remarks', models.CharField(blank=True, max_length=250, null=True)), ('upload_file', models.FileField(blank=True, upload_to='')), ('is_read', models.BooleanField(default=False)), + ('tracking_extra_JSON', models.JSONField(null=True)), ('current_design', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='globals.holdsdesignation')), ('current_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')), ('file_id', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='filetracking.file')), diff --git a/FusionIIIT/applications/finance_accounts/migrations/0001_initial.py b/FusionIIIT/applications/finance_accounts/migrations/0001_initial.py index 4dfa8fed7..8d45f1fc1 100644 --- a/FusionIIIT/applications/finance_accounts/migrations/0001_initial.py +++ b/FusionIIIT/applications/finance_accounts/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.db import migrations, models diff --git a/FusionIIIT/applications/globals/migrations/0001_initial.py b/FusionIIIT/applications/globals/migrations/0001_initial.py index 1fc3a8925..7fc43ccef 100644 --- a/FusionIIIT/applications/globals/migrations/0001_initial.py +++ b/FusionIIIT/applications/globals/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import applications.globals.models import datetime @@ -39,7 +39,7 @@ class Migration(migrations.Migration): ('title', models.CharField(choices=[('Mr.', 'Mr.'), ('Mrs.', 'Mrs.'), ('Ms.', 'Ms.'), ('Dr.', 'Dr.'), ('Professor', 'Prof.'), ('Shreemati', 'Shreemati'), ('Shree', 'Shree')], default='Dr.', max_length=20)), ('sex', models.CharField(choices=[('M', 'Male'), ('F', 'Female'), ('O', 'Other')], default='M', max_length=2)), ('date_of_birth', models.DateField(default=datetime.date(1970, 1, 1))), - ('user_status', models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50)), + ('user_status', models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50)), ('address', models.TextField(default='', max_length=1000)), ('phone_no', models.BigIntegerField(default=9999999999, null=True)), ('user_type', models.CharField(choices=[('student', 'student'), ('staff', 'staff'), ('compounder', 'compounder'), ('faculty', 'faculty')], max_length=20)), @@ -106,7 +106,7 @@ class Migration(migrations.Migration): ('working', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='current_designation', to=settings.AUTH_USER_MODEL)), ], options={ - 'unique_together': {('user', 'designation'), ('working', 'designation')}, + 'unique_together': {('working', 'designation'), ('user', 'designation')}, }, ), ] diff --git a/FusionIIIT/applications/globals/views.py b/FusionIIIT/applications/globals/views.py index 39c6913c1..8d1081532 100644 --- a/FusionIIIT/applications/globals/views.py +++ b/FusionIIIT/applications/globals/views.py @@ -29,6 +29,7 @@ from Fusion.settings.common import LOGIN_URL from notifications.models import Notification from .models import * +from applications.hostel_management.models import (HallCaretaker,HallWarden) def index(request): context = {} @@ -733,11 +734,25 @@ def dashboard(request): for i in b : name_ = get_object_or_404(Designation, id = i) roll_.append(str(name_.name)) + + hall_caretakers = HallCaretaker.objects.all().select_related() + hall_wardens = HallWarden.objects.all().select_related() + + hall_caretaker_user = [] + for caretaker in hall_caretakers: + hall_caretaker_user.append(caretaker.staff.id.user) + + hall_warden_user = [] + for warden in hall_wardens: + hall_warden_user.append(warden.faculty.id.user) + context={ 'notifications':notifs, 'Curr_desig' : roll_, 'club_details' : coordinator_club(request), 'designation' : designation, + 'hall_caretaker': hall_caretaker_user, + 'hall_warden': hall_warden_user, } # a=HoldsDesignation.objects.select_related('user','working','designation').filter(designation = user) diff --git a/FusionIIIT/applications/gymkhana/migrations/0001_initial.py b/FusionIIIT/applications/gymkhana/migrations/0001_initial.py index e140005a1..546d7fb81 100644 --- a/FusionIIIT/applications/gymkhana/migrations/0001_initial.py +++ b/FusionIIIT/applications/gymkhana/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.conf import settings from django.db import migrations, models @@ -11,9 +11,9 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('academic_information', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('globals', '0001_initial'), + ('academic_information', '0001_initial'), ] operations = [ diff --git a/FusionIIIT/applications/health_center/api/serializers.py b/FusionIIIT/applications/health_center/api/serializers.py index b2c838e5f..06fe901c1 100644 --- a/FusionIIIT/applications/health_center/api/serializers.py +++ b/FusionIIIT/applications/health_center/api/serializers.py @@ -99,4 +99,10 @@ class HospitalAdmitSerializer(serializers.ModelSerializer): class Meta: model=Hospital_admit + fields=('__all__') + +class MedicalReliefSerializer(serializers.ModelSerializer): + + class Meta: + model=medical_relief fields=('__all__') \ No newline at end of file diff --git a/FusionIIIT/applications/health_center/api/urls.py b/FusionIIIT/applications/health_center/api/urls.py index 661279c87..49fee2d6e 100644 --- a/FusionIIIT/applications/health_center/api/urls.py +++ b/FusionIIIT/applications/health_center/api/urls.py @@ -7,6 +7,5 @@ url(r'^compounder/$', views.compounder_view_api, name='compounder_view_api'), url(r'^compounder/request$', views.compounder_request_api , name='compounder_request_api'), url(r'^student/$', views.student_view_api, name='student_view'), - url(r'^student/request$', views.student_request_api, name='student_request_api') - -] + url(r'^student/request$', views.student_request_api, name='student_request_api') +] \ No newline at end of file diff --git a/FusionIIIT/applications/health_center/migrations/0001_initial.py b/FusionIIIT/applications/health_center/migrations/0001_initial.py index ee068099e..072d80def 100644 --- a/FusionIIIT/applications/health_center/migrations/0001_initial.py +++ b/FusionIIIT/applications/health_center/migrations/0001_initial.py @@ -1,5 +1,6 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 +import datetime from django.db import migrations, models import django.db.models.deletion @@ -13,14 +14,6 @@ class Migration(migrations.Migration): ] operations = [ - migrations.CreateModel( - name='Appointment', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('description', models.CharField(max_length=50)), - ('date', models.DateField()), - ], - ), migrations.CreateModel( name='Counter', fields=[ @@ -28,14 +21,15 @@ class Migration(migrations.Migration): ('count', models.IntegerField(default=0)), ('fine', models.IntegerField(default=0)), ('doc_count', models.IntegerField(default=0)), + ('patho_count', models.IntegerField(default=0)), ], ), migrations.CreateModel( name='Doctor', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('doctor_name', models.IntegerField(choices=[(0, 'Dr.Sharma'), (1, 'Dr.Vinay')])), - ('doctor_phone', models.CharField(max_length=10)), + ('doctor_name', models.CharField(choices=[(0, 'Dr.Sharma'), (1, 'Dr.Vinay')], max_length=50)), + ('doctor_phone', models.CharField(max_length=15)), ('specialization', models.CharField(max_length=100)), ('active', models.BooleanField(default=True)), ], @@ -48,6 +42,27 @@ class Migration(migrations.Migration): ('phone', models.CharField(max_length=10)), ], ), + migrations.CreateModel( + name='medical_relief', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.CharField(max_length=200)), + ('file', models.FileField(upload_to='medical_files/')), + ('file_id', models.IntegerField(default=0)), + ('compounder_forward_flag', models.BooleanField(default=False)), + ('acc_admin_forward_flag', models.BooleanField(default=False)), + ], + ), + migrations.CreateModel( + name='Pathologist', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('pathologist_name', models.CharField(choices=[(0, 'Dr.Ajay'), (1, 'Dr.Rahul')], max_length=50)), + ('pathologist_phone', models.CharField(max_length=15)), + ('specialization', models.CharField(max_length=100)), + ('active', models.BooleanField(default=True)), + ], + ), migrations.CreateModel( name='Stock', fields=[ @@ -58,15 +73,17 @@ class Migration(migrations.Migration): ], ), migrations.CreateModel( - name='Schedule', + name='SpecialRequest', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('day', models.IntegerField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')])), - ('from_time', models.TimeField(blank=True, null=True)), - ('to_time', models.TimeField(blank=True, null=True)), - ('room', models.IntegerField()), - ('date', models.DateField(auto_now=True)), - ('doctor_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='health_center.doctor')), + ('request_date', models.DateTimeField(default=datetime.date.today)), + ('brief', models.CharField(default='--', max_length=20)), + ('request_details', models.CharField(max_length=200)), + ('upload_request', models.FileField(blank=True, upload_to='')), + ('status', models.CharField(default='Pending', max_length=50)), + ('remarks', models.CharField(default='--', max_length=300)), + ('request_receiver', models.CharField(default='--', max_length=30)), + ('request_ann_maker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='special_requests_made', to='globals.extrainfo')), ], ), migrations.CreateModel( @@ -76,7 +93,7 @@ class Migration(migrations.Migration): ('details', models.CharField(max_length=100)), ('date', models.DateField()), ('test', models.CharField(blank=True, max_length=200, null=True)), - ('appointment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='health_center.appointment')), + ('file_id', models.IntegerField(default=0)), ('doctor_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='health_center.doctor')), ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')), ], @@ -92,6 +109,18 @@ class Migration(migrations.Migration): ('prescription_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='health_center.prescription')), ], ), + migrations.CreateModel( + name='Pathologist_Schedule', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('day', models.CharField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')], max_length=10)), + ('from_time', models.TimeField(blank=True, null=True)), + ('to_time', models.TimeField(blank=True, null=True)), + ('room', models.IntegerField()), + ('date', models.DateField(auto_now=True)), + ('pathologist_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='health_center.pathologist')), + ], + ), migrations.CreateModel( name='Medicine', fields=[ @@ -129,6 +158,18 @@ class Migration(migrations.Migration): ('medicine_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='health_center.stock')), ], ), + migrations.CreateModel( + name='Doctors_Schedule', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('day', models.CharField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')], max_length=10)), + ('from_time', models.TimeField(blank=True, null=True)), + ('to_time', models.TimeField(blank=True, null=True)), + ('room', models.IntegerField()), + ('date', models.DateField(auto_now=True)), + ('doctor_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='health_center.doctor')), + ], + ), migrations.CreateModel( name='Complaint', fields=[ @@ -139,20 +180,29 @@ class Migration(migrations.Migration): ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')), ], ), - migrations.AddField( - model_name='appointment', - name='doctor_id', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='health_center.doctor'), - ), - migrations.AddField( - model_name='appointment', - name='schedule', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='health_center.schedule'), + migrations.CreateModel( + name='Appointment', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.CharField(max_length=50)), + ('date', models.DateField()), + ('doctor_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='health_center.doctor')), + ('schedule', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='health_center.doctors_schedule')), + ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')), + ], ), - migrations.AddField( - model_name='appointment', - name='user_id', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo'), + migrations.CreateModel( + name='Announcements', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ann_date', models.DateTimeField(default='04-04-2021')), + ('message', models.CharField(max_length=200)), + ('batch', models.CharField(default='Year-1', max_length=40)), + ('department', models.CharField(default='ALL', max_length=40)), + ('programme', models.CharField(max_length=10)), + ('upload_announcement', models.FileField(default=' ', null=True, upload_to='health_center/upload_announcement')), + ('anno_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='announcements_made', to='globals.extrainfo')), + ], ), migrations.CreateModel( name='Ambulance_request', diff --git a/FusionIIIT/applications/health_center/models.py b/FusionIIIT/applications/health_center/models.py index 89a1181cd..37f076d08 100644 --- a/FusionIIIT/applications/health_center/models.py +++ b/FusionIIIT/applications/health_center/models.py @@ -1,8 +1,10 @@ + from django.db import models from datetime import date from applications.globals.models import ExtraInfo + # Create your models here. @@ -168,6 +170,7 @@ class Prescription(models.Model): details = models.CharField(max_length=100) date = models.DateField() test = models.CharField(max_length=200, null=True, blank=True) + file_id=models.IntegerField(default=0) # appointment = models.ForeignKey(Appointment, on_delete=models.CASCADE,null=True, blank=True) def __str__(self): @@ -224,4 +227,12 @@ class SpecialRequest(models.Model): request_receiver = models.CharField(max_length=30, default="--") def __str__(self): - return str(self.request_ann_maker.user.username) \ No newline at end of file + return str(self.request_ann_maker.user.username) + +class medical_relief(models.Model): + description = models.CharField(max_length=200) + file = models.FileField(upload_to='medical_files/') + file_id=models.IntegerField(default=0) + compounder_forward_flag = models.BooleanField(default=False) + acc_admin_forward_flag = models.BooleanField(default=False) + diff --git a/FusionIIIT/applications/health_center/urls.py b/FusionIIIT/applications/health_center/urls.py index a3969188e..77d89dd0a 100644 --- a/FusionIIIT/applications/health_center/urls.py +++ b/FusionIIIT/applications/health_center/urls.py @@ -1,7 +1,7 @@ from django import views from django.conf.urls import url,include -from .views import compounder_view, healthcenter, student_view, schedule_entry,doctor_entry,compounder_entry,announcement +from .views import * app_name = 'healthcenter' @@ -16,10 +16,11 @@ url(r'announcement/', announcement, name='announcement'), #database entry - - + url(r'^schedule_entry', schedule_entry, name='schedule_entry'), url(r'^doctor_entry', doctor_entry, name='doctor_entry'), url(r'^compounder_entry', compounder_entry, name='compounder_entry'), + # url(r'^fetch_designations', fetch_designations, name='fetch_designations'), + url(r'^medical_relief', medicalrelief, name='medical_relief'), #api url(r'^api/',include('applications.health_center.api.urls')) diff --git a/FusionIIIT/applications/health_center/utils.py b/FusionIIIT/applications/health_center/utils.py index e0ec56c75..c47f90d06 100644 --- a/FusionIIIT/applications/health_center/utils.py +++ b/FusionIIIT/applications/health_center/utils.py @@ -2,12 +2,15 @@ from datetime import datetime, timedelta from applications.globals.models import ExtraInfo from django.core import serializers +from applications.filetracking.models import File +from applications.globals.models import ExtraInfo, HoldsDesignation, Designation, DepartmentInfo from django.http import HttpResponse, JsonResponse from notification.views import healthcare_center_notif from .models import (Ambulance_request, Appointment, Complaint, Doctor, Expiry, Hospital, Hospital_admit, Medicine, Prescribed_medicine, Prescription, Doctors_Schedule,Pathologist_Schedule, - Stock, Announcements, SpecialRequest, Pathologist) + Stock, Announcements, SpecialRequest, Pathologist, medical_relief) +from applications.filetracking.sdk.methods import * def datetime_handler(date): ''' @@ -377,14 +380,32 @@ def compounder_view_handler(request): # appointment = Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').get(user_id=user_id,date=datetime.now()) # else: # appointment = None - Prescription.objects.create( + designation=request.POST.get('user') + uploaded_file = request.FILES.get('file') + d = HoldsDesignation.objects.get(user__username=designation) + form_object=Prescription( user_id=user, doctor_id=doctor, details=details, date=datetime.now(), - test=tests, + test=tests, # appointment=appointment ) + form_object.save() + request_object = Prescription.objects.get(pk=form_object.pk) + send_file_id = create_file( + uploader=request.user.username, + uploader_designation=request.session['currentDesignationSelected'], + receiver=designation, + receiver_designation=d.designation, + src_module="health_center", + src_object_id=str(request_object.id), + file_extra_JSON={"value": 2}, + attached_file=uploaded_file + ) + request_object.file_id=send_file_id + request_object.save() + query = Medicine.objects.select_related('patient','patient__user','patient__department').filter(patient=user) prescribe = Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').all().last() for medicine in query: @@ -425,13 +446,18 @@ def compounder_view_handler(request): else: status = 0 Medicine.objects.select_related('patient','patient__user','patient__department').all().delete() + healthcare_center_notif(request.user, user.user, 'presc') data = {'status': status} return JsonResponse(data) elif 'cancel_presc' in request.POST: presc_id = request.POST.get('cancel_presc') - Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').filter(pk=presc_id).delete() + prescription=Prescription.objects.filter(pk=presc_id) + is_deleted = delete_file(id=presciption.file_id) + prescription.delete() + + data = {'status': 1} return JsonResponse(data) elif 'medicine' in request.POST: @@ -439,6 +465,35 @@ def compounder_view_handler(request): thresh = Stock.objects.get(id=med_id).threshold data = {'thresh': thresh} return JsonResponse(data) + elif 'compounder_forward' in request.POST: + acc_admin_des_id = Designation.objects.get(name="Accounts Admin") + user_ids = HoldsDesignation.objects.filter(designation_id=acc_admin_des_id.id).values_list('user_id', flat=True) + acc_admins = ExtraInfo.objects.get(user_id=user_ids[0]) + user=ExtraInfo.objects.get(pk=acc_admins.id) + forwarded_file_id=forward_file( + file_id=request.POST['file_id'], + receiver=acc_admins.id, + receiver_designation="Accounts Admin", + file_extra_JSON= {"value": 2}, + remarks="Forwarded File with id: "+ str(request.POST['file_id'])+"to Accounts Admin "+str(acc_admins.id), + file_attachment=None, + ) + + medical_relief_instance = medical_relief.objects.get(file_id=request.POST['file_id']) + medical_relief_instance.compounder_forward_flag = True + medical_relief_instance.save() + + healthcare_center_notif(request.user,user.user,'rel_approve') + + + + + data = {'status': 1} + return JsonResponse(data) + + + + def student_view_handler(request): @@ -531,4 +586,73 @@ def student_view_handler(request): app_id = request.POST.get('cancel_app') Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').filter(pk=app_id).delete() data = {'status': 1} - return JsonResponse(data) \ No newline at end of file + return JsonResponse(data) + elif 'medical_relief_submit' in request.POST: + designation = request.POST.get('designation') + # print("# #") + # print(designation) + user=ExtraInfo.objects.get(pk=designation) + description = request.POST.get('description') + + # Retrieve the uploaded file from request.FILES + uploaded_file = request.FILES.get('file') + + # Create an instance of the medical_relief model + form_object = medical_relief( + description=description, + file=uploaded_file + ) + + # Save the form object + form_object.save() + + # Retrieve the form object you just saved + request_object = medical_relief.objects.get(pk=form_object.pk) + + # Retrieve HoldsDesignation instances + d = HoldsDesignation.objects.get(user__username=designation) + d1 = HoldsDesignation.objects.get(user__username=request.user) + + # Create a file entry using the create_file utility function + send_file_id = create_file( + uploader=request.user.username, + uploader_designation=request.session['currentDesignationSelected'], + receiver=designation, + receiver_designation=d.designation, + src_module="health_center", + src_object_id=str(request_object.id), + file_extra_JSON={"value": 2}, + attached_file=uploaded_file + ) + healthcare_center_notif(request.user,user.user,'rel_forward') + request_object.file_id = send_file_id + request_object.save() + + # file_details_dict = view_file(file_id=send_file_id) + # print(file_details_dict) + return JsonResponse({'status': 1}) + + elif 'acc_admin_forward' in request.POST: + file_id=request.POST['file_id'] + rec=File.objects.get(id=file_id) + des=Designation.objects.get(pk=rec.designation_id) + user=ExtraInfo.objects.get(pk=rec.uploader_id) + + forwarded_file_id=forward_file( + file_id=request.POST['file_id'], + receiver=rec.uploader_id, + receiver_designation=des.name, + file_extra_JSON= {"value": 2}, + remarks="Forwarded File with id: "+ str(request.POST['file_id'])+"to"+str(rec.id), + file_attachment=None, + ) + medical_relief_instance = medical_relief.objects.get(file_id=request.POST['file_id']) + medical_relief_instance.acc_admin_forward_flag = True + medical_relief_instance.save() + + healthcare_center_notif(request.user,user.user,'rel_approved') + + return JsonResponse({'status':1}) + + + \ No newline at end of file diff --git a/FusionIIIT/applications/health_center/views.py b/FusionIIIT/applications/health_center/views.py index 8ded8b462..3af92e083 100644 --- a/FusionIIIT/applications/health_center/views.py +++ b/FusionIIIT/applications/health_center/views.py @@ -10,11 +10,13 @@ from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.shortcuts import get_object_or_404, render, redirect from notification.views import healthcare_center_notif +from applications.health_center.api.serializers import MedicalReliefSerializer from .models import (Ambulance_request, Appointment, Complaint, Constants, Counter, Doctor,Pathologist, Expiry, Hospital, Hospital_admit, Medicine, Prescribed_medicine, Prescription, Doctors_Schedule,Pathologist_Schedule, - Stock,SpecialRequest,Announcements) + Stock,SpecialRequest,Announcements,medical_relief) from .utils import datetime_handler, compounder_view_handler, student_view_handler +from applications.filetracking.sdk.methods import * @@ -65,12 +67,14 @@ def compounder_view(request): doctors: retrieve Doctor class objects from database ''' # compounder view starts here + usertype = ExtraInfo.objects.select_related('user','department').get(user=request.user).user_type if usertype == 'compounder': if request.method == 'POST': return compounder_view_handler(request) else: + notifs = request.user.notifications.all() all_complaints = Complaint.objects.select_related('user_id','user_id__user','user_id__department').all() all_hospitals = Hospital_admit.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').all().order_by('-admission_date') hospitals_list = Hospital.objects.all().order_by('hospital_name') @@ -79,14 +83,16 @@ def compounder_view(request): appointments_future=Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').filter(date__gt=datetime.now()).order_by('date') users = ExtraInfo.objects.select_related('user','department').filter(user_type='student') stocks = Stock.objects.all() + days = Constants.DAYS_OF_WEEK schedule=Doctors_Schedule.objects.select_related('doctor_id').all().order_by('doctor_id') schedule1=Pathologist_Schedule.objects.select_related('pathologist_id').all().order_by('pathologist_id') expired=Expiry.objects.select_related('medicine_id').filter(expiry_date__lt=datetime.now(),returned=False).order_by('expiry_date') live_meds=Expiry.objects.select_related('medicine_id').filter(returned=False).order_by('quantity') count=Counter.objects.all() - presc_hist=Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').all().order_by('-date') + medicines_presc=Prescribed_medicine.objects.select_related('prescription_id','prescription_id__user_id','prescription_id__user_id__user','prescription_id__user_id__department','prescription_id__doctor_id').all() + print(medicines_presc) if count: Counter.objects.all().delete() Counter.objects.create(count=0,fine=0) @@ -97,16 +103,54 @@ def compounder_view(request): doctors=Doctor.objects.filter(active=True).order_by('id') pathologists=Pathologist.objects.filter(active=True).order_by('id') - - doct= ["Dr. G S Sandhu", "Dr. Jyoti Garg", "Dr. Arvind Nath Gupta"] + prescription= Prescription.objects.all() + report=[] + for pre in prescription: + dic={} + dic['id']=pre.pk + dic['user_id']=pre.user_id_id + dic['doctor_id'] = pre.doctor_id # Use dot notation + dic['date'] = pre.date # Use dot notation + dic['details'] = pre.details # Use dot notation + dic['test'] = pre.test # Use dot notation + if pre.file_id: + dic['file'] = view_file(file_id=pre.file_id)['upload_file'] + else: + dic['file']=None + report.append(dic) + + + + - + #adding file tracking inbox part for compounder + + inbox_files=view_inbox(username=request.user.username,designation='Compounder',src_module='health_center') + medicalrelief=medical_relief.objects.all() + + inbox=[] + for ib in inbox_files: + dic={} + for mr in medicalrelief: + if mr.file_id==int(ib['id']): + dic['id']=ib['id'] + dic['uploader']=ib['uploader'] + dic['upload_date']=datetime.fromisoformat(ib['upload_date']).date() + dic['desc']=mr.description + dic['file']=view_file(file_id=ib['id'])['upload_file'] + dic['status']=mr.compounder_forward_flag + dic['status1']=mr.acc_admin_forward_flag + inbox.append(dic) + + # print(inbox_files) + + return render(request, 'phcModule/phc_compounder.html', {'days': days, 'users': users, 'count': count,'expired':expired, 'stocks': stocks, 'all_complaints': all_complaints, 'all_hospitals': all_hospitals, 'hospitals':hospitals, 'all_ambulances': all_ambulances, - 'appointments_today': appointments_today, 'doctors': doctors, 'pathologists':pathologists, 'doct': doct, - 'appointments_future': appointments_future, 'schedule': schedule, 'schedule1': schedule1, 'live_meds': live_meds, 'presc_hist': presc_hist, 'medicines_presc': medicines_presc, 'hospitals_list': hospitals_list}) + 'appointments_today': appointments_today, 'doctors': doctors, 'pathologists':pathologists, + 'appointments_future': appointments_future, 'schedule': schedule, 'schedule1': schedule1, 'live_meds': live_meds, 'presc_hist': report, 'medicines_presc': medicines_presc, 'hospitals_list': hospitals_list,'inbox_files':inbox}) elif usertype == 'student': return HttpResponseRedirect("/healthcenter/student") # compounder view ends @@ -131,18 +175,20 @@ def student_view(request): doctors: retrieve Doctor class objects from database ''' # student view starts here + usertype = ExtraInfo.objects.select_related('user','department').get(user=request.user).user_type if usertype == 'student' or usertype == 'faculty' or usertype == 'staff': if request.method == 'POST': return student_view_handler(request) else: + notifs = request.user.notifications.all() users = ExtraInfo.objects.all() user_id = ExtraInfo.objects.select_related('user','department').get(user=request.user) hospitals = Hospital_admit.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').filter(user_id=user_id).order_by('-admission_date') appointments = Appointment.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','schedule','schedule__doctor_id').filter(user_id=user_id).order_by('-date') ambulances = Ambulance_request.objects.select_related('user_id','user_id__user','user_id__department').filter(user_id=user_id).order_by('-date_request') - prescription = Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id').filter(user_id=user_id).order_by('-date') + medicines = Prescribed_medicine.objects.select_related('prescription_id','prescription_id__user_id','prescription_id__user_id__user','prescription_id__user_id__department','prescription_id__doctor_id','medicine_id').all() complaints = Complaint.objects.select_related('user_id','user_id__user','user_id__department').filter(user_id=user_id).order_by('-date') days = Constants.DAYS_OF_WEEK @@ -151,6 +197,24 @@ def student_view(request): doctors=Doctor.objects.filter(active=True) pathologists=Pathologist.objects.filter(active=True) + #prescription + prescription= Prescription.objects.filter(user_id=request.user.username) + report=[] + for pre in prescription: + dic={} + dic['id']=pre.id + dic['doctor_id'] = pre.doctor_id # Use dot notation + dic['date'] = pre.date # Use dot notation + dic['details'] = pre.details # Use dot notation + dic['test'] = pre.test # Use dot notation + if pre.file_id: + dic['file'] = view_file(file_id=pre.file_id)['upload_file'] + else: + dic['file']=None + + + report.append(dic) + count=Counter.objects.all() if count: @@ -158,14 +222,58 @@ def student_view(request): Counter.objects.create(count=0,fine=0) count=Counter.objects.get() - doct= ["Dr. G S Sandhu", "Dr. Jyoti Garg", "Dr. Arvind Nath Gupta"] - + designations = Designation.objects.filter() + holdsDesignations = [] + for d in designations: + if d.name == "Compounder": + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + acc_admin_inbox=view_inbox(username=request.user.username,designation='Accounts Admin',src_module='health_center') + medicalrelief=medical_relief.objects.all() + acc_ib=[] + for ib in acc_admin_inbox: + dic={} + + for mr in medicalrelief: + if mr.file_id == int(ib['id']): + dic['id']=ib['id'] + dic['uploader']=ib['uploader'] + dic['upload_date']=datetime.fromisoformat(ib['upload_date']).date() + dic['desc']=mr.description + dic['file']=view_file(file_id=ib['id'])['upload_file'] + dic['status']=mr.acc_admin_forward_flag + acc_ib.append(dic) + uploader_outbox=view_outbox(username=request.user.username,designation=request.session['currentDesignationSelected'] ,src_module='health_center') + + + uploader_inbox=view_inbox(username=request.user.username,designation=request.session['currentDesignationSelected'],src_module='health_center') + medicalRelief=[] + + for out in uploader_outbox: + dic={} + + for mr in medicalrelief: + if mr.file_id==int(out['id']): + dic['id']=out['id'] + dic['upload_date']=datetime.fromisoformat(out['upload_date']).date() + dic['desc']=mr.description + dic['file']=view_file(file_id=out['id'])['upload_file'] + dic['status']=mr.acc_admin_forward_flag + dic['approval_date']='' + + for inb in uploader_inbox: + if dic['id']==inb['id']: + dic['approval_date']=datetime.fromisoformat(inb['upload_date']).date() + medicalRelief.append(dic) + + return render(request, 'phcModule/phc_student.html', {'complaints': complaints, 'medicines': medicines, 'ambulances': ambulances, 'doctors': doctors, 'pathologists':pathologists, 'days': days,'count':count, 'hospitals': hospitals, 'appointments': appointments, - 'prescription': prescription, 'schedule': schedule, 'schedule1': schedule1,'users': users,'doct': doct, 'curr_date': datetime.now().date()}) + 'prescription': report, 'schedule': schedule, 'schedule1': schedule1,'users': users, 'curr_date': datetime.now().date(),'holdsDesignations':holdsDesignations,'acc_admin_inbox':acc_ib,'medicalRelief':medicalRelief}) elif usertype == 'compounder': return HttpResponseRedirect("/healthcenter/compounder") # student view ends @@ -459,4 +567,43 @@ def announcement(request): return render(request, 'health_center/make_announce_comp.html', {"user_designation":user_info.user_type, "announcements":context, "request_to":requests_received - }) \ No newline at end of file + }) + +# def fetch_designations(request): +# designations = Designation.objects.all() + +# holdsDesignations = [] + +# for d in designations: +# if d.name == "Compounder" or d.name == "Accounts Admin": +# list = HoldsDesignation.objects.filter(designation=d) +# holdsDesignations.append(list) + +# return render(request, 'phcModule/medical_relief.html', {'holdsDesignations' : holdsDesignations}) + +def medicalrelief(request): + print(request) + + + if request.method == 'POST': + # print(request.POST['name']) + formObject = medical_relief() + formObject.description = request.POST['description'] + formObject.file = request.POST['file'] + formObject.save() + request_object = medical_relief.objects.get(pk=formObject.pk) + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + print(d) + print(d1) + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="health_center", + src_object_id= str(request_object.id), + file_extra_JSON= {"value": 2}, + attached_file = None) + + + return render(request, 'phcModule/medical_relief.html', {'holdsDesignations' : holdsDesignations}) \ No newline at end of file diff --git a/FusionIIIT/applications/hostel_management/admin.py b/FusionIIIT/applications/hostel_management/admin.py index 0ab767ac1..8e8917269 100644 --- a/FusionIIIT/applications/hostel_management/admin.py +++ b/FusionIIIT/applications/hostel_management/admin.py @@ -5,10 +5,20 @@ admin.site.register(Hall) admin.site.register(HallCaretaker) admin.site.register(HallWarden) -admin.site.register(GuestRoomDetail) + admin.site.register(GuestRoomBooking) admin.site.register(StaffSchedule) admin.site.register(HostelNoticeBoard) admin.site.register(HostelStudentAttendence) admin.site.register(HallRoom) -admin.site.register(WorkerReport) \ No newline at end of file +admin.site.register(WorkerReport) +admin.site.register(HostelInventory) +admin.site.register(HostelFine) +admin.site.register(HostelLeave) +admin.site.register(HostelComplaint) +admin.site.register(StudentDetails) +admin.site.register(HostelAllotment) +admin.site.register(GuestRoom) +admin.site.register(HostelTransactionHistory) +admin.site.register(HostelHistory) + diff --git a/FusionIIIT/applications/hostel_management/forms.py b/FusionIIIT/applications/hostel_management/forms.py index a727bd069..8a1780d27 100644 --- a/FusionIIIT/applications/hostel_management/forms.py +++ b/FusionIIIT/applications/hostel_management/forms.py @@ -1,9 +1,33 @@ from django import forms -from .models import HostelNoticeBoard, Hall +from .models import HostelNoticeBoard, Hall, GuestRoomBooking class HostelNoticeBoardForm(forms.ModelForm): class Meta: model = HostelNoticeBoard fields = ('hall', 'head_line', 'content', 'description') - \ No newline at end of file + +class HallForm(forms.ModelForm): + class Meta: + model = Hall + fields = ['hall_id', 'hall_name', 'max_accomodation', 'assigned_batch','type_of_seater'] + +class GuestRoomBookingForm(forms.ModelForm): + class Meta: + model = GuestRoomBooking + fields = ( + 'hall', + 'guest_name', + 'guest_phone', + 'guest_email', + 'guest_address', + 'rooms_required', + 'total_guest', + 'purpose', + 'arrival_date', + 'arrival_time', + 'departure_date', + 'departure_time', + 'nationality', + 'room_type' + ) \ No newline at end of file diff --git a/FusionIIIT/applications/hostel_management/management/commands/copy_data.py b/FusionIIIT/applications/hostel_management/management/commands/copy_data.py new file mode 100644 index 000000000..370583025 --- /dev/null +++ b/FusionIIIT/applications/hostel_management/management/commands/copy_data.py @@ -0,0 +1,36 @@ +from applications.academic_information.models import Student +from applications.hostel_management.models import StudentDetails +from django.contrib.auth.models import User + + +def copy_data(): + + # Fetch data from the Student table with a join to the User table + student_data = Student.objects.all() + + # Iterate over the student data and create StudentDetails instances + for student_instance in student_data: + # Extract data from the related User instance + id = student_instance.id_id + user_instance = User.objects.filter(username=id).first(); + user_instance = User.objects.get(username=id) + + # Create a StudentDetails instance using data from the Student and User instances + student_details_instance = StudentDetails( + id=student_instance.id_id, + first_name=user_instance.first_name, + last_name=user_instance.last_name, + programme=student_instance.programme, + batch=student_instance.batch, + room_num=student_instance.room_no, + hall_no=student_instance.hall_no, + specialization=student_instance.specialization, + # parent_contact=student_instance.parent_contact, + # address=student_instance.address + ) + + # Save the StudentDetails instance to the database + student_details_instance.save() + +# Call the function to initiate the data copying process +copy_data() diff --git a/FusionIIIT/applications/hostel_management/migrations/0001_initial.py b/FusionIIIT/applications/hostel_management/migrations/0001_initial.py index ef1639d4c..8659d1649 100644 --- a/FusionIIIT/applications/hostel_management/migrations/0001_initial.py +++ b/FusionIIIT/applications/hostel_management/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.conf import settings from django.db import migrations, models @@ -12,9 +12,9 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('academic_information', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('globals', '0001_initial'), + ('academic_information', '0001_initial'), ] operations = [ diff --git a/FusionIIIT/applications/hostel_management/models.py b/FusionIIIT/applications/hostel_management/models.py index 9b667d9e2..9c20f9b6e 100644 --- a/FusionIIIT/applications/hostel_management/models.py +++ b/FusionIIIT/applications/hostel_management/models.py @@ -48,7 +48,14 @@ class Hall(models.Model): hall_name = models.CharField(max_length=50) max_accomodation = models.IntegerField(default=0) number_students = models.PositiveIntegerField(default=0) - + assigned_batch = models.CharField(max_length=50, null=True, blank=True) + TYPE_OF_SEATER_CHOICES = [ + ('single', 'Single Seater'), + ('double', 'Double Seater'), + ('triple', 'Triple Seater'), + ] + + type_of_seater = models.CharField(max_length=50, choices=TYPE_OF_SEATER_CHOICES, default='single') def __str__(self): return self.hall_id @@ -81,20 +88,6 @@ def __str__(self): return str(self.hall) + ' (' + str(self.faculty.id.user.username) + ')' -class GuestRoomDetail(models.Model): - """ - Records information related to guest rooms in Hall of Residences. - - 'hall' refers to the related Hall of Residence. - 'room_no' stores the guest room number. - 'room_status' stores the current status of the guest room from the available choices in 'ROOM_STATUS'. - """ - hall = models.ForeignKey(Hall, on_delete=models.CASCADE) - room_no = models.CharField(max_length=4, unique=True) - room_status = models.CharField(max_length=20, choices=HostelManagementConstants.ROOM_STATUS, default='Available') - - def __str__(self): - return self.room_no class GuestRoomBooking(models.Model): @@ -116,26 +109,34 @@ class GuestRoomBooking(models.Model): """ hall = models.ForeignKey(Hall, on_delete=models.CASCADE) intender = models.ForeignKey(User, on_delete=models.CASCADE) - guest_name = models.CharField(max_length=100) - guest_phone = models.CharField(max_length=15) - guest_email = models.CharField(max_length=40, blank=True) + guest_name = models.CharField(max_length=255) + guest_phone = models.CharField(max_length=255) + guest_email = models.CharField(max_length=255, blank=True) guest_address = models.TextField(blank=True) - rooms_required = models.IntegerField(default=1,null=True,blank=True) - guest_room_id = models.ManyToManyField(GuestRoomDetail) + rooms_required = models.IntegerField(default=1, null=True, blank=True) + guest_room_id = models.CharField(max_length=255, blank=True) total_guest = models.IntegerField(default=1) purpose = models.TextField() arrival_date = models.DateField(auto_now_add=False, auto_now=False) arrival_time = models.TimeField(auto_now_add=False, auto_now=False) departure_date = models.DateField(auto_now_add=False, auto_now=False) departure_time = models.TimeField(auto_now_add=False, auto_now=False) - status = models.CharField(max_length=15, choices=HostelManagementConstants.BOOKING_STATUS ,default ="Pending") + status = models.CharField(max_length=255, choices=HostelManagementConstants.BOOKING_STATUS ,default ="Pending") booking_date = models.DateField(auto_now_add=False, auto_now=False, default=timezone.now) - nationality = models.CharField(max_length=20, blank=True) + nationality = models.CharField(max_length=255, blank=True) + ROOM_TYPES = [ + ('single', 'Single'), + ('double', 'Double'), + ('triple', 'Triple'), + # Add more room types as needed + ] + room_type = models.CharField(max_length=10, choices=ROOM_TYPES ,default='single') def __str__(self): return '%s ----> %s - %s' % (self.id, self.guest_name, self.status) + class StaffSchedule(models.Model): """ Records schedule of staffs in various Hall of Residences. @@ -146,8 +147,8 @@ class StaffSchedule(models.Model): 'start_time' stores the start time of a schedule. 'end_time' stores the end time of a schedule. """ - hall = models.ForeignKey(Hall, on_delete=models.CASCADE) - staff_id = models.ForeignKey(Staff, on_delete=models.ForeignKey) + hall = models.ForeignKey(Hall, on_delete=models.CASCADE) + staff_id = models.ForeignKey(Staff, on_delete=models.CASCADE) staff_type = models.CharField(max_length=100, default='Caretaker') day = models.CharField(max_length=15, choices=HostelManagementConstants.DAYS_OF_WEEK) start_time = models.TimeField(null=True,blank=True) @@ -234,6 +235,137 @@ class WorkerReport(models.Model): absent = models.IntegerField(default= 0) total_day = models.IntegerField(default=31) remark = models.CharField(max_length=100) - def str(self): - return str(self.worker_name)+'->' + str(self.month) + '-' + str(self.absent) \ No newline at end of file + return str(self.worker_name)+'->' + str(self.month) + '-' + str(self.absent) + + + +class HostelInventory(models.Model): + """ + Model to store hostel inventory information. + """ + + inventory_id = models.AutoField(primary_key=True) + hall = models.ForeignKey(Hall, on_delete=models.CASCADE) + inventory_name = models.CharField(max_length=100) + cost = models.DecimalField(max_digits=10, decimal_places=2) + quantity = models.PositiveIntegerField(default=0) + + def __str__(self): + return self.inventory_name + + +class HostelLeave(models.Model): + student_name = models.CharField(max_length=100) + roll_num = models.CharField(max_length=20) + reason = models.TextField() + phone_number = models.CharField(max_length=20, null=True,blank=True) + start_date = models.DateField(default=timezone.now) + end_date = models.DateField() + status = models.CharField(max_length=20, default='pending') + remark = models.TextField(blank=True, null=True) + file_upload = models.FileField(upload_to='hostel_management/', null=True, blank=True) + + def _str_(self): + return f"{self.student_name}'s Leave" + +# changes + +class HostelComplaint(models.Model): + hall_name = models.CharField(max_length=100) + student_name = models.CharField(max_length=100) + roll_number = models.CharField(max_length=20) + description = models.TextField() + contact_number = models.CharField(max_length=15) + + def __str__(self): + return f"Complaint from {self.student_name} in {self.hall_name}" + + +class HostelAllotment(models.Model): + hall = models.ForeignKey(Hall, on_delete=models.CASCADE) + assignedCaretaker = models.ForeignKey(Staff, on_delete=models.CASCADE ,null=True) + assignedWarden = models.ForeignKey(Faculty, on_delete=models.CASCADE ,null=True) + assignedBatch=models.CharField(max_length=50) + def __str__(self): + return str(self.hall)+ str(self.assignedCaretaker)+str(self.assignedWarden) + str(self.assignedBatch) + +class StudentDetails(models.Model): + id = models.CharField(primary_key=True, max_length=20) + first_name = models.CharField(max_length=100,blank=True,null=True) + last_name = models.CharField(max_length=100,blank=True,null=True) + programme = models.CharField(max_length=100,blank=True,null=True) + batch = models.CharField(max_length=100,blank=True,null=True) + room_num= models.CharField(max_length=20,blank=True,null=True) + hall_no= models.CharField(max_length=20,blank=True,null=True) + hall_id=models.CharField(max_length=20,blank=True,null=True) + specialization = models.CharField(max_length=100,blank=True,null=True) + parent_contact = models.CharField(max_length=20, blank=True, null=True) + address = models.CharField(max_length=255, blank=True, null=True) + + def __str__(self): + return self.first_name + + + +class GuestRoom(models.Model): + """ + 'hall' foreign key: the hostel to which the room belongs + 'room' guest room number + 'vacant' boolean value to determine if the room is vacant + 'occupied_till', date field that tells the next time the room will be vacant, null if 'vacant' == True + """ + ROOM_TYPES = [ + ('single', 'Single'), + ('double', 'Double'), + ('triple', 'Triple'), + ] + hall = models.ForeignKey(Hall, on_delete=models.CASCADE) + room = models.CharField(max_length=255) + occupied_till = models.DateField(null=True, blank=True) + vacant = models.BooleanField(default=True) + room_type = models.CharField(max_length=10, choices=ROOM_TYPES ,default='single') + @property + def _vacant(self) -> bool: + if self.occupied_till and self.occupied_till > timezone.now(): + self.vacant = False + self.vacant = True + + + +class HostelFine(models.Model): + fine_id = models.AutoField(primary_key=True) + student = models.ForeignKey(Student, on_delete=models.CASCADE) + hall = models.ForeignKey(Hall, on_delete=models.CASCADE,default=1) + student_name = models.CharField(max_length=100) + amount = models.DecimalField(max_digits=10, decimal_places=2) + STATUS_CHOICES = [ + ('Pending', 'Pending'), + ('Paid', 'Paid'), + ] + status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='Pending') + reason = models.TextField() + + def __str__(self): + return f"{self.student_name}'s Fine - {self.amount} - {self.status}" + + +class HostelTransactionHistory(models.Model): + hall = models.ForeignKey(Hall, on_delete=models.CASCADE) + change_type = models.CharField(max_length=100) # Example: 'Caretaker', 'Warden', 'Batch' + previous_value = models.CharField(max_length=255) + new_value = models.CharField(max_length=255) + timestamp = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"{self.change_type} change in {self.hall} at {self.timestamp}" + +class HostelHistory(models.Model): + hall = models.ForeignKey(Hall, on_delete=models.CASCADE) + timestamp = models.DateTimeField(default=timezone.now) + caretaker = models.ForeignKey(Staff, on_delete=models.SET_NULL, null=True, related_name='caretaker_history') + batch = models.CharField(max_length=50, null=True) + warden = models.ForeignKey(Faculty, on_delete=models.SET_NULL, null=True, related_name='warden_history') + + def __str__(self): + return f"History for {self.hall.hall_name} - {self.timestamp}" \ No newline at end of file diff --git a/FusionIIIT/applications/hostel_management/urls.py b/FusionIIIT/applications/hostel_management/urls.py index f0ea19b1d..95fcdeeb8 100644 --- a/FusionIIIT/applications/hostel_management/urls.py +++ b/FusionIIIT/applications/hostel_management/urls.py @@ -1,11 +1,18 @@ from django.urls import path from . import views +from django.contrib.auth import views as auth_views +from django.urls import include +from django.contrib import admin +from django.conf.urls import url, include app_name = 'hostelmanagement' urlpatterns = [ + + path('admin/', admin.site.urls), #Home path('', views.hostel_view, name="hostel_view"), + path('/hello', views.hostel_view, name="hello"), #Notice Board path('notice_form/', views.notice_board, name="notice_board"), @@ -28,4 +35,84 @@ #Worker Report path('worker_report/', views.generate_worker_report, name='workerreport'), path('pdf/', views.GeneratePDF.as_view(), name="pdf"), + + + + #for superUser + + path('hostel-notices/', views.hostel_notice_board, name='hostel_notices_board'), + # //caretaker and warden can see all leaves + path('all_leave_data/', views.all_leave_data, name='all_leave_data'), + # caretaker or wardern can approve leave + path('update_leave_status/', views.update_leave_status, name='update_leave_status'), + # //apply for leave + path('create_hostel_leave/', views.create_hostel_leave, name='create_hostel_leave'), + + # caretaker and warden can get all complaints + path('hostel_complaints/', views.hostel_complaint_list, name='hostel_complaint_list'), + + path('register_complaint/', views.PostComplaint.as_view(), name='PostComplaint'), + +# Student can view his leave status + path('my_leaves/', views.my_leaves.as_view(), name='my_leaves'), + path('get_students/', views.get_students, name='get_students'), + + + + + + path('assign-batch/', views.AssignBatchView.as_view(),name='AssignBatchView'), + path('hall-ids/', views.HallIdView.as_view(), name='hall'), + path('assign-caretaker', views.AssignCaretakerView.as_view(), name='AssignCaretakerView'), + path('assign-warden',views.AssignWardenView.as_view(), name='AssignWardenView'), + path('add-hostel', views.AddHostelView.as_view(), name='add_hostel'), + path('admin-hostel-list', views.AdminHostelListView.as_view(), name='admin_hostel_list'), # URL for displaying the list of hostels + path('delete-hostel//', views.DeleteHostelView.as_view(), name='delete_hostel'), + + path('check-hall-exists/', views.CheckHallExistsView.as_view(), name='check_hall_exists'), + path('accounts/', include('django.contrib.auth.urls')), + path('logout/', views.logout_view, name='logout_view'), + # path('logout/', auth_views.LogoutView.as_view(), name='logout'), + + # !! My Change + path('allotted_rooms//', views.alloted_rooms, name="alloted_rooms"), + + path('all_staff//', views.all_staff, name='all_staff'), + path('staff//', views.StaffScheduleView.as_view(), name='staff_schedule'), + + # !!? Inventory + path('inventory/', views.HostelInventoryView.as_view(), name='hostel_inventory_list'), + path('inventory//modify/', views.HostelInventoryUpdateView.as_view(), name='hostel_inventory_update'), + path('inventory//delete/', views.HostelInventoryView.as_view(), name='hostel_inventory_delete'), + path('inventory//', views.HostelInventoryView.as_view(), name='hostel_inventory_by_hall'), + path('inventory/form/', views.get_inventory_form, name='get_inventory_form'), + path('inventory/edit_inventory//', views.edit_inventory, name='edit_inventory'), + path('allotted_rooms/', views.alloted_rooms_main, name="alloted_rooms"), + path('all_staff/', views.all_staff, name='all_staff'), + + #guest room + path('book_guest_room/', views.request_guest_room, name="book_guest_room"), + path('update_guest_room/', views.update_guest_room, name="update_guest_room"), + path('available_guest_rooms/', views.available_guestrooms_api, name='available_guestrooms_api'), + + + # !!todo: Add Fine Functionality + path('fine/', views.impose_fine_view, name='fine_form_show'), + path('fine/impose/', views.HostelFineView.as_view(), name='fine_form_show'), + path('fine/impose/list/', views.hostel_fine_list, name='fine_list_show'), + path('fine/impose/edit//', views.show_fine_edit_form, name='hostel_fine_edit'), + path('fine/impose/update//', views.update_student_fine, name='update_student_fine'), + path('fine/impose/list/update//', views.HostelFineUpdateView.as_view(), name='fine_update'), + path('fine/delete//', views.HostelFineUpdateView.as_view(), name='fine_delete'), + path('fine/show/', views.student_fine_details, name='fine_show'), + + + + path('student//name/', views.get_student_name, name='find_name'), + + + path('edit-student//', views.EditStudentView.as_view(), name='edit_student'), + path('remove-student//', views.RemoveStudentView.as_view(), name='remove-student'), + + ] \ No newline at end of file diff --git a/FusionIIIT/applications/hostel_management/utils.py b/FusionIIIT/applications/hostel_management/utils.py index 7c7a76648..101ae76df 100644 --- a/FusionIIIT/applications/hostel_management/utils.py +++ b/FusionIIIT/applications/hostel_management/utils.py @@ -2,6 +2,8 @@ from xhtml2pdf import pisa from io import BytesIO from django.http import HttpResponse +from django.db import transaction +from datetime import datetime from .models import * import re @@ -54,22 +56,65 @@ def render_to_pdf(template_src, context_dict={}): return HttpResponse(result.getvalue(), content_type='application/pdf') return None -def save_worker_report_sheet(excel,sheet,user_id): +def save_worker_report_sheet(excel, sheet, user_id): """ This function saves details of worker report sheet into the database. """ - month = excel.sheet_names()[0][:2] - year = excel.sheet_names()[0][3:] - for row in range(1, sheet.nrows): - worker_id = str(sheet.cell(row,0).value) - worker_name = str(sheet.cell(row,1).value) - present = 0 - for col in range(2, sheet.ncols): - if int(sheet.cell(row,col).value) == 1: - present += 1 - working_days = sheet.ncols - 2 - absent = working_days-present - hall_no = HallCaretaker.objects.get(staff__id=user_id).hall - print(month,year) - new_report = WorkerReport.objects.create(worker_id=worker_id, hall=hall_no, worker_name=worker_name, month=month, year=year, absent=absent, total_day=working_days, remark="none") - new_report.save() \ No newline at end of file + try: + # Iterate over each row in the sheet + for row in range(0, sheet.nrows): + worker_id = str(sheet.cell_value(row, 0)) + worker_name = str(sheet.cell_value(row, 1)) + # Initialize present days counter + present = 0 + + # Loop through columns starting from the third column (index 2) + for col in range(2, sheet.ncols): + # Check if the cell value is 1 (indicating the worker was present) + if int(sheet.cell_value(row, col)) == 1: + present += 1 + + # Calculate total working days + working_days = sheet.ncols - 2 + + # Calculate the number of days the worker was absent + absent = working_days - present + + # Get today's date, month, and year + today_date = datetime.today() + month = today_date.month + year = today_date.year + + # Get the hall associated with the current user + hall_no = HallCaretaker.objects.get(staff__id=user_id).hall + # print("hall no ~~~~ ",hall_no) + # print("month ~~~~ ",month, year) + # Save the data in a transaction + with transaction.atomic(): + # Create and save a new WorkerReport instance + new_report = WorkerReport.objects.create(worker_id=worker_id, hall=hall_no, worker_name=worker_name, + month=month, year=year, absent=absent, total_day=working_days, remark="none") + new_report.save() + except Exception as e: + print("Error:", e) + # Handle the error here, such as logging it or displaying a message to the user + +# def save_worker_report_sheet(excel,sheet,user_id): +# """ +# This function saves details of worker report sheet into the database. +# """ +# month = excel.sheet_names()[0][:2] +# year = excel.sheet_names()[0][3:] +# for row in range(1, sheet.nrows): +# worker_id = str(sheet.cell(row,0).value) +# worker_name = str(sheet.cell(row,1).value) +# present = 0 +# for col in range(2, sheet.ncols): +# if int(sheet.cell(row,col).value) == 1: +# present += 1 +# working_days = sheet.ncols - 2 +# absent = working_days-present +# hall_no = HallCaretaker.objects.get(staff__id=user_id).hall +# print(month,year) +# new_report = WorkerReport.objects.create(worker_id=worker_id, hall=hall_no, worker_name=worker_name, month=month, year=year, absent=absent, total_day=working_days, remark="none") +# new_report.save() \ No newline at end of file diff --git a/FusionIIIT/applications/hostel_management/views.py b/FusionIIIT/applications/hostel_management/views.py index 0015748a4..78f317135 100644 --- a/FusionIIIT/applications/hostel_management/views.py +++ b/FusionIIIT/applications/hostel_management/views.py @@ -1,8 +1,45 @@ +from django.core.serializers import serialize +from django.http import HttpResponseBadRequest +from .models import HostelLeave, HallCaretaker +from applications.hostel_management.models import HallCaretaker, HallWarden +from django.http import JsonResponse, HttpResponse +from django.db import IntegrityError +from rest_framework.exceptions import NotFound +from django.shortcuts import redirect +from django.template import loader +from django.shortcuts import get_object_or_404 from django.shortcuts import render from django.http import HttpResponseRedirect +from django.shortcuts import render, HttpResponse +from django.views.decorators.csrf import csrf_exempt +from rest_framework.permissions import IsAuthenticated +from .models import HallCaretaker, HallWarden from django.urls import reverse +from .models import StudentDetails +from rest_framework.exceptions import APIException + + + +from django.shortcuts import render, redirect + +from .models import HostelLeave +from rest_framework.authentication import SessionAuthentication, BasicAuthentication +from django.utils.decorators import method_decorator +from django.contrib.auth.decorators import login_required +from django.db.models import Q + +from rest_framework.views import APIView +from rest_framework.response import Response +from rest_framework.authentication import SessionAuthentication +from rest_framework.permissions import IsAuthenticated +from rest_framework import status + + + from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User +# from .models import HostelStudentAttendance +from django.http import JsonResponse from applications.globals.models import (Designation, ExtraInfo, HoldsDesignation, DepartmentInfo) from applications.academic_information.models import Student @@ -10,18 +47,46 @@ from django.db.models import Q import datetime from datetime import time, datetime, date -from time import mktime, time,localtime +from time import mktime, time, localtime from .models import * import xlrd -from .forms import HostelNoticeBoardForm +from .forms import GuestRoomBookingForm, HostelNoticeBoardForm import re from django.http import HttpResponse from django.template.loader import get_template from django.views.generic import View from django.db.models import Q from django.contrib import messages -from .utils import render_to_pdf, save_worker_report_sheet,get_caretaker_hall +from .utils import render_to_pdf, save_worker_report_sheet, get_caretaker_hall from .utils import add_to_room, remove_from_room +from rest_framework.views import APIView +from rest_framework.response import Response +from rest_framework import status +from django.http import JsonResponse +from rest_framework.authentication import SessionAuthentication +from rest_framework.permissions import IsAuthenticated +import json + +from django.utils.decorators import method_decorator +from django.contrib.auth.decorators import user_passes_test +from django.contrib.auth import logout +from django.contrib.auth.decorators import login_required +from Fusion.settings.common import LOGIN_URL +from django.shortcuts import get_object_or_404, redirect, render +from django.db import transaction +from .forms import HallForm +from notification.views import hostel_notifications +from django.db.models.signals import post_save +from django.dispatch import receiver +from django.db import transaction + + +def is_superuser(user): + return user.is_authenticated and user.is_superuser + + +# //! My change + @login_required def hostel_view(request, context={}): @@ -39,94 +104,335 @@ def hostel_view(request, context={}): all_hall - stores all the hall of residence all_notice - stores all notices of hostels (latest first) """ - + # Check if the user is a superuser + is_superuser = request.user.is_superuser + all_hall = Hall.objects.all() halls_student = {} for hall in all_hall: - halls_student[hall.hall_id] = Student.objects.filter(hall_no=int(hall.hall_id[4])).select_related('id__user') + halls_student[hall.hall_id] = Student.objects.filter( + hall_no=int(hall.hall_id[4])).select_related('id__user') hall_staffs = {} for hall in all_hall: - hall_staffs[hall.hall_id] = StaffSchedule.objects.filter(hall=hall).select_related('staff_id__id__user') + hall_staffs[hall.hall_id] = StaffSchedule.objects.filter( + hall=hall).select_related('staff_id__id__user') all_notice = HostelNoticeBoard.objects.all().order_by("-id") hall_notices = {} for hall in all_hall: - hall_notices[hall.hall_id] = HostelNoticeBoard.objects.filter(hall=hall).select_related('hall','posted_by__user') + hall_notices[hall.hall_id] = HostelNoticeBoard.objects.filter( + hall=hall).select_related('hall', 'posted_by__user') + + pending_guest_room_requests = {} + for hall in all_hall: + pending_guest_room_requests[hall.hall_id] = GuestRoomBooking.objects.filter( + hall=hall, status='Pending').select_related('hall', 'intender') + + + guest_rooms = {} + for hall in all_hall: + guest_rooms[hall.hall_id] = GuestRoom.objects.filter( + hall=hall,vacant=True).select_related('hall') + user_guest_room_requests = GuestRoomBooking.objects.filter( + intender=request.user).order_by("-arrival_date") + + halls = Hall.objects.all() + # Create a list to store additional details + hostel_details = [] + + # Loop through each hall and fetch assignedCaretaker and assignedWarden + for hall in halls: + try: + caretaker = HallCaretaker.objects.filter(hall=hall).first() + warden = HallWarden.objects.filter(hall=hall).first() + except HostelAllotment.DoesNotExist: + assigned_caretaker = None + assigned_warden = None + + vacant_seat=(hall.max_accomodation-hall.number_students) + hostel_detail = { + 'hall_id': hall.hall_id, + 'hall_name': hall.hall_name, + 'seater_type':hall.type_of_seater, + 'max_accomodation': hall.max_accomodation, + 'number_students': hall.number_students, + 'vacant_seat':vacant_seat, + 'assigned_batch': hall.assigned_batch, + 'assigned_caretaker': caretaker.staff.id.user.username if caretaker else None, + 'assigned_warden': warden.faculty.id.user.username if warden else None, + } + + hostel_details.append(hostel_detail) Staff_obj = Staff.objects.all().select_related('id__user') hall1 = Hall.objects.get(hall_id='hall1') - hall3=Hall.objects.get(hall_id='hall3') - hall4=Hall.objects.get(hall_id='hall4') + hall3 = Hall.objects.get(hall_id='hall3') + hall4 = Hall.objects.get(hall_id='hall4') hall1_staff = StaffSchedule.objects.filter(hall=hall1) hall3_staff = StaffSchedule.objects.filter(hall=hall3) hall4_staff = StaffSchedule.objects.filter(hall=hall4) hall_caretakers = HallCaretaker.objects.all().select_related() hall_wardens = HallWarden.objects.all().select_related() - - hall_student="" - current_hall="" - get_avail_room=[] - get_hall=get_caretaker_hall(hall_caretakers,request.user) + all_students = Student.objects.all().select_related('id__user') + all_students_id = [] + for student in all_students: + all_students_id.append(student.id_id) + # print(all_students) + hall_student = "" + current_hall = "" + get_avail_room = [] + get_hall = get_caretaker_hall(hall_caretakers, request.user) if get_hall: - get_hall_num=re.findall('[0-9]+',str(get_hall.hall_id)) - hall_student=Student.objects.filter(hall_no=int(str(get_hall_num[0]))).select_related('id__user') - current_hall='hall'+str(get_hall_num[0]) - + get_hall_num = re.findall('[0-9]+', str(get_hall.hall_id)) + hall_student = Student.objects.filter(hall_no=int( + str(get_hall_num[0]))).select_related('id__user') + current_hall = 'hall'+str(get_hall_num[0]) + for hall in all_hall: - total_rooms=HallRoom.objects.filter(hall=hall) + total_rooms = HallRoom.objects.filter(hall=hall) for room in total_rooms: - if(room.room_cap>room.room_occupied): + if (room.room_cap > room.room_occupied): get_avail_room.append(room) - hall_caretaker_user=[] + hall_caretaker_user = [] for caretaker in hall_caretakers: hall_caretaker_user.append(caretaker.staff.id.user) hall_warden_user = [] for warden in hall_wardens: hall_warden_user.append(warden.faculty.id.user) - + + all_students = Student.objects.all().select_related('id__user') + all_students_id = [] + for student in all_students: + all_students_id.append(student.id_id) + todays_date = date.today() current_year = todays_date.year current_month = todays_date.month if current_month != 1: - worker_report = WorkerReport.objects.filter(Q(hall__hall_id=current_hall, year=current_year, month=current_month) | Q(hall__hall_id=current_hall, year=current_year, month=current_month-1)) + worker_report = WorkerReport.objects.filter(Q(hall__hall_id=current_hall, year=current_year, month=current_month) | Q( + hall__hall_id=current_hall, year=current_year, month=current_month-1)) else: - worker_report = WorkerReport.objects.filter(hall__hall_id=current_hall, year=current_year-1, month=12) + worker_report = WorkerReport.objects.filter( + hall__hall_id=current_hall, year=current_year-1, month=12) attendance = HostelStudentAttendence.objects.all().select_related() halls_attendance = {} for hall in all_hall: - halls_attendance[hall.hall_id] = HostelStudentAttendence.objects.filter(hall=hall).select_related() + halls_attendance[hall.hall_id] = HostelStudentAttendence.objects.filter( + hall=hall).select_related() + + user_complaints = HostelComplaint.objects.filter( + roll_number=request.user.username) + user_leaves = HostelLeave.objects.filter(roll_num=request.user.username) + my_leaves = [] + for leave in user_leaves: + my_leaves.append(leave) + my_complaints = [] + for complaint in user_complaints: + my_complaints.append(complaint) + + all_leaves = HostelLeave.objects.all() + all_complaints = HostelComplaint.objects.all() + + add_hostel_form = HallForm() + warden_ids = Faculty.objects.all().select_related('id__user') + + # //! My change for imposing fines + user_id = request.user + staff_fine_caretaker = user_id.extrainfo.id + students = Student.objects.all() + + fine_user = request.user + + if request.user.id in Staff.objects.values_list('id__user', flat=True): + staff_fine_caretaker = request.user.extrainfo.id + + caretaker_fine_id = HallCaretaker.objects.filter( + staff_id=staff_fine_caretaker).first() + if caretaker_fine_id: + hall_fine_id = caretaker_fine_id.hall_id + hostel_fines = HostelFine.objects.filter( + hall_id=hall_fine_id).order_by('fine_id') + context['hostel_fines'] = hostel_fines + + # caretaker_fine_id = HallCaretaker.objects.get(staff_id=staff_fine_caretaker) + # hall_fine_id = caretaker_fine_id.hall_id + # hostel_fines = HostelFine.objects.filter(hall_id=hall_fine_id).order_by('fine_id') + + if request.user.id in Staff.objects.values_list('id__user', flat=True): + staff_inventory_caretaker = request.user.extrainfo.id + + caretaker_inventory_id = HallCaretaker.objects.filter( + staff_id=staff_inventory_caretaker).first() + + if caretaker_inventory_id: + hall_inventory_id = caretaker_inventory_id.hall_id + inventories = HostelInventory.objects.filter( + hall_id=hall_inventory_id).order_by('inventory_id') + + # Serialize inventory data + inventory_data = [] + for inventory in inventories: + inventory_data.append({ + 'inventory_id': inventory.inventory_id, + 'hall_id': inventory.hall_id, + 'inventory_name': inventory.inventory_name, + # Convert DecimalField to string + 'cost': str(inventory.cost), + 'quantity': inventory.quantity, + }) + + inventory_data.sort(key=lambda x: x['inventory_id']) + context['inventories'] = inventory_data + + # all students details for caretaker and warden + if request.user.id in Staff.objects.values_list('id__user', flat=True): + staff_student_info = request.user.extrainfo.id + + if HallCaretaker.objects.filter(staff_id=staff_student_info).exists(): + hall_caretaker_id = HallCaretaker.objects.get( + staff_id=staff_student_info).hall_id + + hall_num = Hall.objects.get(id=hall_caretaker_id) + hall_number = int(''.join(filter(str.isdigit,hall_num.hall_id))) + + + # hostel_students_details = Student.objects.filter(hall_no=hall_number) + # context['hostel_students_details']= hostel_students_details + + hostel_students_details = [] + students = Student.objects.filter(hall_no=hall_number) + + a_room=[] + t_rooms = HallRoom.objects.filter(hall=hall_num) + for room in t_rooms: + if (room.room_cap > room.room_occupied): + a_room.append(room) + + # print(a_room) + # Retrieve additional information for each student + for student in students: + student_info = {} + student_info['student_id'] = student.id.id + student_info['first_name'] = student.id.user.first_name + student_info['programme'] = student.programme + student_info['batch'] = student.batch + student_info['hall_number'] = student.hall_no + student_info['room_number'] = student.room_no + student_info['specialization'] = student.specialization + # student_info['parent_contact'] = student.parent_contact + + # Fetch address and phone number from ExtraInfo model + extra_info = ExtraInfo.objects.get(user=student.id.user) + student_info['address'] = extra_info.address + student_info['phone_number'] = extra_info.phone_no + + hostel_students_details.append(student_info) + + # Sort the hostel_students_details list by roll number + hostel_students_details = sorted(hostel_students_details, key=lambda x: x['student_id']) + + + context['hostel_students_details'] = hostel_students_details + context['av_room'] = a_room + + if request.user.id in Faculty.objects.values_list('id__user', flat=True): + staff_student_info = request.user.extrainfo.id + if HallWarden.objects.filter(faculty_id=staff_student_info).exists(): + hall_warden_id = HallWarden.objects.get( + faculty_id=staff_student_info).hall_id + + hall_num = Hall.objects.get(id=hall_warden_id) + + hall_number = int(''.join(filter(str.isdigit,hall_num.hall_id))) + + # hostel_students_details = Student.objects.filter(hall_no=hall_number) + # context['hostel_students_details']= hostel_students_details + hostel_students_details = [] + students = Student.objects.filter(hall_no=hall_number) + # Retrieve additional information for each student + for student in students: + student_info = {} + student_info['student_id'] = student.id.id + student_info['first_name'] = student.id.user.first_name + student_info['programme'] = student.programme + student_info['batch'] = student.batch + student_info['hall_number'] = student.hall_no + student_info['room_number'] = student.room_no + student_info['specialization'] = student.specialization + # student_info['parent_contact'] = student.parent_contact + + # Fetch address and phone number from ExtraInfo model + extra_info = ExtraInfo.objects.get(user=student.id.user) + student_info['address'] = extra_info.address + student_info['phone_number'] = extra_info.phone_no + + hostel_students_details.append(student_info) + hostel_students_details = sorted(hostel_students_details, key=lambda x: x['student_id']) + + + context['hostel_students_details'] = hostel_students_details + + + + + # print(request.user.username); + if Student.objects.filter(id_id=request.user.username).exists(): + user_id = request.user.username + student_fines = HostelFine.objects.filter(student_id=user_id) + # print(student_fines) + context['student_fines'] = student_fines + + hostel_transactions = HostelTransactionHistory.objects.order_by('-timestamp') + + # Retrieve all hostel history entries + hostel_history = HostelHistory.objects.order_by('-timestamp') context = { - + 'all_hall': all_hall, 'all_notice': all_notice, - 'staff':Staff_obj, - 'hall1_staff' : hall1_staff, - 'hall3_staff' : hall3_staff, - 'hall4_staff' : hall4_staff, - 'hall_caretaker' : hall_caretaker_user, - 'hall_warden' : hall_warden_user, - 'room_avail' : get_avail_room, - 'hall_student':hall_student, + 'staff': Staff_obj, + 'hall1_staff': hall1_staff, + 'hall3_staff': hall3_staff, + 'hall4_staff': hall4_staff, + 'hall_caretaker': hall_caretaker_user, + 'hall_warden': hall_warden_user, + 'room_avail': get_avail_room, + 'hall_student': hall_student, 'worker_report': worker_report, 'halls_student': halls_student, - 'current_hall' : current_hall, + 'current_hall': current_hall, 'hall_staffs': hall_staffs, 'hall_notices': hall_notices, 'attendance': halls_attendance, + 'guest_rooms': guest_rooms, + 'pending_guest_room_requests': pending_guest_room_requests, + 'user_guest_room_requests': user_guest_room_requests, + 'all_students_id': all_students_id, + 'is_superuser': is_superuser, + 'warden_ids': warden_ids, + 'add_hostel_form': add_hostel_form, + 'hostel_details': hostel_details, + 'all_students_id': all_students_id, + 'my_complaints': my_complaints, + 'my_leaves': my_leaves, + 'all_leaves': all_leaves, + 'all_complaints': all_complaints, + 'staff_fine_caretaker': staff_fine_caretaker, + 'students': students, + 'hostel_transactions':hostel_transactions, + 'hostel_history':hostel_history, **context } return render(request, 'hostelmanagement/hostel.html', context) - - - + def staff_edit_schedule(request): """ This function is responsible for creating a new or updating an existing staff schedule. @@ -144,31 +450,33 @@ def staff_edit_schedule(request): hall_caretakers - stores all hall caretakers. """ if request.method == 'POST': - start_time= datetime.datetime.strptime(request.POST["start_time"],'%H:%M').time() - end_time= datetime.datetime.strptime(request.POST["end_time"],'%H:%M').time() - staff_name=request.POST["Staff_name"] - staff_type=request.POST["staff_type"] - day=request.POST["day"] + start_time = datetime.datetime.strptime( + request.POST["start_time"], '%H:%M').time() + end_time = datetime.datetime.strptime( + request.POST["end_time"], '%H:%M').time() + staff_name = request.POST["Staff_name"] + staff_type = request.POST["staff_type"] + day = request.POST["day"] - staff=Staff.objects.get(pk=staff_name) + staff = Staff.objects.get(pk=staff_name) try: - staff_schedule=StaffSchedule.objects.get(staff_id=staff) - staff_schedule.day=day - staff_schedule.start_time=start_time - staff_schedule.end_time=end_time - staff_schedule.staff_type=staff_type + staff_schedule = StaffSchedule.objects.get(staff_id=staff) + staff_schedule.day = day + staff_schedule.start_time = start_time + staff_schedule.end_time = end_time + staff_schedule.staff_type = staff_type staff_schedule.save() messages.success(request, 'Staff schedule updated successfully.') except: hall_caretakers = HallCaretaker.objects.all() - get_hall="" - get_hall=get_caretaker_hall(hall_caretakers,request.user) - StaffSchedule(hall=get_hall,staff_id=staff,day=day,staff_type=staff_type,start_time=start_time,end_time=end_time).save() + get_hall = "" + get_hall = get_caretaker_hall(hall_caretakers, request.user) + StaffSchedule(hall=get_hall, staff_id=staff, day=day, + staff_type=staff_type, start_time=start_time, end_time=end_time).save() messages.success(request, 'Staff schedule created successfully.') return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) - def staff_delete_schedule(request): """ This function is responsible for deleting an existing staff schedule. @@ -181,9 +489,9 @@ def staff_delete_schedule(request): staff_schedule - stores staff schedule related to 'staff' """ if request.method == 'POST': - staff_dlt_id=request.POST["dlt_schedule"] - staff=Staff.objects.get(pk=staff_dlt_id) - staff_schedule=StaffSchedule.objects.get(staff_id=staff) + staff_dlt_id = request.POST["dlt_schedule"] + staff = Staff.objects.get(pk=staff_dlt_id) + staff_schedule = StaffSchedule.objects.get(staff_id=staff) staff_schedule.delete() return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) @@ -209,9 +517,9 @@ def notice_board(request): head_line = form.cleaned_data['head_line'] content = form.cleaned_data['content'] description = form.cleaned_data['description'] - + new_notice = HostelNoticeBoard.objects.create(hall=hall, posted_by=request.user.extrainfo, head_line=head_line, content=content, - description=description) + description=description) new_notice.save() messages.success(request, 'Notice created successfully.') @@ -230,11 +538,12 @@ def delete_notice(request): notice - stores HostelNoticeBoard object related to 'notice_id' """ if request.method == 'POST': - notice_id=request.POST["dlt_notice"] - notice=HostelNoticeBoard.objects.get(pk=notice_id) + notice_id = request.POST["dlt_notice"] + notice = HostelNoticeBoard.objects.get(pk=notice_id) notice.delete() return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + def edit_student_rooms_sheet(request): """ This function is used to edit the room and hall of a multiple students. @@ -257,40 +566,40 @@ def edit_student_rooms_sheet(request): hall_no = str(int(hall_no)) room_no = row[2].value - block=str(room_no[0]) + block = str(room_no[0]) room = re.findall('[0-9]+', room_no) is_valid = True student = Student.objects.filter(id=roll_no.strip()) hall = Hall.objects.filter(hall_id="hall"+hall_no[0]) if student and hall.exists(): - Room = HallRoom.objects.filter(hall=hall[0],block_no=block,room_no=str(room[0])) + Room = HallRoom.objects.filter( + hall=hall[0], block_no=block, room_no=str(room[0])) if Room.exists() and Room[0].room_occupied < Room[0].room_cap: continue else: is_valid = False - print('Room unavailable!') + # print('Room unavailable!') messages.error(request, 'Room unavailable!') break else: is_valid = False - print("Wrong Credentials entered!") + # print("Wrong Credentials entered!") messages.error(request, 'Wrong credentials entered!') break if not is_valid: return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) - + for row in all_rows: if row[0].value == "Roll No": continue roll_no = row[0].value if row[0].ctype == 2: roll_no = str(int(roll_no)) - hall_no = str(int(row[1].value)) room_no = row[2].value - block=str(room_no[0]) + block = str(room_no[0]) room = re.findall('[0-9]+', room_no) is_valid = True student = Student.objects.filter(id=roll_no.strip()) @@ -315,8 +624,8 @@ def edit_student_room(request): """ if request.method == "POST": roll_no = request.POST["roll_no"] - hall_room_no=request.POST["hall_room_no"] - index=hall_room_no.find('-') + hall_room_no = request.POST["hall_room_no"] + index = hall_room_no.find('-') room_no = hall_room_no[index+1:] hall_no = hall_room_no[:index] student = Student.objects.get(id=roll_no) @@ -325,12 +634,13 @@ def edit_student_room(request): messages.success(request, 'Student room changed successfully.') return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + def edit_attendance(request): """ This function is used to edit the attendance of a student. @param: request - HttpRequest object containing metadata about the user request. - + @variables: student_id = The student whose attendance has to be updated. hall = The hall of the concerned student. @@ -338,17 +648,18 @@ def edit_attendance(request): """ if request.method == "POST": roll_no = request.POST["roll_no"] - + student = Student.objects.get(id=roll_no) hall = Hall.objects.get(hall_id='hall'+str(student.hall_no)) date = datetime.datetime.today().strftime('%Y-%m-%d') - if HostelStudentAttendence.objects.filter(student_id=student,date=date).exists() == True: - messages.error(request, f'{student.id.id} is already marked present on {date}') + if HostelStudentAttendence.objects.filter(student_id=student, date=date).exists() == True: + messages.error( + request, f'{student.id.id} is already marked present on {date}') return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) - record = HostelStudentAttendence.objects.create(student_id=student, \ - hall=hall, date=date, present=True) + record = HostelStudentAttendence.objects.create(student_id=student, + hall=hall, date=date, present=True) record.save() messages.success(request, f'Attendance of {student.id.id} recorded.') @@ -356,35 +667,110 @@ def edit_attendance(request): return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) +# @login_required +# def generate_worker_report(request): +# """ +# This function is used to read uploaded worker report spreadsheet(.xls) and generate WorkerReport instance and save it in the database. +# @param: +# request - HttpRequest object containing metadata about the user request. + +# @variables: +# files - stores uploaded worker report file +# excel - stores the opened spreadsheet file raedy for data extraction. +# user_id - stores user id of the current user. +# sheet - stores a sheet from the uploaded spreadsheet. +# """ +# if request.method == "POST": +# try: +# files = request.FILES['upload_report'] +# excel = xlrd.open_workbook(file_contents=files.read()) +# user_id = request.user.extrainfo.id +# if str(excel.sheets()[0].cell(0, 0).value)[:5].lower() == str(HallCaretaker.objects.get(staff__id=user_id).hall): +# for sheet in excel.sheets(): +# save_worker_report_sheet(excel, sheet, user_id) +# return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + +# return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) +# except: +# messages.error( +# request, "Please upload a file in valid format before submitting") +# return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + +# class GeneratePDF(View): +# def get(self, request, *args, **kwargs): +# """ +# This function is used to generate worker report in pdf format available for download. +# @param: +# request - HttpRequest object containing metadata about the user request. + +# @variables: +# months - stores number of months for which the authorized user wants to generate worker report. +# toadys_date - stores current date. +# current_year - stores current year retrieved from 'todays_date'. +# current_month - stores current month retrieved from 'todays_date'. +# template - stores template returned by 'get_template' method. +# hall_caretakers - stores all hall caretakers. +# worker_report - stores 'WorkerReport' instances according to 'months'. +# """ +# months = int(request.GET.get('months')) +# todays_date = date.today() +# current_year = todays_date.year +# current_month = todays_date.month + +# template = get_template('hostelmanagement/view_report.html') + +# hall_caretakers = HallCaretaker.objects.all() +# get_hall = "" +# get_hall = get_caretaker_hall(hall_caretakers, request.user) + +# if months < current_month: +# worker_report = WorkerReport.objects.filter( +# hall=get_hall, month__gte=current_month-months, year=current_year) +# else: +# worker_report = WorkerReport.objects.filter(Q(hall=get_hall, year=current_year, month__lte=current_month) | Q( +# hall=get_hall, year=current_year-1, month__gte=12-months+current_month)) + +# worker = { +# 'worker_report': worker_report +# } +# html = template.render(worker) +# pdf = render_to_pdf('hostelmanagement/view_report.html', worker) +# if pdf: +# response = HttpResponse(pdf, content_type='application/pdf') +# filename = "Invoice_%s.pdf" % ("12341231") +# content = "inline; filename='%s'" % (filename) +# download = request.GET.get("download") +# if download: +# content = "attachment; filename='%s'" % (filename) +# response['Content-Disposition'] = content +# return response +# return HttpResponse("Not found") @login_required def generate_worker_report(request): - """ - This function is used to read uploaded worker report spreadsheet(.xls) and generate WorkerReport instance and save it in the database. - @param: - request - HttpRequest object containing metadata about the user request. - - @variables: - files - stores uploaded worker report file - excel - stores the opened spreadsheet file raedy for data extraction. - user_id - stores user id of the current user. - sheet - stores a sheet from the uploaded spreadsheet. - """ if request.method == "POST": - try: - files = request.FILES['upload_report'] - excel = xlrd.open_workbook(file_contents=files.read()) - user_id = request.user.extrainfo.id - if str(excel.sheets()[0].cell(0,0).value)[:5].lower() == str(HallCaretaker.objects.get(staff__id=user_id).hall): - for sheet in excel.sheets(): - save_worker_report_sheet(excel,sheet,user_id) + try: + files = request.FILES.get('upload_report') + if files: + # Check if the file has a valid extension + file_extension = files.name.split('.')[-1].lower() + if file_extension not in ['xls', 'xlsx']: + messages.error(request, "Invalid file format. Please upload a .xls or .xlsx file.") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + excel = xlrd.open_workbook(file_contents=files.read()) + user_id = request.user.extrainfo.id + for sheet in excel.sheets(): + # print('111111111111111111111111111111111111',sheet[0]) + save_worker_report_sheet(excel, sheet, user_id) return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) - - return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) - except: - messages.error(request,"Please upload a file in valid format before submitting") - return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + else: + messages.error(request, "No file uploaded") + except Exception as e: + messages.error(request, f"Error processing file: {str(e)}") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) class GeneratePDF(View): @@ -405,6 +791,7 @@ def get(self, request, *args, **kwargs): """ months = int(request.GET.get('months')) + # print('~~~~month',months) todays_date = date.today() current_year = todays_date.year current_month = todays_date.month @@ -412,27 +799,1324 @@ def get(self, request, *args, **kwargs): template = get_template('hostelmanagement/view_report.html') hall_caretakers = HallCaretaker.objects.all() - get_hall="" - get_hall=get_caretaker_hall(hall_caretakers,request.user) - print(get_hall) + get_hall = "" + get_hall = get_caretaker_hall(hall_caretakers, request.user) + # print('~~~~~ get_hall' , get_hall) + # print('monthalert("You are not authorized to access this page"); window.location.href = "/hostelmanagement/"') + + +@login_required +def create_hostel_leave(request): + + if request.method == 'GET': + return render(request, 'hostelmanagement/create_leave.html') + elif request.method == 'POST': + data = request.POST # Assuming you are sending form data via POST request + student_name = data.get('student_name') + roll_num = data.get('roll_num') + phone_number = data.get('phone_number') # Retrieve phone number from form data + reason = data.get('reason') + start_date = data.get('start_date', timezone.now()) + end_date = data.get('end_date') + + + # Create HostelLeave object and save to the database + leave = HostelLeave.objects.create( + student_name=student_name, + roll_num=roll_num, + phone_number=phone_number, # Include phone number in the object creation + reason=reason, + start_date=start_date, + end_date=end_date, + + ) + caretakers = HallCaretaker.objects.all() + sender = request.user + type = "leave_request" + for caretaker in caretakers: + try: + # Send notification + hostel_notifications(sender, caretaker.staff.id.user, type) + except Exception as e: + # Handle notification sending error + print(f"Error sending notification to caretaker {caretaker.staff.user.username}: {e}") + + return JsonResponse({'message': 'HostelLeave created successfully'}, status=status.HTTP_201_CREATED) + +# hostel_complaints_list caretaker can see all hostel complaints + +@login_required +def hostel_complaint_list(request): + user_id = request.user.id + + try: + # Assuming the user's profile is stored in extrainfo + staff = request.user.extrainfo.id + except AttributeError: + staff = None + + if staff is not None and HallCaretaker.objects.filter(staff_id=staff).exists(): + complaints = HostelComplaint.objects.all() + return render(request, 'hostelmanagement/hostel_complaint.html', {'complaints': complaints}) + else: + return HttpResponse('') + + +@login_required +def get_students(request): + try: + staff = request.user.extrainfo.id + print(staff) + except AttributeError: + staff = None + + if HallCaretaker.objects.filter(staff_id=staff).exists(): + hall_id = HallCaretaker.objects.get(staff_id=staff).hall_id + print(hall_id) + hall_no = Hall.objects.get(id=hall_id) + print(hall_no) + student_details = StudentDetails.objects.filter(hall_id=hall_no) + + return render(request, 'hostelmanagement/student_details.html', {'students': student_details}) + + elif HallWarden.objects.filter(faculty_id=staff).exists(): + hall_id = HallWarden.objects.get(faculty_id=staff).hall_id + student_details = StudentDetails.objects.filter(hall_id=hall_no) + + return render(request, 'hostelmanagement/student_details.html', {'students': student_details}) + else: + return HttpResponse('') + +# Student can post complaints + + +class PostComplaint(APIView): + # Assuming you are using session authentication + authentication_classes = [SessionAuthentication] + # Allow only authenticated users to access the view + permission_classes = [IsAuthenticated] + + def dispatch(self, request, *args, **kwargs): + # print(request.user.username) + if not request.user.is_authenticated: + # Redirect to the login page if user is not authenticated + return redirect('/hostelmanagement') + return super().dispatch(request, *args, **kwargs) + + def get(self, request): + return render(request, 'hostelmanagement/post_complaint_form.html') + + def post(self, request): + hall_name = request.data.get('hall_name') + student_name = request.data.get('student_name') + roll_number = request.data.get('roll_number') + description = request.data.get('description') + contact_number = request.data.get('contact_number') + + # Assuming the student's name is stored in the user object + student_name = request.user.username + + complaint = HostelComplaint.objects.create( + hall_name=hall_name, + student_name=student_name, + roll_number=roll_number, + description=description, + contact_number=contact_number + ) + + # Use JavaScript to display a pop-up message after submission + return HttpResponse('') + + +# // student can see his leave status + +class my_leaves(View): + @method_decorator(login_required, name='dispatch') + def get(self, request, *args, **kwargs): + try: + # Get the user ID from the request's user + user_id = str(request.user) + + # Retrieve leaves registered by the current student based on their roll number + my_leaves = HostelLeave.objects.filter(roll_num__iexact=user_id) + # Construct the context to pass to the template + context = { + 'leaves': my_leaves + } + + # Render the template with the context data + return render(request, 'hostelmanagement/my_leaves.html', context) + + except User.DoesNotExist: + # Handle the case where the user with the given ID doesn't exist + return HttpResponse(f"User with ID {user_id} does not exist.") + + +class HallIdView(APIView): + authentication_classes = [] # Allow public access for testing + permission_classes = [] # Allow any user to access the view + + def get(self, request, *args, **kwargs): + hall_id = HostelAllotment.objects.values('hall_id') + return Response(hall_id, status=status.HTTP_200_OK) + + +@login_required(login_url=LOGIN_URL) +def logout_view(request): + logout(request) + return redirect("/") + + +@method_decorator(user_passes_test(is_superuser), name='dispatch') +class AssignCaretakerView(APIView): + authentication_classes = [SessionAuthentication] + permission_classes = [IsAuthenticated] + template_name = 'hostelmanagement/assign_caretaker.html' + + def get(self, request, *args, **kwargs): + hall = Hall.objects.all() + caretaker_usernames = Staff.objects.all() + return render(request, self.template_name, {'halls': hall, 'caretaker_usernames': caretaker_usernames}) + + def post(self, request, *args, **kwargs): + hall_id = request.data.get('hall_id') + caretaker_username = request.data.get('caretaker_username') + + try: + hall = Hall.objects.get(hall_id=hall_id) + caretaker_staff = Staff.objects.get( + id__user__username=caretaker_username) + + # Retrieve the previous caretaker for the hall, if any + prev_hall_caretaker = HallCaretaker.objects.filter(hall=hall).first() + # print(prev_hall_caretaker.staff.id) + # Delete any previous assignments of the caretaker in HallCaretaker table + HallCaretaker.objects.filter(staff=caretaker_staff).delete() + + # Delete any previous assignments of the caretaker in HostelAllotment table + HostelAllotment.objects.filter( + assignedCaretaker=caretaker_staff).delete() + + # Delete any previously assigned caretaker to the same hall + HallCaretaker.objects.filter(hall=hall).delete() + + # Assign the new caretaker to the hall in HallCaretaker table + hall_caretaker = HallCaretaker.objects.create( + hall=hall, staff=caretaker_staff) + + # # Update the assigned caretaker in Hostelallottment table + hostel_allotments = HostelAllotment.objects.filter(hall=hall) + for hostel_allotment in hostel_allotments: + hostel_allotment.assignedCaretaker = caretaker_staff + hostel_allotment.save() + + # Retrieve the current warden for the hall + current_warden = HallWarden.objects.filter(hall=hall).first() + + try: + history_entry = HostelTransactionHistory.objects.create( + hall=hall, + change_type='Caretaker', + previous_value= prev_hall_caretaker.staff.id if (prev_hall_caretaker and prev_hall_caretaker.staff) else 'None', + new_value=caretaker_username + ) + except Exception as e: + print("Error creating HostelTransactionHistory:", e) + + + # Create hostel history + try: + HostelHistory.objects.create( + hall=hall, + caretaker=caretaker_staff, + batch=hall.assigned_batch, + warden=current_warden.faculty if( current_warden and current_warden.faculty) else None + ) + except Exception as e: + print ("Error creating history",e) + return Response({'message': f'Caretaker {caretaker_username} assigned to Hall {hall_id} successfully'}, status=status.HTTP_201_CREATED) + + except Hall.DoesNotExist: + return Response({'error': f'Hall with ID {hall_id} not found'}, status=status.HTTP_404_NOT_FOUND) + except Staff.DoesNotExist: + return Response({'error': f'Caretaker with username {caretaker_username} not found'}, status=status.HTTP_404_NOT_FOUND) + except Exception as e: + return JsonResponse({'status': 'error', 'error': str(e)}, status=500) + + + +@method_decorator(user_passes_test(is_superuser), name='dispatch') +class AssignBatchView(View): + authentication_classes = [SessionAuthentication] + permission_classes = [IsAuthenticated] + # Assuming the HTML file is directly in the 'templates' folder + template_name = 'hostelmanagement/assign_batch.html' + + def get(self, request, *args, **kwargs): + hall = Hall.objects.all() + return render(request, self.template_name, {'halls': hall}) + + def update_student_hall_allotment(self, hall, assigned_batch): + hall_number = int(''.join(filter(str.isdigit, hall.hall_id))) + students = Student.objects.filter(batch=int(assigned_batch)) + + + for student in students: + student.hall_no = hall_number + student.save() + + + def post(self, request, *args, **kwargs): + try: + with transaction.atomic(): # Start a database transaction + + data = json.loads(request.body.decode('utf-8')) + hall_id = data.get('hall_id') + + hall = Hall.objects.get(hall_id=hall_id) + # previous_batch = hall.assigned_batch # Get the previous batch + previous_batch = hall.assigned_batch if hall.assigned_batch is not None else 0 # Get the previous batch + hall.assigned_batch = data.get('batch') + hall.save() + + + + + + # Update the assignedBatch field in HostelAllotment table for the corresponding hall + room_allotments = HostelAllotment.objects.filter(hall=hall) + for room_allotment in room_allotments: + room_allotment.assignedBatch = hall.assigned_batch + room_allotment.save() + + # retrieve the current caretaker and current warden for the hall + current_caretaker =HallCaretaker.objects.filter(hall=hall).first() + current_warden = HallWarden.objects.filter(hall=hall).first() + + # Record the transaction history + HostelTransactionHistory.objects.create( + hall=hall, + change_type='Batch', + previous_value=previous_batch, + new_value=hall.assigned_batch + ) + + # Create hostel history + try: + HostelHistory.objects.create( + hall=hall, + caretaker=current_caretaker.staff if (current_caretaker and current_caretaker.staff) else None, + + batch=hall.assigned_batch, + warden=current_warden.faculty if( current_warden and current_warden.faculty) else None + + ) + except Exception as e: + print ("Error creating history",e) + + self.update_student_hall_allotment(hall, hall.assigned_batch) + print("batch assigned successssssssssssssssssss") + messages.success(request, 'batch assigned succesfully') + + return JsonResponse({'status': 'success', 'message': 'Batch assigned successfully'}, status=200) + + except Hall.DoesNotExist: + return JsonResponse({'status': 'error', 'error': f'Hall with ID {hall_id} not found'}, status=404) + + except Exception as e: + return JsonResponse({'status': 'error', 'error': str(e)}, status=500) + + def test_func(self): + # Check if the user is a superuser + return self.request.user.is_superuser + + +@method_decorator(user_passes_test(is_superuser), name='dispatch') +class AssignWardenView(APIView): + authentication_classes = [SessionAuthentication] + permission_classes = [IsAuthenticated] + template_name = 'hostelmanagement/assign_warden.html' + + def post(self, request, *args, **kwargs): + hall_id = request.data.get('hall_id') + warden_id = request.data.get('warden_id') + try: + hall = Hall.objects.get(hall_id=hall_id) + warden = Faculty.objects.get(id__user__username=warden_id) + + # Retrieve the previous caretaker for the hall, if any + prev_hall_warden = HallWarden.objects.filter(hall=hall).first() + + # Delete any previous assignments of the warden in Hallwarden table + HallWarden.objects.filter(faculty=warden).delete() + + # Delete any previous assignments of the warden in HostelAllotment table + HostelAllotment.objects.filter(assignedWarden=warden).delete() + + # Delete any previously assigned warden to the same hall + HallWarden.objects.filter(hall=hall).delete() + + # Assign the new warden to the hall in Hallwarden table + hall_warden = HallWarden.objects.create(hall=hall, faculty=warden) + + #current caretker + current_caretaker =HallCaretaker.objects.filter(hall=hall).first() + print(current_caretaker) + + # Update the assigned warden in Hostelallottment table + hostel_allotments = HostelAllotment.objects.filter(hall=hall) + for hostel_allotment in hostel_allotments: + hostel_allotment.assignedWarden = warden + hostel_allotment.save() + + try: + history_entry = HostelTransactionHistory.objects.create( + hall=hall, + change_type='Warden', + previous_value= prev_hall_warden.faculty.id if (prev_hall_warden and prev_hall_warden.faculty) else 'None', + new_value=warden + ) + except Exception as e: + print("Error creating HostelTransactionHistory:", e) + + + # Create hostel history + try: + HostelHistory.objects.create( + hall=hall, + caretaker=current_caretaker.staff if (current_caretaker and current_caretaker.staff) else None, + + batch=hall.assigned_batch, + warden=warden + ) + except Exception as e: + print ("Error creating history",e) + + + return Response({'message': f'Warden {warden_id} assigned to Hall {hall_id} successfully'}, status=status.HTTP_201_CREATED) + + except Hall.DoesNotExist: + return Response({'error': f'Hall with ID {hall_id} not found'}, status=status.HTTP_404_NOT_FOUND) + except Faculty.DoesNotExist: + return Response({'error': f'Warden with username {warden_id} not found'}, status=status.HTTP_404_NOT_FOUND) + except Exception as e: + return JsonResponse({'status': 'error', 'error': str(e)}, status=500) + + +@method_decorator(user_passes_test(is_superuser), name='dispatch') +class AddHostelView(View): + template_name = 'hostelmanagement/add_hostel.html' + + def get(self, request, *args, **kwargs): + form = HallForm() + return render(request, self.template_name, {'form': form}) + + def post(self, request, *args, **kwargs): + form = HallForm(request.POST) + if form.is_valid(): + hall_id = form.cleaned_data['hall_id'] + + # # Check if a hall with the given hall_id already exists + # if Hall.objects.filter(hall_id=hall_id).exists(): + # messages.error(request, f'Hall with ID {hall_id} already exists.') + # return redirect('hostelmanagement:add_hostel') + + # Check if a hall with the given hall_id already exists + if Hall.objects.filter(hall_id=hall_id).exists(): + error_message = f'Hall with ID {hall_id} already exists.' + + return HttpResponse(error_message, status=400) + + # If not, create a new hall + form.save() + messages.success(request, 'Hall added successfully!') + # Redirect to the view showing all hostels + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + # return render(request, 'hostelmanagement/admin_hostel_list.html') + + # If form is not valid, render the form with errors + return render(request, self.template_name, {'form': form}) + + +class CheckHallExistsView(View): + + def get(self, request, *args, **kwargs): + + hall_id = request.GET.get('hall_id') + try: + hall = Hall.objects.get(hall_id=hall_id) + exists = True + except Hall.DoesNotExist: + exists = False + messages.MessageFailure(request, f'Hall {hall_id} already exist.') + return JsonResponse({'exists': exists}) + + +@method_decorator(user_passes_test(is_superuser), name='dispatch') +class AdminHostelListView(View): + template_name = 'hostelmanagement/admin_hostel_list.html' + + def get(self, request, *args, **kwargs): + halls = Hall.objects.all() + # Create a list to store additional details + hostel_details = [] + + # Loop through each hall and fetch assignedCaretaker and assignedWarden + for hall in halls: + try: + caretaker = HallCaretaker.objects.filter(hall=hall).first() + warden = HallWarden.objects.filter(hall=hall).first() + except HostelAllotment.DoesNotExist: + assigned_caretaker = None + assigned_warden = None + + hostel_detail = { + 'hall_id': hall.hall_id, + 'hall_name': hall.hall_name, + 'max_accomodation': hall.max_accomodation, + 'number_students': hall.number_students, + 'assigned_batch': hall.assigned_batch, + 'assigned_caretaker': caretaker.staff.id.user.username if caretaker else None, + 'assigned_warden': warden.faculty.id.user.username if warden else None, + } + + hostel_details.append(hostel_detail) + + return render(request, self.template_name, {'hostel_details': hostel_details}) + + +@method_decorator(user_passes_test(is_superuser), name='dispatch') +class DeleteHostelView(View): + def get(self, request, hall_id, *args, **kwargs): + # Get the hall instance + hall = get_object_or_404(Hall, hall_id=hall_id) + + # Delete related entries in other tables + hostelallotments = HostelAllotment.objects.filter(hall=hall) + hostelallotments.delete() + + # Delete the hall + hall.delete() + messages.success(request, f'Hall {hall_id} deleted successfully.') + + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + +class HallIdView(APIView): + authentication_classes = [] # Allow public access for testing + permission_classes = [] # Allow any user to access the view + + def get(self, request, *args, **kwargs): + hall_id = HostelAllotment.objects.values('hall_id') + return Response(hall_id, status=status.HTTP_200_OK) + + +@login_required(login_url=LOGIN_URL) +def logout_view(request): + logout(request) + return redirect("/") + + +# //! alloted_rooms +def alloted_rooms(request, hall_id): + """ + This function returns the allotted rooms in a particular hall. + + @param: + request - HttpRequest object containing metadata about the user request. + hall_id - Hall ID for which the allotted rooms need to be retrieved. + + @variables: + allotted_rooms - stores all the rooms allotted in the given hall. + """ + # Query the hall by hall_id + hall = Hall.objects.get(hall_id=hall_id) + # Query all rooms allotted in the given hall + allotted_rooms = HallRoom.objects.filter(hall=hall, room_occupied__gt=0) + # Prepare a list of room details to be returned + room_details = [] + for room in allotted_rooms: + room_details.append({ + 'hall': room.hall.hall_id, + 'room_no': room.room_no, + 'block_no': room.block_no, + 'room_cap': room.room_cap, + 'room_occupied': room.room_occupied + }) + return JsonResponse(room_details, safe=False) + + +def alloted_rooms_main(request): + """ + This function returns the allotted rooms in all halls. + + @param: + request - HttpRequest object containing metadata about the user request. + + @variables: + all_halls - stores all the halls. + all_rooms - stores all the rooms allotted in all halls. + """ + # Query all halls + all_halls = Hall.objects.all() + + # Query all rooms allotted in all halls + all_rooms = [] + for hall in all_halls: + all_rooms.append(HallRoom.objects.filter( + hall=hall, room_occupied__gt=0)) + + # Prepare a list of room details to be returned + room_details = [] + for rooms in all_rooms: + for room in rooms: + room_details.append({ + 'hall': room.hall.hall_name, + 'room_no': room.room_no, + 'block_no': room.block_no, + 'room_cap': room.room_cap, + 'room_occupied': room.room_occupied + }) + + # Return the room_details as JSON response + return render(request, 'hostelmanagement/alloted_rooms_main.html', {'allotted_rooms': room_details, 'halls': all_halls}) + + +# //! all_staff +def all_staff(request, hall_id): + """ + This function returns all staff information for a specific hall. + + @param: + request - HttpRequest object containing metadata about the user request. + hall_id - The ID of the hall for which staff information is requested. + + + @variables: + all_staff - stores all staff information for the specified hall. + """ + + # Query all staff information for the specified hall + all_staff = StaffSchedule.objects.filter(hall_id=hall_id) + + # Prepare a list of staff details to be returned + staff_details = [] + for staff in all_staff: + staff_details.append({ + 'type': staff.staff_type, + 'staff_id': staff.staff_id_id, + 'hall_id': staff.hall_id, + 'day': staff.day, + 'start_time': staff.start_time, + 'end_time': staff.end_time + }) + + # Return the staff_details as JSON response + return JsonResponse(staff_details, safe=False) + + +# //! Edit Stuff schedule +class StaffScheduleView(APIView): + """ + API endpoint for creating or editing staff schedules. + """ + + authentication_classes = [] # Allow public access for testing + permission_classes = [] # Allow any user to access the view + + def patch(self, request, staff_id): + staff = get_object_or_404(Staff, pk=staff_id) + staff_type = request.data.get('staff_type') + start_time = request.data.get('start_time') + end_time = request.data.get('end_time') + day = request.data.get('day') + + + if start_time and end_time and day and staff_type: + # Check if staff schedule exists for the given day + existing_schedule = StaffSchedule.objects.filter( + staff_id=staff_id).first() + if existing_schedule: + existing_schedule.start_time = start_time + existing_schedule.end_time = end_time + existing_schedule.day = day + existing_schedule.staff_type = staff_type + existing_schedule.save() + return Response({"message": "Staff schedule updated successfully."}, status=status.HTTP_200_OK) + else: + # If staff schedule doesn't exist for the given day, return 404 + return Response({"error": "Staff schedule does not exist for the given day."}, status=status.HTTP_404_NOT_FOUND) + + return Response({"error": "Please provide start_time, end_time, and day."}, status=status.HTTP_400_BAD_REQUEST) + + +# //! Hostel Inventory + +@login_required +def get_inventory_form(request): + user_id = request.user + # print("user_id",user_id) + staff = user_id.extrainfo.id + # print("staff",staff) + + # Check if the user is present in the HallCaretaker table + if HallCaretaker.objects.filter(staff_id=staff).exists(): + # If the user is a caretaker, allow access + halls = Hall.objects.all() + return render(request, 'hostelmanagement/inventory_form.html', {'halls': halls}) + else: + # If the user is not a caretaker, redirect to the login page + # return redirect('login') # Adjust 'login' to your login URL name + return HttpResponse(f'') + + +@login_required +def edit_inventory(request, inventory_id): + # Retrieve hostel inventory object + inventory = get_object_or_404(HostelInventory, pk=inventory_id) + + # Check if the user is a caretaker + user_id = request.user + staff_id = user_id.extrainfo.id + + if HallCaretaker.objects.filter(staff_id=staff_id).exists(): + halls = Hall.objects.all() + + # Prepare inventory data for rendering + inventory_data = { + 'inventory_id': inventory.inventory_id, + 'hall_id': inventory.hall_id, + 'inventory_name': inventory.inventory_name, + 'cost': str(inventory.cost), # Convert DecimalField to string + 'quantity': inventory.quantity, + } + + # Render the inventory update form with inventory data + return render(request, 'hostelmanagement/inventory_update_form.html', {'inventory': inventory_data, 'halls': halls}) + else: + # If the user is not a caretaker, show a message and redirect + return HttpResponse('') + + +class HostelInventoryUpdateView(APIView): + authentication_classes = [SessionAuthentication] + permission_classes = [IsAuthenticated] + + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) + + def post(self, request, inventory_id): + user_id = request.user + staff_id = user_id.extrainfo.id + + if not HallCaretaker.objects.filter(staff_id=staff_id).exists(): + return Response({'error': 'You are not authorized to update this hostel inventory'}, status=status.HTTP_401_UNAUTHORIZED) + + hall_id = request.data.get('hall_id') + inventory_name = request.data.get('inventory_name') + cost = request.data.get('cost') + quantity = request.data.get('quantity') + + # Validate required fields + if not all([hall_id, inventory_name, cost, quantity]): + return Response({'error': 'All fields are required'}, status=status.HTTP_400_BAD_REQUEST) + + # Retrieve hostel inventory object + hostel_inventory = get_object_or_404(HostelInventory, pk=inventory_id) + + # Update hostel inventory object + hostel_inventory.hall_id = hall_id + hostel_inventory.inventory_name = inventory_name + hostel_inventory.cost = cost + hostel_inventory.quantity = quantity + hostel_inventory.save() + + # Return success response + return Response({'message': 'Hostel inventory updated successfully'}, status=status.HTTP_200_OK) + + +class HostelInventoryView(APIView): + """ + API endpoint for CRUD operations on hostel inventory. + """ + # permission_classes = [IsAuthenticated] + + # authentication_classes = [] # Allow public access for testing + # permission_classes = [] # Allow any user to access the view + + authentication_classes = [SessionAuthentication] + permission_classes = [IsAuthenticated] + + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) + + def get(self, request, hall_id): + user_id = request.user + staff_id = user_id.extrainfo.id + + if not HallCaretaker.objects.filter(staff_id=staff_id).exists(): + return HttpResponse('') + + # Retrieve hostel inventory objects for the given hall ID + inventories = HostelInventory.objects.filter(hall_id=hall_id) + + # Get all hall IDs + halls = Hall.objects.all() + + # Serialize inventory data + inventory_data = [] + for inventory in inventories: + inventory_data.append({ + 'inventory_id': inventory.inventory_id, + 'hall_id': inventory.hall_id, + 'inventory_name': inventory.inventory_name, + 'cost': str(inventory.cost), # Convert DecimalField to string + 'quantity': inventory.quantity, + }) + + inventory_data.sort(key=lambda x: x['inventory_id']) + + # Return inventory data as JSON response + return render(request, 'hostelmanagement/inventory_list.html', {'halls': halls, 'inventories': inventory_data}) + + def post(self, request): + user_id = request.user + staff_id = user_id.extrainfo.id + + if not HallCaretaker.objects.filter(staff_id=staff_id).exists(): + return Response({'error': 'You are not authorized to create a new hostel inventory'}, status=status.HTTP_401_UNAUTHORIZED) + + # Extract data from request + hall_id = request.data.get('hall_id') + inventory_name = request.data.get('inventory_name') + cost = request.data.get('cost') + quantity = request.data.get('quantity') + + # Validate required fields + if not all([hall_id, inventory_name, cost, quantity]): + return Response({'error': 'All fields are required'}, status=status.HTTP_400_BAD_REQUEST) + + # Create hostel inventory object + try: + hostel_inventory = HostelInventory.objects.create( + hall_id=hall_id, + inventory_name=inventory_name, + cost=cost, + quantity=quantity + ) + return Response({'message': 'Hostel inventory created successfully', 'hall_id': hall_id}, status=status.HTTP_201_CREATED) + except Exception as e: + return Response({'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + def delete(self, request, inventory_id): + user_id = request.user + staff_id = user_id.extrainfo.id + + if not HallCaretaker.objects.filter(staff_id=staff_id).exists(): + return Response({'error': 'You are not authorized to delete this hostel inventory'}, status=status.HTTP_401_UNAUTHORIZED) + + inventory = get_object_or_404(HostelInventory, pk=inventory_id) + inventory.delete() + return Response({'message': 'Hostel inventory deleted successfully'}, status=status.HTTP_204_NO_CONTENT) + + +def update_allotment(request, pk): + if request.method == 'POST': + try: + allotment = HostelAllottment.objects.get(pk=pk) + except HostelAllottment.DoesNotExist: + return JsonResponse({'error': 'HostelAllottment not found'}, status=404) + + try: + allotment.assignedWarden = Faculty.objects.get( + id=request.POST['warden_id']) + allotment.assignedCaretaker = Staff.objects.get( + id=request.POST['caretaker_id']) + allotment.assignedBatch = request.POST.get( + 'student_batch', allotment.assignedBatch) + allotment.save() + return JsonResponse({'success': 'HostelAllottment updated successfully'}) + except (Faculty.DoesNotExist, Staff.DoesNotExist, IntegrityError): + return JsonResponse({'error': 'Invalid data or integrity error'}, status=400) + + return JsonResponse({'error': 'Invalid request method'}, status=405) + + +@login_required +def request_guest_room(request): + """ + This function is used by the student to book a guest room. + @param: + request - HttpRequest object containing metadata about the user request. + """ + if request.method == "POST": + form = GuestRoomBookingForm(request.POST) + + if form.is_valid(): + # print("Inside valid") + hall = form.cleaned_data['hall'] + guest_name = form.cleaned_data['guest_name'] + guest_phone = form.cleaned_data['guest_phone'] + guest_email = form.cleaned_data['guest_email'] + guest_address = form.cleaned_data['guest_address'] + rooms_required = form.cleaned_data['rooms_required'] + total_guest = form.cleaned_data['total_guest'] + purpose = form.cleaned_data['purpose'] + arrival_date = form.cleaned_data['arrival_date'] + arrival_time = form.cleaned_data['arrival_time'] + departure_date = form.cleaned_data['departure_date'] + departure_time = form.cleaned_data['departure_time'] + nationality = form.cleaned_data['nationality'] + room_type = form.cleaned_data['room_type'] # Add room type + + + max_guests = { + 'single': 1, + 'double': 2, + 'triple': 3, + } + # Fetch available room count based on room type and hall + available_rooms_count = GuestRoom.objects.filter( + hall=hall, room_type=room_type, vacant=True + ).count() + + # Check if there are enough available rooms + if available_rooms_count < rooms_required: + messages.error(request, "Not enough available rooms.") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + # Check if the number of guests exceeds the capacity of selected rooms + if total_guest > rooms_required * max_guests.get(room_type, 1): + messages.error(request, "Number of guests exceeds the capacity of selected rooms.") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + + newBooking = GuestRoomBooking.objects.create(hall=hall, intender=request.user, guest_name=guest_name, guest_address=guest_address, + guest_phone=guest_phone, guest_email=guest_email, rooms_required=rooms_required, total_guest=total_guest, purpose=purpose, + arrival_date=arrival_date, arrival_time=arrival_time, departure_date=departure_date, departure_time=departure_time, nationality=nationality,room_type=room_type) + newBooking.save() + messages.success(request, "Room request submitted successfully!") + + + # Get the caretaker for the selected hall + hall_caretaker = HallCaretaker.objects.get(hall=hall) + caretaker = hall_caretaker.staff.id.user + # Send notification to caretaker + hostel_notifications(sender=request.user, recipient=caretaker, type='guestRoom_request') + + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + else: + messages.error(request, "Something went wrong") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + +@login_required +def update_guest_room(request): + if request.method == "POST": + if 'accept_request' in request.POST: + status = request.POST['status'] + guest_room_request = GuestRoomBooking.objects.get( + pk=request.POST['accept_request']) + guest_room_instance = GuestRoom.objects.get( + hall=guest_room_request.hall, room=request.POST['guest_room_id']) + + # Assign the guest room ID to guest_room_id field + guest_room_request.guest_room_id = str(guest_room_instance.id) + + # Update the assigned guest room's occupancy details + guest_room_instance.occupied_till = guest_room_request.departure_date + guest_room_instance.vacant = False # Mark the room as occupied + guest_room_instance.save() + + # Update the occupied_till field of the room_booked + room_booked = GuestRoom.objects.get( + hall=guest_room_request.hall, room=request.POST['guest_room_id']) + room_booked.occupied_till = guest_room_request.departure_date + room_booked.save() + + # Save the guest room request after updating the fields + guest_room_request.status = status + guest_room_request.save() + messages.success(request, "Request accepted successfully!") + + hostel_notifications(sender=request.user,recipient=guest_room_request.intender,type='guestRoom_accept') + + + elif 'reject_request' in request.POST: + guest_room_request = GuestRoomBooking.objects.get( + pk=request.POST['reject_request']) + guest_room_request.status = 'Rejected' + guest_room_request.save() + + messages.success(request, "Request rejected successfully!") + + hostel_notifications(sender=request.user,recipient=guest_room_request.intender,type='guestRoom_reject') + + else: + messages.error(request, "Invalid request!") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + +def available_guestrooms_api(request): + if request.method == 'GET': + + hall_id = request.GET.get('hall_id') + room_type = request.GET.get('room_type') + + if hall_id and room_type: + available_rooms_count = GuestRoom.objects.filter(hall_id=hall_id, room_type=room_type, vacant=True).count() + return JsonResponse({'available_rooms_count': available_rooms_count}) + + return JsonResponse({'error': 'Invalid request'}, status=400) + + +# //Caretaker can approve or reject leave applied by the student +@csrf_exempt +def update_leave_status(request): + if request.method == 'POST': + leave_id = request.POST.get('leave_id') + status = request.POST.get('status') + try: + leave = HostelLeave.objects.get(id=leave_id) + leave.status = status + leave.remark = request.POST.get('remark') + leave.save() + + # Send notification to the student + sender = request.user # Assuming request.user is the caretaker + + student_id = leave.roll_num # Assuming student is a foreign key field in HostelLeave model + recipient = User.objects.get(username=student_id) + type = "leave_accept" if status == "Approved" else "leave_reject" + hostel_notifications(sender, recipient, type) + + return JsonResponse({'status': status,'remarks':leave.remark,'message': 'Leave status updated successfully.'}) + except HostelLeave.DoesNotExist: + return JsonResponse({'status': 'error', 'message': 'Leave not found.'}, status=404) + else: + return JsonResponse({'status': 'error', 'message': 'Only POST requests are allowed.'}, status=405) + + +# //! Manage Fine +# //! Add Fine Functionality + + +@login_required +def show_fine_edit_form(request,fine_id): + user_id = request.user + staff = user_id.extrainfo.id + caretaker = HallCaretaker.objects.get(staff_id=staff) + hall_id = caretaker.hall_id + + fine = HostelFine.objects.filter(fine_id=fine_id) + + + + return render(request, 'hostelmanagement/impose_fine_edit.html', {'fines': fine[0]}) + +@login_required +def update_student_fine(request,fine_id): + if request.method == 'POST': + fine = HostelFine.objects.get(fine_id=fine_id) + print("------------------------------------------------") + print(request.POST) + fine.amount = request.POST.get('amount') + fine.status = request.POST.get('status') + fine.reason = request.POST.get('reason') + fine.save() + + return HttpResponse({'message': 'Fine has edited successfully'}, status=status.HTTP_200_OK) + + +@login_required +def impose_fine_view(request): + user_id = request.user + staff = user_id.extrainfo.id + students = Student.objects.all() + + if HallCaretaker.objects.filter(staff_id=staff).exists(): + return render(request, 'hostelmanagement/impose_fine.html', {'students': students}) + + return HttpResponse(f'') + + +class HostelFineView(APIView): + """ + API endpoint for imposing fines on students. + """ + authentication_classes = [SessionAuthentication] + permission_classes = [IsAuthenticated] + + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) + + def post(self, request): + # Check if the user is a caretaker + user_id = request.user + staff = user_id.extrainfo.id + + try: + caretaker = HallCaretaker.objects.get(staff_id=staff) + except HallCaretaker.DoesNotExist: + return HttpResponse(f'') + + hall_id = caretaker.hall_id + + # Extract data from the request + student_id = request.data.get('student_id') + student_name = request.data.get('student_fine_name') + amount = request.data.get('amount') + reason = request.data.get('reason') + + # Validate the data + if not all([student_id, student_name, amount, reason]): + return HttpResponse({'error': 'Incomplete data provided.'}, status=status.HTTP_400_BAD_REQUEST) + + # Create the HostelFine object + try: + fine = HostelFine.objects.create( + student_id=student_id, + student_name=student_name, + amount=amount, + reason=reason, + hall_id=hall_id + ) + # Sending notification to the student about the imposed fine + + + + recipient = User.objects.get(username=student_id) + + sender = request.user + + type = "fine_imposed" + hostel_notifications(sender, recipient, type) + + return HttpResponse({'message': 'Fine imposed successfully.'}, status=status.HTTP_201_CREATED) + except Exception as e: + return Response({'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +@login_required +def get_student_name(request, username): + try: + user = User.objects.get(username=username) + full_name = f"{user.first_name} {user.last_name}" if user.first_name or user.last_name else "" + return JsonResponse({"name": full_name}) + except User.DoesNotExist: + return JsonResponse({"error": "User not found"}, status=404) + + +@login_required +def hostel_fine_list(request): + user_id = request.user + staff = user_id.extrainfo.id + caretaker = HallCaretaker.objects.get(staff_id=staff) + hall_id = caretaker.hall_id + hostel_fines = HostelFine.objects.filter( + hall_id=hall_id).order_by('fine_id') + + if HallCaretaker.objects.filter(staff_id=staff).exists(): + return render(request, 'hostelmanagement/hostel_fine_list.html', {'hostel_fines': hostel_fines}) + + return HttpResponse(f'') + + +@login_required +def student_fine_details(request): + user_id = request.user.username + # print(user_id) + # staff=user_id.extrainfo.id + + # Check if the user_id exists in the Student table + # if HallCaretaker.objects.filter(staff_id=staff).exists(): + # return HttpResponse('') + + if not Student.objects.filter(id_id=user_id).exists(): + return HttpResponse('') + + # # Check if the user_id exists in the HostelFine table + if not HostelFine.objects.filter(student_id=user_id).exists(): + return HttpResponse('') + + # # Retrieve the fines associated with the current student + student_fines = HostelFine.objects.filter(student_id=user_id) + + return render(request, 'hostelmanagement/student_fine_details.html', {'student_fines': student_fines}) + + # return JsonResponse({'message': 'Nice'}, status=status.HTTP_200_OK) + + +class HostelFineUpdateView(APIView): + authentication_classes = [SessionAuthentication] + permission_classes = [IsAuthenticated] + + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) + + def post(self, request, fine_id): + user_id = request.user + staff = user_id.extrainfo.id + + data = request.data + fine_idd = data.get('fine_id') + status_ = data.get('status') + # print("fine_idd",fine_idd) + # print("status_",status_) + + try: + caretaker = HallCaretaker.objects.get(staff_id=staff) + except HallCaretaker.DoesNotExist: + return Response({'error': 'You are not authorized to access this page'}, status=status.HTTP_403_FORBIDDEN) + + hall_id = caretaker.hall_id + + # Convert fine_id to integer + fine_id = int(fine_id) + + # Get hostel fine object + try: + hostel_fine = HostelFine.objects.get( + hall_id=hall_id, fine_id=fine_id) + except HostelFine.DoesNotExist: + raise NotFound(detail="Hostel fine not found") + + # Validate required fields + if status_ not in ['Pending', 'Paid']: + return Response({'error': 'Invalid status value'}, status=status.HTTP_400_BAD_REQUEST) + + # # Update status of the hostel fine + hostel_fine.status = status_ + hostel_fine.save() + + # Return success response + return Response({'message': 'Hostel fine status updated successfully!'}, status=status.HTTP_200_OK) + + def delete(self, request, fine_id): + user_id = request.user + staff = user_id.extrainfo.id + + try: + caretaker = HallCaretaker.objects.get(staff_id=staff) + except HallCaretaker.DoesNotExist: + return Response({'error': 'You are not authorized to access this page'}, status=status.HTTP_403_FORBIDDEN) + + hall_id = caretaker.hall_id + + # Convert fine_id to integer + fine_id = int(fine_id) + + # Get hostel fine object + try: + hostel_fine = HostelFine.objects.get( + hall_id=hall_id, fine_id=fine_id) + hostel_fine.delete() + except HostelFine.DoesNotExist: + raise NotFound(detail="Hostel fine not found") + + return Response({'message': 'Fine deleted successfully.'}, status=status.HTTP_204_NO_CONTENT) + + + + +class EditStudentView(View): + template_name = 'hostelmanagement/edit_student.html' + + def get(self, request, student_id): + student = Student.objects.get(id=student_id) + + context = {'student': student} + return render(request, self.template_name, context) + + def post(self, request, student_id): + student = Student.objects.get(id=student_id) + + # Update student details + student.id.user.first_name = request.POST.get('first_name') + student.id.user.last_name = request.POST.get('last_name') + student.programme = request.POST.get('programme') + student.batch = request.POST.get('batch') + student.hall_no = request.POST.get('hall_number') + student.room_no = request.POST.get('room_number') + student.specialization = request.POST.get('specialization') + + student.save() + + # Update phone number and address from ExtraInfo model + student.id.phone_no = request.POST.get('phone_number') + student.id.address = request.POST.get('address') + student.id.save() + student.save() + messages.success(request, 'Student details updated successfully.') + return redirect("hostelmanagement:hostel_view") + +class RemoveStudentView(View): + def post(self, request, student_id): + try: + student = Student.objects.get(id=student_id) + student.hall_no = 0 + student.save() + messages.success(request, 'Student removed successfully.') + return redirect("hostelmanagement:hostel_view") + return JsonResponse({'status': 'success', 'message': 'Student removed successfully'}) + except Student.DoesNotExist: + return JsonResponse({'status': 'error', 'message': 'Student not found'}, status=404) + except Exception as e: + return JsonResponse({'status': 'error', 'message': str(e)}, status=500) + + def dispatch(self, request, *args, **kwargs): + if request.method != 'POST': + return JsonResponse({'status': 'error', 'message': 'Method Not Allowed'}, status=405) + return super().dispatch(request, *args, **kwargs) + + diff --git a/FusionIIIT/applications/hr2/migrations/0001_initial.py b/FusionIIIT/applications/hr2/migrations/0001_initial.py index 83b197c8f..733f5b0bb 100644 --- a/FusionIIIT/applications/hr2/migrations/0001_initial.py +++ b/FusionIIIT/applications/hr2/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import django.core.validators from django.db import migrations, models diff --git a/FusionIIIT/applications/income_expenditure/migrations/0001_initial.py b/FusionIIIT/applications/income_expenditure/migrations/0001_initial.py index 1501efdb9..e772edafa 100644 --- a/FusionIIIT/applications/income_expenditure/migrations/0001_initial.py +++ b/FusionIIIT/applications/income_expenditure/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.db import migrations, models import django.db.models.deletion diff --git a/FusionIIIT/applications/iwdModuleV2/migrations/0001_initial.py b/FusionIIIT/applications/iwdModuleV2/migrations/0001_initial.py index bbde8386c..b86a5c530 100644 --- a/FusionIIIT/applications/iwdModuleV2/migrations/0001_initial.py +++ b/FusionIIIT/applications/iwdModuleV2/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.db import migrations, models import django.db.models.deletion diff --git a/FusionIIIT/applications/iwdModuleV2/models.py b/FusionIIIT/applications/iwdModuleV2/models.py index a5c40c7b2..a0834f1bb 100644 --- a/FusionIIIT/applications/iwdModuleV2/models.py +++ b/FusionIIIT/applications/iwdModuleV2/models.py @@ -1,5 +1,5 @@ from django.db import models - +from datetime import date # Create your models here. @@ -160,3 +160,51 @@ class NoOfTechnicalBidTimes(models.Model): key = models.ForeignKey(Projects, on_delete=models.CASCADE, unique=True) number = models.IntegerField() +class Requests(models.Model): + name = models.CharField(max_length=200) + description = models.CharField(max_length=200) + area = models.CharField(max_length=200) + requestCreatedBy = models.CharField(max_length=200) + engineerProcessed = models.IntegerField(default=0) + directorApproval = models.IntegerField(default=0) + deanProcessed = models.IntegerField(default=0) + status = models.CharField(max_length=200) + issuedWorkOrder = models.IntegerField(default=0) + workCompleted = models.IntegerField(default=0) + billGenerated = models.IntegerField(default=0) + billProcessed = models.IntegerField(default=0) + billSettled = models.IntegerField(default=0) + +class WorkOrder(models.Model): + # request_id = models.IntegerField() + request_id = models.ForeignKey(Requests, on_delete=models.CASCADE) + name = models.CharField(max_length=200) + date = models.DateField(default=date.today) + agency = models.CharField(max_length=200) + amount = models.IntegerField(default=0) + deposit = models.IntegerField(default=0) + alloted_time = models.CharField(max_length=200) + start_date = models.DateField() + completion_date = models.DateField() + +class Inventory(models.Model): + name = models.CharField(max_length=200) + quantity = models.IntegerField(default=0) + cost = models.IntegerField(default=0) + +class UsedItems(models.Model): + # requestId = models.IntegerField() + request_id = models.ForeignKey(Requests, on_delete=models.CASCADE) + itemName = models.CharField(max_length=200) + cost = models.IntegerField(default=0) + quantity = models.IntegerField(default=0) + date = models.DateField(default=date.today) + +class Bills(models.Model): + # requestId = models.IntegerField() + request_id = models.ForeignKey(Requests, on_delete=models.CASCADE) + file = models.FileField() + +class Budget(models.Model): + name = models.CharField(max_length=200) + budgetIssued = models.IntegerField(default=0) diff --git a/FusionIIIT/applications/iwdModuleV2/urls.py b/FusionIIIT/applications/iwdModuleV2/urls.py index 6ad401098..0c0830cea 100644 --- a/FusionIIIT/applications/iwdModuleV2/urls.py +++ b/FusionIIIT/applications/iwdModuleV2/urls.py @@ -36,5 +36,46 @@ url(r'milestoneView/$', views.milestoneView, name='Milestones'), url(r'addendumView/$', views.addendumView, name='Addendum View'), url('agreementView/$', views.agreementView, name='Agreement VIew'), - url(r'corrigendumView/$', views.corrigendumView, name='Corrigendum View') + url(r'corrigendumView/$', views.corrigendumView, name='Corrigendum View'), + url('requestsView/',views.requestsView, name='Requests view'), + url('createdRequestsView/',views.createdRequests, name='Created Requests view'), + url('handleEngineerProcessRequests/', views.handleEngineerProcessRequests, name='Engineer-Process-Requests'), + url('engineerProcessedRequestsView/',views.engineerProcessedRequests, name='Engineer-Processed-Requests view'), + url('handleDeanProcessRequests/', views.handleDeanProcessRequests, name='Dean-Process-Requests'), + url('deanProcessedRequestsView/',views.deanProcessedRequests, name='Dean-Processed-Requests view'), + url('handleDirectorApprovalRequests/', views.handleDirectorApprovalRequests, name='Director-Approval-Requests'), + url('handleDirectorRejectionRequests/', views.handleDirectorRejectionRequests, name='Director-Rejection-Requests'), + url('updateRejectedRequests/', views.updateRejectedRequests, name='Update-Rejected-Requests'), + url('handleUpdateRequests/', views.handleUpdateRequests, name='Handle-Update-Requests'), + # url('rejectedRequests/', views.rejectedRequests, name='Rejected-Requests'), + url('rejectedRequestsView/',views.rejectedRequests, name='Rejected Requests view'), + url('requestsStatus/', views.requestsStatus, name='Requests-Status'), + url('fetchDesignations/', views.fetchDesignations, name='Fetch-Designations'), + url('fetchRequest/', views.fetchRequest, name='Fetch-Request'), + url('issueWorkOrder/', views.issueWorkOrder, name='Issue Work Order'), + url('workOrder/', views.workOrder, name='Work Order'), + url('inventory/', views.inventory, name='Inventory'), + url('addItemsView/', views.addItemsView, name='Add Items View'), + url('addItems/', views.addItems, name='Add Items'), + url('editInventoryView/', views.editInventoryView, name='Edit Inventory View'), + url('editInventory/', views.editInventory, name='Edit Inventory'), + url('requestsInProgess/', views.requestsInProgess, name='Requests In Progress'), + url('workCompleted/', views.workCompleted, name='Work Completed'), + url('requestFromInventory/', views.requestFromInventory, name='Request From Inventory'), + url('editInventoryAfterRequest/', views.editInventoryAfterRequest, name='Edit-Inventory-After-Request'), + url('generateFinalBill/', views.generateFinalBill, name='Generate-Final-Bill'), + url('handleBillGeneratedRequests/', views.handleBillGeneratedRequests, name='Handle-Bill-Generated-Requests'), + url('generatedBillsView/', views.generatedBillsView, name='Generated-Bills-View'), + url('handleProcessedBills/', views.handleProcessedBills, name='Handle-Processed-Bills'), + url('auditDocumentView/', views.auditDocumentView, name='Audit-Document-View'), + url('auditDocument/', views.auditDocument, name='Audit-Document'), + url('settleBillsView/', views.settleBillsView, name='Settle-Bills-View'), + url('handleSettleBillRequests/', views.handleSettleBillRequests, name='Handle-Settle-Bill-Requests'), + url('viewBudget/', views.viewBudget, name='View-Budget'), + url('budget/', views.budget, name='Budget'), + url('addBudget/', views.addBudget, name='Add-Budget'), + url('editBudgetView/', views.editBudgetView, name='Edit-Budget-View'), + url('editBudget/', views.editBudget, name='Edit-Budget'), + # url('billsView/',views.billsView, name='Bills View'), + ] diff --git a/FusionIIIT/applications/iwdModuleV2/views.py b/FusionIIIT/applications/iwdModuleV2/views.py index 2b36550fc..38a7e4ee7 100644 --- a/FusionIIIT/applications/iwdModuleV2/views.py +++ b/FusionIIIT/applications/iwdModuleV2/views.py @@ -1,9 +1,20 @@ from django.shortcuts import render, redirect - +from django.urls import reverse +from django.db.models import Q from applications.globals.models import * +from django.contrib.auth.decorators import login_required from .models import * from django.http import HttpResponseRedirect - +from applications.filetracking.sdk.methods import * +from applications.globals.models import ExtraInfo, HoldsDesignation, Designation +from datetime import datetime +from reportlab.lib.pagesizes import letter +from reportlab.pdfgen import canvas +from reportlab.platypus import Table, TableStyle +from reportlab.lib import colors +from django.http import HttpResponse +from io import BytesIO +from django.core.files.base import File as DjangoFile # Create your views here. @@ -17,17 +28,27 @@ # owing to length and inherent extensiveness of code. Rather than, whosoever read this code is advised to do so # in conjunction with SRS. After that, everything will become easier. +# def dashboard(request): +# eligible = False +# userObj = request.user +# userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) +# for p in userDesignationObjects: +# if p.designation.name == 'Admin IWD': +# eligible = True +# break +# return render(request, 'iwdModuleV2/dashboard.html', {'eligible': eligible}) + +#Junior Engineer, Electrical Engineer (Civil), Electrical_AE, Electrical_JE, EE, Civil_AE, Civil_JE + def dashboard(request): - eligible = False + eligible = "" userObj = request.user userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) for p in userDesignationObjects: - if p.designation.name == 'Admin IWD': - eligible = True - break + eligible = p.designation.name + print(eligible) return render(request, 'iwdModuleV2/dashboard.html', {'eligible': eligible}) - def page1_1(request): if request.method == 'POST': formObject = PageOneDetails() @@ -107,7 +128,8 @@ def page2_1(request): def corrigendumInput(request): if request.method == 'POST': - existingObject = CorrigendumTable.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = CorrigendumTable.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = CorrigendumTable() @@ -128,7 +150,8 @@ def corrigendumInput(request): def addendumInput(request): if request.method == 'POST': - existingObject = Addendum.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = Addendum.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = Addendum() @@ -145,7 +168,8 @@ def addendumInput(request): def PreBidForm(request): if request.method == 'POST': - existingObject = PreBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = PreBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = PreBidDetails() @@ -161,9 +185,11 @@ def PreBidForm(request): def noOfEntriesTechnicalBid(request): formNoTechnicalObjects = NoOfTechnicalBidTimes() - formNoTechnicalObjects.key = Projects.objects.get(id=request.session['projectId']) + formNoTechnicalObjects.key = Projects.objects.get( + id=request.session['projectId']) if request.method == 'POST': - existingObject = NoOfTechnicalBidTimes.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = NoOfTechnicalBidTimes.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formNoTechnicalObjects.number = int(request.POST['number']) @@ -174,9 +200,11 @@ def noOfEntriesTechnicalBid(request): def TechnicalBidForm(request): formObject = TechnicalBidDetails() - numberOfTechnicalBidTimes = NoOfTechnicalBidTimes.objects.get(key=Projects.objects.get(id=request.session['projectId'])).number + numberOfTechnicalBidTimes = NoOfTechnicalBidTimes.objects.get( + key=Projects.objects.get(id=request.session['projectId'])).number if request.method == 'POST': - existingObject = TechnicalBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = TechnicalBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = TechnicalBidDetails() @@ -184,12 +212,14 @@ def TechnicalBidForm(request): formObject.sNo = request.POST['sNo'] formObject.requirements = request.POST['requirements'] formObject.save() - TechnicalBidContractorDetails.objects.filter(key=formObject).all().delete() + TechnicalBidContractorDetails.objects.filter( + key=formObject).all().delete() for w in range(numberOfTechnicalBidTimes): formContractorObject = TechnicalBidContractorDetails() formContractorObject.key = formObject formContractorObject.name = request.POST[str(w) + 'name'] - formContractorObject.description = request.POST[str(w) + 'Description'] + formContractorObject.description = request.POST[str( + w) + 'Description'] formContractorObject.save() return redirect('iwdModuleV2/noOfEntriesFinancialBid') return render(request, 'iwdModuleV2/page2_support_4_technicalbid.html', @@ -198,12 +228,15 @@ def TechnicalBidForm(request): def noOfEntriesFinancialBid(request): listOfContractors = [] - objectTechnicalBid = TechnicalBidDetails.objects.get(key=Projects.objects.get(id=request.session['projectId'])) - objects = TechnicalBidContractorDetails.objects.filter(key=objectTechnicalBid) + objectTechnicalBid = TechnicalBidDetails.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) + objects = TechnicalBidContractorDetails.objects.filter( + key=objectTechnicalBid) for t in objects: listOfContractors.append(t.name) if request.method == 'POST': - existingObject = FinancialBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = FinancialBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = FinancialBidDetails() @@ -217,7 +250,8 @@ def noOfEntriesFinancialBid(request): formContractorObject.name = listOfContractors[f] formContractorObject.totalCost = request.POST[listOfContractors[f] + 'totalCost'] formContractorObject.estimatedCost = request.POST[listOfContractors[f] + 'estimatedCost'] - formContractorObject.percentageRelCost = request.POST[listOfContractors[f] + 'percentageRelCost'] + formContractorObject.percentageRelCost = request.POST[ + listOfContractors[f] + 'percentageRelCost'] formContractorObject.perFigures = request.POST[listOfContractors[f] + 'perFigures'] formContractorObject.save() return redirect('iwdModuleV2/letterOfIntent') @@ -227,7 +261,8 @@ def noOfEntriesFinancialBid(request): def letterOfIntent(request): if request.method == 'POST': - existingObject = LetterOfIntentDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = LetterOfIntentDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = LetterOfIntentDetails() @@ -244,7 +279,8 @@ def letterOfIntent(request): def workOrderForm(request): if request.method == 'POST': - existingObject = WorkOrderForm.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = WorkOrderForm.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = WorkOrderForm() @@ -267,7 +303,8 @@ def workOrderForm(request): def AgreementInput(request): if request.method == 'POST': - existingObject = Agreement.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = Agreement.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = Agreement() @@ -291,7 +328,8 @@ def milestonesForm(request): formObject.timeAllowed = request.POST['timeAllowed'] formObject.save() return redirect('iwdModuleV2/page3_1') - Milestones.objects.filter(key=Projects.objects.get(id=request.session['projectId'])).all().delete() + Milestones.objects.filter(key=Projects.objects.get( + id=request.session['projectId'])).all().delete() return render(request, 'iwdModuleV2/page2_support_9_milestone.html', {}) @@ -321,35 +359,42 @@ def ExtensionOfTimeForm(request): def page1View(request): - request.session['projectId'] = request.POST['id'] - projectPageOne = PageOneDetails.objects.get(id=Projects.objects.get(id=request.session['projectId'])) + if request.POST: + request.session['projectId'] = request.POST['id'] + projectPageOne = PageOneDetails.objects.get( + id=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page1.html', {'x': projectPageOne}) def page2View(request): - projectPageTwo = PageTwoDetails.objects.get(id=Projects.objects.get(id=request.session['projectId'])) + projectPageTwo = PageTwoDetails.objects.get( + id=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page2.html', {'x': projectPageTwo}) def AESView(request): - objects = AESDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + objects = AESDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/AA&ES.html', {'AES': objects}) def financialBidView(request): elements = [] - objects = FinancialBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + objects = FinancialBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) for f in objects: contractorObjects = FinancialContractorDetails.objects.filter(key=f) for w in contractorObjects: - obj = [f.sNo, f.description, w.name, w.estimatedCost, w.percentageRelCost, w.perFigures, w.totalCost] + obj = [f.sNo, f.description, w.name, w.estimatedCost, + w.percentageRelCost, w.perFigures, w.totalCost] elements.append(obj) return render(request, 'iwdModuleV2/Page2_financialbid.html', {'financial': elements}) def technicalBidView(request): elements = [] - objects = TechnicalBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + objects = TechnicalBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) for f in objects: contractorObjects = TechnicalBidContractorDetails.objects.filter(key=f) for w in contractorObjects: @@ -359,45 +404,976 @@ def technicalBidView(request): def preBidDetailsView(request): - preBidObjects = PreBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + preBidObjects = PreBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page2_pre-bid.html', {'preBidDetails': preBidObjects}) def corrigendumView(request): - corrigendumObject = CorrigendumTable.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + corrigendumObject = CorrigendumTable.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/corrigendum.html', {'corrigendum': corrigendumObject}) def addendumView(request): - addendumObject = Addendum.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + addendumObject = Addendum.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Addendum.html', {'x': addendumObject}) def letterOfIntentView(request): - letterOfIntentObject = LetterOfIntentDetails.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + letterOfIntentObject = LetterOfIntentDetails.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/letterOfIntent.html', {'x': letterOfIntentObject}) def workOrderFormView(request): - workOrderFormObject = WorkOrderForm.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + workOrderFormObject = WorkOrderForm.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/WorkOrderForm.html', {'x': workOrderFormObject}) def agreementView(request): - agreementObject = Agreement.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + agreementObject = Agreement.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Agreement.html', {'agreement': agreementObject}) def milestoneView(request): - milestoneObjects = Milestones.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + milestoneObjects = Milestones.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page2_milestones.html', {'milestones': milestoneObjects}) def page3View(request): - pageThreeDetails = PageThreeDetails.objects.get(id=Projects.objects.get(id=request.session['projectId'])) + pageThreeDetails = PageThreeDetails.objects.get( + id=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page3.html', {'x': pageThreeDetails}) def extensionFormView(request): - extensionObjects = ExtensionOfTimeDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + extensionObjects = ExtensionOfTimeDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/ExtensionForm.html', {'extension': extensionObjects}) + +designations_list = ["Junior Engineer", "Executive Engineer (Civil)", "Electrical_AE", "Electrical_JE", "EE", "Civil_AE", "Civil_JE", "Dean (P&D)", "Director", "Accounts Admin", "Admin IWD", "Auditor"] + +@login_required +def fetchDesignations(request): + designations = Designation.objects.filter() + + holdsDesignations = [] + + for d in designations: + for x in designations_list: + if d.name == x: + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + return render(request, 'iwdModuleV2/requestsView.html', {'holdsDesignations' : holdsDesignations}) + +@login_required +def requestsView(request): + if request.method == 'POST': + formObject = Requests() + # formObject.key = Projects.objects.get(id=request.session['projectId']) + formObject.name = request.POST['name'] + formObject.description = request.POST['description'] + formObject.area = request.POST['area'] + formObject.engineerProcessed = 0 + formObject.directorApproval = 0 + formObject.deanProcessed = 0 + formObject.requestCreatedBy = request.user.username + formObject.status = "Pending" + formObject.issuedWorkOrder = 0 + formObject.workCompleted = 0 + formObject.billGenerated = 0 + formObject.billProcessed = 0 + formObject.billSettled = 0 + formObject.save() + print(request.user) + print(request.user.username) + request_object = Requests.objects.get(pk=formObject.pk) + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + print(d) + print(d1) + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="IWD", + src_object_id= str(request_object.id), + file_extra_JSON= {"value": 2}, + attached_file = None) + + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + return render(request, 'iwdModuleV2/dashboard.html', {'eligible' : eligible}) + +@login_required +def createdRequests(request): + obj = [] + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + for result in inbox_files: + src_object_id = result['src_object_id'] + request_object = Requests.objects.filter(id=src_object_id).first() + if request_object: + element = [request_object.id, request_object.name, request_object.area, request_object.description, request_object.requestCreatedBy] + obj.append(element) + + designations = Designation.objects.filter() + + holdsDesignations = [] + + for d in designations: + for x in designations_list: + if d.name == x: + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + return render(request, 'iwdModuleV2/createdRequests.html', {'obj' : obj, 'holdsDesignations' : holdsDesignations}) + +@login_required +def handleEngineerProcessRequests(request): + if request.method == 'POST': + + request_id = request.POST.get("id", 0) + + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="IWD", + src_object_id= str(request_id), + file_extra_JSON= {"value": 2}, + attached_file = None) + + Requests.objects.filter(id=request_id).update(engineerProcessed=1, status="Approved by the engineer") + + inbox_files = view_inbox( + username=request.user, + designation=d1.designation, + src_module="IWD" + ) + + for p in inbox_files: + if p['src_object_id'] == request_id: + delete_file(file_id = p['id']) + break + + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + + return render(request, 'iwdModuleV2/dashboard.html', {'eligible': eligible}) + +@login_required +def engineerProcessedRequests(request): + + obj = [] + + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + for result in inbox_files: + src_object_id = result['src_object_id'] + request_object = Requests.objects.filter(id=src_object_id).first() + if request_object: + element = [request_object.id, request_object.name, request_object.area, request_object.description, request_object.requestCreatedBy] + obj.append(element) + + designations = Designation.objects.filter() + + holdsDesignations = [] + + for d in designations: + for x in designations_list: + if d.name == x: + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + return render(request, 'iwdModuleV2/engineerProcessedRequests.html', {'obj' : obj, 'holdsDesignations' : holdsDesignations}) + +@login_required +def handleDeanProcessRequests(request): + if request.method == 'POST': + + request_id = request.POST.get("id", 0) + + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="IWD", + src_object_id= str(request_id), + file_extra_JSON= {"value": 2}, + attached_file = None) + + Requests.objects.filter(id=request_id).update(deanProcessed=1, status="Approved by the dean") + + inbox_files = view_inbox( + username=request.user, + designation=d1.designation, + src_module="IWD" + ) + + for p in inbox_files: + if p['src_object_id'] == request_id: + delete_file(file_id = p['id']) + break + + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + return render(request, 'iwdModuleV2/dashboard.html', {'eligible': eligible}) + +@login_required +def deanProcessedRequests(request): + obj = [] + + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + for result in inbox_files: + src_object_id = result['src_object_id'] + request_object = Requests.objects.filter(id=src_object_id).first() + if request_object: + element = [request_object.id, request_object.name, request_object.area, request_object.description, request_object.requestCreatedBy] + obj.append(element) + + designations = Designation.objects.filter() + + holdsDesignations = [] + + for d in designations: + for x in designations_list: + if d.name == x: + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + return render(request, 'iwdModuleV2/deanProcessedRequests.html', {'obj' : obj, 'holdsDesignations' : holdsDesignations}) + +@login_required +def handleDirectorApprovalRequests(request): + if request.method == 'POST': + request_id = request.POST.get("id", 0) + + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="IWD", + src_object_id= str(request_id), + file_extra_JSON= {"value": 2}, + attached_file = None) + + Requests.objects.filter(id=request_id).update(directorApproval=1, status="Approved by the director") + + inbox_files = view_inbox( + username=request.user, + designation=d1.designation, + src_module="IWD" + ) + + for p in inbox_files: + if p['src_object_id'] == request_id: + delete_file(file_id = p['id']) + break + + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + return render(request, 'iwdModuleV2/dashboard.html', {'eligible': eligible}) + +@login_required +def handleDirectorRejectionRequests(request): + if request.method == 'POST': + request_id = request.POST.get("id", 0) + + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="IWD", + src_object_id= str(request_id), + file_extra_JSON= {"value": 2}, + attached_file = None) + + Requests.objects.filter(id=request_id).update(directorApproval=-1, status="Rejected by the director") + + inbox_files = view_inbox( + username=request.user, + designation=d1.designation, + src_module="IWD" + ) + + for p in inbox_files: + if p['src_object_id'] == request_id: + delete_file(file_id = p['id']) + break + + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + return render(request, 'iwdModuleV2/dashboard.html', {'eligible': eligible}) + +@login_required +def rejectedRequests(request): + obj = [] + + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + for result in inbox_files: + src_object_id = result['src_object_id'] + request_object = Requests.objects.filter(id=src_object_id).first() + if request_object.directorApproval == -1: + element = [request_object.id, request_object.name, request_object.area, request_object.description, request_object.requestCreatedBy] + obj.append(element) + + designations = Designation.objects.filter() + + holdsDesignations = [] + + for d in designations: + for x in designations_list: + if d.name == x: + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + return render(request, 'iwdModuleV2/rejectedRequests.html', {'obj' : obj, 'holdsDesignations' : holdsDesignations}) + +@login_required +def updateRejectedRequests(request): + request_id = request.POST.get("id", 0) + + d1 = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d1.designation, + src_module="IWD" + ) + + for p in inbox_files: + if p['src_object_id'] == request_id: + delete_file(file_id = p['id']) + break + + designations = Designation.objects.filter() + + holdsDesignations = [] + obj = [] + + request_object = Requests.objects.get(id=request_id) + + obj = [request_object.id, request_object.name, request_object.description, request_object.area] + + for d in designations: + for x in designations_list: + if d.name == x: + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + return render(request, 'iwdModuleV2/updateRequests.html', {'obj' : obj, 'holdsDesignations' : holdsDesignations}) + +@login_required +def handleUpdateRequests(request): + if request.method == 'POST': + request_id = request.POST.get("id", 0) + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + Requests.objects.filter(id=request_id).update(name=request.POST['name'], + description=request.POST['description'], + area=request.POST['area'], + engineerProcessed=0, + directorApproval=0, + deanProcessed=0, + requestCreatedBy=request.user.username, + status="Pending", + issuedWorkOrder=0, + workCompleted=0, + billGenerated=0, + billProcessed=0, + billSettled=0) + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="IWD", + src_object_id= str(request_id), + file_extra_JSON= {"value": 2}, + attached_file = None) + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + return render(request, 'iwdModuleV2/dashboard.html', {'eligible' : eligible}) + +@login_required +def issueWorkOrder(request): + obj = [] + + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + for result in inbox_files: + uploader = result['sent_by_designation'] + if uploader == 'Director': + src_object_id = result['src_object_id'] + request_object = Requests.objects.filter(id=src_object_id).first() + if request_object: + element = [request_object.id, request_object.name, request_object.area, request_object.description, request_object.requestCreatedBy] + obj.append(element) + + return render(request, 'iwdModuleV2/issueWorkOrder.html', {'obj' : obj}) + +@login_required +def fetchRequest(request): + request_id = request.POST.get("id", 0) + req_request = Requests.objects.get(id=request_id) + return render(request, 'iwdModuleV2/workOrder.html', {'req' : req_request}) + +@login_required +def workOrder(request): + if request.method == 'POST': + request_instance = Requests.objects.get(pk=request.POST['id']) + formObject = WorkOrder() + formObject.request_id = request_instance + formObject.name = request.POST['name'] + formObject.date = request.POST['date'] + formObject.agency = request.POST['agency'] + formObject.amount = request.POST['amount'] + formObject.deposit = request.POST['deposit'] + formObject.alloted_time = request.POST['time'] + formObject.start_date = request.POST['startDate'] + formObject.completion_date = request.POST['completionDate'] + formObject.save() + + Requests.objects.filter(id=request.POST['id']).update(status="Work Order issued", issuedWorkOrder=1) + + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + for result in inbox_files: + if result['src_object_id'] == request.POST['id'] and result['sent_by_designation'] == 'Director': + delete_file(file_id = result['id']) + break + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + obj = [] + + for result in inbox_files: + uploader = result['sent_by_designation'] + if uploader == 'Director': + src_object_id = result['src_object_id'] + request_object = Requests.objects.filter(id=src_object_id).first() + if request_object: + element = [request_object.id, request_object.name, request_object.area, request_object.description, request_object.requestCreatedBy] + obj.append(element) + + return render(request, 'iwdModuleV2/issueWorkOrder.html', {'obj' : obj}) + +@login_required +def requestsStatus(request): + obj = [] + requestsObject = Requests.objects.all() + for x in requestsObject: + element = [x.id, x.name, x.area, x.description, x.requestCreatedBy, x.status] + obj.append(element) + return render(request, 'iwdModuleV2/requestsStatus.html', {'obj' : obj}) + +@login_required +def inventory(request): + items = Inventory.objects.filter() + obj = [] + for i in items: + element = [i.id, i.name, i.quantity, i.cost] + obj.append(element) + return render(request, 'iwdModuleV2/inventory.html', {'obj' : obj}) + +@login_required +def addItemsView(request): + return render(request, 'iwdModuleV2/addItemsView.html') + +@login_required +def addItems(request): + if request.method == "POST": + formObject = Inventory() + formObject.name = request.POST['name'] + formObject.quantity = request.POST['quantity'] + formObject.cost = request.POST['cost'] + formObject.save() + return render(request, 'iwdModuleV2/addItemsView.html') + +@login_required +def editInventoryView(request): + items = Inventory.objects.filter() + obj = [] + for i in items: + element = [i.id, i.name, i.quantity, i.cost] + obj.append(element) + return render(request, 'iwdModuleV2/editInventory.html', {'obj' : obj}) + +@login_required +def editInventory(request): + if request.method == "POST": + itemId = request.POST['id'] + itemName = request.POST['name'] + itemQuantity = request.POST['quantity'] + itemCost = request.POST['cost'] + if itemQuantity == "0": + Inventory.objects.filter(id=itemId).delete() + else: + Inventory.objects.filter(id=itemId).update(name=itemName, quantity=itemQuantity, cost=itemCost) + items = Inventory.objects.filter() + obj = [] + for i in items: + element = [i.id, i.name, i.quantity, i.cost] + obj.append(element) + return render(request, 'iwdModuleV2/editInventory.html', {'obj' : obj}) + +@login_required +def requestsInProgess(request): + obj = [] + requestsObject = Requests.objects.filter(issuedWorkOrder=1, billGenerated=0) + for x in requestsObject: + element = [x.id, x.name, x.area, x.description, x.requestCreatedBy, x.workCompleted] + obj.append(element) + return render(request, 'iwdModuleV2/requestsInProgress.html', {'obj' : obj}) + +@login_required +def workCompleted(request): + if request.method == 'POST': + Requests.objects.filter(id=request.POST['id']).update(workCompleted=1, status="Work Completed") + obj = [] + requestsObject = Requests.objects.filter(issuedWorkOrder=1, billGenerated=0) + for x in requestsObject: + element = [x.id, x.name, x.area, x.description, x.requestCreatedBy, x.workCompleted] + obj.append(element) + return render(request, 'iwdModuleV2/requestsInProgress.html', {'obj' : obj}) + +@login_required +def requestFromInventory(request): + if request.method == 'POST': + requestId = request.POST['id'] + Req = Requests.objects.filter(id=requestId) + Items = Inventory.objects.filter() + req = [] + items = [] + for x in Req: + element = [x.id, x.name, x.area, x.description, x.requestCreatedBy, x.workCompleted] + req.append(element) + + for x in Items: + element = [x.id, x.name, x.quantity, x.cost] + items.append(element) + print(items) + return render(request, 'iwdModuleV2/requestFromInventory.html', {'req' : req, 'items' : items}) + +@login_required +def editInventoryAfterRequest(request): + if request.method == 'POST': + selectedItem = Inventory.objects.get(id=request.POST['selected_item_id']) + q = int(selectedItem.quantity) + if q == int(request.POST['quantity']): + Inventory.objects.filter(id=request.POST['selected_item_id']).delete() + else: + Inventory.objects.filter(id=request.POST['selected_item_id']).update(quantity=(q-int(request.POST['quantity']))) + formObject = UsedItems() + request_instance = Requests.objects.get(pk=request.POST['id']) + formObject.request_id = request_instance + formObject.itemName = selectedItem.name + formObject.cost = selectedItem.cost + formObject.quantity = request.POST['quantity'] + formObject.date = datetime.now().date() + formObject.save() + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + return render(request, 'iwdModuleV2/dashboard.html', {'eligible': eligible}) + +@login_required +def generateFinalBill(request): + if request.method == 'POST': + requestId = request.POST.get("id", 0) + + usedItems = UsedItems.objects.filter(request_id=requestId) + workOrder = WorkOrder.objects.get(request_id=requestId) + + itemsList = [] + + for used in usedItems: + element = [used.itemName, used.quantity, used.cost, used.date] + itemsList.append(element) + + filename = f"Request_id_{requestId}_final_bill.pdf" + + buffer = BytesIO() + + c = canvas.Canvas(buffer, pagesize=letter) + + c.setFont("Helvetica", 12) + + y_position = 750 + + rid = f"Request Id : {requestId}" + agency = f"Agency : {workOrder.agency}" + + c.drawString(100, y_position, rid) + y_position -= 20 + + c.drawString(100, y_position, agency) + y_position -= 20 + + c.drawString(100, y_position - 40, "Items:") + + data = [["Item Name", "Quantity", "Cost (in Rupees)", "Date of Purchase", "Total Amount"]] + for item in itemsList: + data.append([item[0], str(item[1]), "{:.2f}".format(item[2]), item[3], "{:.2f}".format(item[1] * item[2])]) + + total_amount_to_be_paid = sum(item[1] * item[2] for item in itemsList) + + c.drawString(100, y_position - 80, f"Total Amount (in Rupees): {total_amount_to_be_paid:.2f}") + + table = Table(data) + table.setStyle(TableStyle([('BACKGROUND', (0, 0), (-1, 0), colors.grey), + ('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke), + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'), + ('BOTTOMPADDING', (0, 0), (-1, 0), 12), + ('BACKGROUND', (0, 1), (-1, -1), colors.beige), + ('GRID', (0, 0), (-1, -1), 1, colors.black)])) + + table.wrapOn(c, 400, 600) + table.drawOn(c, 100, y_position - 60) + + c.save() + + buffer.seek(0) + + response = HttpResponse(content_type='application/pdf') + response['Content-Disposition'] = f'attachment; filename="{filename}"' + response.write(buffer.getvalue()) + + return response + +@login_required +def handleBillGeneratedRequests(request): + if request.method == 'POST': + requestId = request.POST.get("id", 0) + Requests.objects.filter(id=requestId).update(status="Bill Generated", billGenerated=1) + obj = [] + requestsObject = Requests.objects.filter(issuedWorkOrder=1, billGenerated=0) + for x in requestsObject: + element = [x.id, x.name, x.area, x.description, x.requestCreatedBy, x.workCompleted] + obj.append(element) + return render(request, 'iwdModuleV2/requestsInProgress.html', {'obj' : obj}) + +@login_required +def generatedBillsView(request): + request_object = Requests.objects.filter(billGenerated=1, billProcessed=0) + obj = [] + for x in request_object: + element = [x.id, x.name, x.description, x.area, x.requestCreatedBy] + obj.append(element) + designations = Designation.objects.filter() + + holdsDesignations = [] + + for d in designations: + for x in designations_list: + if d.name == x: + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + return render(request, 'iwdModuleV2/generatedBillsRequestsView.html', {'obj' : obj, 'holdsDesignations' : holdsDesignations}) + +@login_required +def handleProcessedBills(request): + if request.method == 'POST': + requestId = request.POST.get("id", 0) + request_instance = Requests.objects.get(pk=requestId) + + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="IWD", + src_object_id= str(requestId), + file_extra_JSON= {"value": 2}, + attached_file = request.FILES['bill']) + + formObject = Bills() + formObject.request_id = request_instance + formObject.file = request.FILES['bill'] + formObject.save() + + Requests.objects.filter(id=requestId).update(status="Final Bill Processed", billProcessed=1) + + request_object = Requests.objects.filter(billGenerated=1, billProcessed=0) + obj = [] + for x in request_object: + element = [x.id, x.name, x.description, x.area, x.requestCreatedBy] + obj.append(element) + + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + + return render(request, 'iwdModuleV2/dashboard.html', {'obj' : obj, 'eligible': eligible}) + +@login_required +def auditDocumentView(request): + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + obj = [] + + for x in inbox_files: + requestId = x['src_object_id'] + files = Bills.objects.get(request_id=requestId) + element = [files.request_id.id, files.file, files.file.url] + obj.append(element) + + designations = Designation.objects.filter() + + holdsDesignations = [] + + for d in designations: + if d.name == "Engineer" or d.name == "Dean" or d.name == "Director" or d.name == "Accounts Admin" or d.name == "Admin IWD": + list = HoldsDesignation.objects.filter(designation=d) + holdsDesignations.append(list) + + return render(request, 'iwdModuleV2/auditDocumentView.html', {'obj' : obj, 'holdsDesignations' : holdsDesignations}) + +@login_required +def auditDocument(request): + if request.method == 'POST': + requestId = request.POST.get("id", 0) + + d = HoldsDesignation.objects.get(user__username=request.POST['designation']) + d1 = HoldsDesignation.objects.get(user__username=request.user) + + create_file(uploader=request.user.username, + uploader_designation=d1.designation, + receiver=request.POST['designation'], + receiver_designation=d.designation, + src_module="IWD", + src_object_id= str(requestId), + file_extra_JSON= {"value": 2}, + attached_file = None) + + inbox_files = view_inbox( + username=request.user, + designation=d1.designation, + src_module="IWD" + ) + + for result in inbox_files: + print(result['src_object_id']) + if result['src_object_id'] == requestId: + delete_file(file_id = result['id']) + break + + Requests.objects.filter(id=requestId).update(status="Bill Audited") + + eligible = "" + userObj = request.user + userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) + for p in userDesignationObjects: + eligible = p.designation.name + + return render(request, 'iwdModuleV2/dashboard.html', {'eligible' : eligible}) + +@login_required +def settleBillsView(request): + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + obj = [] + + for x in inbox_files: + requestId = x['src_object_id'] + bills_object = Bills.objects.filter(request_id=requestId).first() + element = [bills_object.request_id.id, bills_object.file, bills_object.file.url] + obj.append(element) + + return render(request, 'iwdModuleV2/settleBillsView.html', {'obj' : obj}) + +@login_required +def handleSettleBillRequests(request): + if request.method == 'POST': + request_id = request.POST.get("id", 0) + + d = HoldsDesignation.objects.get(user__username=request.user) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + for p in inbox_files: + if p['src_object_id'] == request_id: + delete_file(file_id = p['id']) + break + + Requests.objects.filter(id=request_id).update(status="Final Bill Settled", billSettled=1) + + inbox_files = view_inbox( + username=request.user, + designation=d.designation, + src_module="IWD" + ) + + obj = [] + + for x in inbox_files: + request_id = x['src_object_id'] + bills_object = Bills.objects.get(request_id=request_id) + element = [request_id, bills_object.file, bills_object.file.url] + obj.append(element) + + return render(request, 'iwdModuleV2/settleBillsView.html', {'obj' : obj}) + +@login_required +def viewBudget(request): + + budget_object = Budget.objects.filter() + + obj = [] + + for x in budget_object: + element = [x.id, x.name, x.budgetIssued] + obj.append(element) + + return render(request, 'iwdModuleV2/viewBudget.html', {'obj' : obj}) + +@login_required +def budget(request): + budget_object = Budget.objects.filter() + + obj = [] + + for x in budget_object: + element = [x.id, x.name, x.budgetIssued] + obj.append(element) + + return render(request, 'iwdModuleV2/budget.html', {'obj' : obj}) + +@login_required +def addBudget(request): + if request.method == 'POST': + formObject = Budget() + formObject.name = request.POST['name'] + formObject.budgetIssued = request.POST['budget'] + formObject.save() + return render(request, 'iwdModuleV2/addBudget.html', {}) + +@login_required +def editBudgetView(request): + budget_object = Budget.objects.filter() + + obj = [] + + for x in budget_object: + element = [x.id, x.name, x.budgetIssued] + obj.append(element) + + return render(request, 'iwdModuleV2/editBudget.html', {'obj' : obj}) + +@login_required +def editBudget(request): + if request.method == "POST": + budgetId = request.POST['id'] + budgetName = request.POST['name'] + budgetIssued = request.POST['budget'] + Budget.objects.filter(id=budgetId).update(name=budgetName, budgetIssued=budgetIssued) + items = Budget.objects.filter() + obj = [] + for i in items: + element = [i.id, i.name, i.budgetIssued] + obj.append(element) + return render(request, 'iwdModuleV2/editBudget.html', {'obj' : obj}) + + diff --git a/FusionIIIT/applications/leave/migrations/0001_initial.py b/FusionIIIT/applications/leave/migrations/0001_initial.py index d9ce4e044..b6fa10f0c 100644 --- a/FusionIIIT/applications/leave/migrations/0001_initial.py +++ b/FusionIIIT/applications/leave/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.conf import settings from django.db import migrations, models diff --git a/FusionIIIT/applications/notifications_extension/api/urls.py b/FusionIIIT/applications/notifications_extension/api/urls.py index 1b420e336..62238c007 100644 --- a/FusionIIIT/applications/notifications_extension/api/urls.py +++ b/FusionIIIT/applications/notifications_extension/api/urls.py @@ -20,6 +20,7 @@ DepartmentNotificationAPIView, OfficeDeanRSPCNotificationAPIView, ResearchProceduresNotificationAPIView, + HostelModuleNotificationAPIView, MarkAsRead, Delete, NotificationsList, @@ -48,4 +49,5 @@ path('department_notification/', DepartmentNotificationAPIView.as_view(), name='department_notification'), path('office_dean_RSPC_notification/', OfficeDeanRSPCNotificationAPIView.as_view(), name='office_dean_RSPC_notification'), path('research_procedures_notification/', ResearchProceduresNotificationAPIView.as_view(), name='research_procedures_notification'), + path('hostel_notifications/', HostelModuleNotificationAPIView.as_view(), name='hostel_notifications'), ] diff --git a/FusionIIIT/applications/notifications_extension/api/views.py b/FusionIIIT/applications/notifications_extension/api/views.py index b87b488da..c5017f79f 100644 --- a/FusionIIIT/applications/notifications_extension/api/views.py +++ b/FusionIIIT/applications/notifications_extension/api/views.py @@ -29,7 +29,8 @@ AssistantshipClaim_account_notify, department_notif, office_module_DeanRSPC_notif, - research_procedures_notif) + research_procedures_notif, + hostel_notifications) @@ -327,7 +328,20 @@ def post(self, request, *args, **kwargs): research_procedures_notif(sender, recipient, type) return Response({'message': 'Notification sent successfully'}, status=status.HTTP_201_CREATED) - + +class HostelModuleNotificationAPIView(APIView): + def post(self, request, *args, **kwargs): + # Extract data from the request, you can customize this based on your needs + sender = request.user + recipient_id = request.data.get('recipient') + type = request.data.get('type') + User = get_user_model() + recipient = User.objects.get(pk=recipient_id) + # Trigger the notification function + hostel_notifications(sender, recipient, type) + + return Response({'message': 'Notification sent successfully'}, status=status.HTTP_201_CREATED) + class MarkAsRead(APIView): def put(self,request,**args): diff --git a/FusionIIIT/applications/office_module/migrations/0001_initial.py b/FusionIIIT/applications/office_module/migrations/0001_initial.py index 521c8e886..c488a504c 100644 --- a/FusionIIIT/applications/office_module/migrations/0001_initial.py +++ b/FusionIIIT/applications/office_module/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.db import migrations, models @@ -10,10 +10,10 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('academic_information', '0001_initial'), ('filetracking', '0001_initial'), - ('leave', '0001_initial'), ('globals', '0001_initial'), + ('academic_information', '0001_initial'), + ('leave', '0001_initial'), ] operations = [ diff --git a/FusionIIIT/applications/online_cms/migrations/0001_initial.py b/FusionIIIT/applications/online_cms/migrations/0001_initial.py index 4e3377ab7..2990b152b 100644 --- a/FusionIIIT/applications/online_cms/migrations/0001_initial.py +++ b/FusionIIIT/applications/online_cms/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.db import migrations, models import django.db.models.deletion @@ -9,8 +9,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('academic_information', '0001_initial'), ('globals', '0001_initial'), + ('academic_information', '0001_initial'), ] operations = [ diff --git a/FusionIIIT/applications/placement_cell/migrations/0001_initial.py b/FusionIIIT/applications/placement_cell/migrations/0001_initial.py index 257c98609..95f070aef 100644 --- a/FusionIIIT/applications/placement_cell/migrations/0001_initial.py +++ b/FusionIIIT/applications/placement_cell/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.db import migrations, models diff --git a/FusionIIIT/applications/programme_curriculum/migrations/0001_initial.py b/FusionIIIT/applications/programme_curriculum/migrations/0001_initial.py index b01ec58a7..bb794c796 100644 --- a/FusionIIIT/applications/programme_curriculum/migrations/0001_initial.py +++ b/FusionIIIT/applications/programme_curriculum/migrations/0001_initial.py @@ -1,5 +1,6 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 +import django.core.validators from django.db import migrations, models import django.db.models.deletion @@ -18,7 +19,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=100)), - ('version', models.PositiveIntegerField(default=1)), + ('version', models.DecimalField(decimal_places=1, default=1.0, max_digits=2, validators=[django.core.validators.MinValueValidator(1.0), django.core.validators.DecimalValidator(decimal_places=1, max_digits=2)])), ('working_curriculum', models.BooleanField(default=True)), ('no_of_semester', models.PositiveIntegerField(default=1)), ('min_credit', models.PositiveIntegerField(default=0)), @@ -30,7 +31,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('category', models.CharField(choices=[('UG', 'Undergraduate'), ('PG', 'Postgraduate'), ('PHD', 'Doctor of Philosophy')], max_length=3)), ('name', models.CharField(max_length=70, unique=True)), - ('programme_begin_year', models.PositiveIntegerField(default=2023)), + ('programme_begin_year', models.PositiveIntegerField(default=2024)), ], ), migrations.CreateModel( @@ -66,8 +67,9 @@ class Migration(migrations.Migration): name='Course', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('code', models.CharField(max_length=10, unique=True)), - ('name', models.CharField(max_length=100, unique=True)), + ('code', models.CharField(max_length=10)), + ('name', models.CharField(max_length=100)), + ('version', models.DecimalField(decimal_places=1, default=1.0, max_digits=5, validators=[django.core.validators.MinValueValidator(1.0), django.core.validators.DecimalValidator(decimal_places=1, max_digits=5)])), ('credit', models.PositiveIntegerField(default=0)), ('lecture_hours', models.PositiveIntegerField(null=True)), ('tutorial_hours', models.PositiveIntegerField(null=True)), @@ -85,11 +87,12 @@ class Migration(migrations.Migration): ('percent_course_attendance', models.PositiveIntegerField(default=5)), ('ref_books', models.TextField()), ('working_course', models.BooleanField(default=True)), + ('latest_version', models.BooleanField(default=True)), ('disciplines', models.ManyToManyField(blank=True, to='programme_curriculum.Discipline')), ('pre_requisit_courses', models.ManyToManyField(blank=True, related_name='_course_pre_requisit_courses_+', to='programme_curriculum.Course')), ], options={ - 'unique_together': {('code', 'name')}, + 'unique_together': {('code', 'version')}, }, ), migrations.CreateModel( @@ -97,7 +100,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(choices=[('B.Tech', 'B.Tech'), ('M.Tech', 'M.Tech'), ('B.Des', 'B.Des'), ('M.Des', 'M.Des'), ('Phd', 'Phd')], max_length=50)), - ('year', models.PositiveIntegerField(default=2023)), + ('year', models.PositiveIntegerField(default=2024)), ('running_batch', models.BooleanField(default=True)), ('curriculum', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='programme_curriculum.curriculum')), ('discipline', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='programme_curriculum.discipline')), @@ -106,6 +109,39 @@ class Migration(migrations.Migration): 'unique_together': {('name', 'discipline', 'year')}, }, ), + migrations.CreateModel( + name='UpdateCourseProposal', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('faculty_name', models.CharField(max_length=100)), + ('faculty_code', models.CharField(max_length=10)), + ('code', models.CharField(max_length=10)), + ('name', models.CharField(max_length=100)), + ('credit', models.PositiveIntegerField(default=0)), + ('lecture_hours', models.PositiveIntegerField(null=True)), + ('tutorial_hours', models.PositiveIntegerField(null=True)), + ('pratical_hours', models.PositiveIntegerField(null=True)), + ('discussion_hours', models.PositiveIntegerField(null=True)), + ('project_hours', models.PositiveIntegerField(null=True)), + ('pre_requisits', models.TextField(blank=True, null=True)), + ('syllabus', models.TextField()), + ('percent_quiz_1', models.PositiveIntegerField(default=10)), + ('percent_midsem', models.PositiveIntegerField(default=20)), + ('percent_quiz_2', models.PositiveIntegerField(default=10)), + ('percent_endsem', models.PositiveIntegerField(default=30)), + ('percent_project', models.PositiveIntegerField(default=15)), + ('percent_lab_evaluation', models.PositiveIntegerField(default=10)), + ('percent_course_attendance', models.PositiveIntegerField(default=5)), + ('ref_books', models.TextField()), + ('working_course', models.BooleanField(default=True)), + ('status', models.PositiveIntegerField(default=0)), + ('disciplines', models.ManyToManyField(blank=True, to='programme_curriculum.Discipline')), + ('pre_requisit_courses', models.ManyToManyField(blank=True, to='programme_curriculum.Course')), + ], + options={ + 'unique_together': {('code', 'faculty_code')}, + }, + ), migrations.AlterUniqueTogether( name='curriculum', unique_together={('name', 'version')}, @@ -115,7 +151,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=100)), - ('type', models.CharField(choices=[('Professional Core', 'Professional Core'), ('Professional Elective', 'Professional Elective'), ('Professional Lab', 'Professional Lab'), ('Engineering Science', 'Engineering Science'), ('Natural Science', 'Natural Science'), ('Humanities', 'Humanities'), ('Design', 'Design'), ('Manufacturing', 'Manufacturing'), ('Management Science', 'Management Science'), ('Optional Elective', 'Optional Elective'), ('Project', 'Project'), ('Optional', 'Optional'), ('Others', 'Others')], max_length=70)), + ('type', models.CharField(choices=[('Professional Core', 'Professional Core'), ('Professional Elective', 'Professional Elective'), ('Professional Lab', 'Professional Lab'), ('Engineering Science', 'Engineering Science'), ('Natural Science', 'Natural Science'), ('Humanities', 'Humanities'), ('Design', 'Design'), ('Manufacturing', 'Manufacturing'), ('Management Science', 'Management Science'), ('Open Elective', 'Open Elective'), ('Swayam', 'Swayam'), ('Project', 'Project'), ('Optional', 'Optional'), ('Others', 'Others')], max_length=70)), ('course_slot_info', models.TextField(null=True)), ('duration', models.PositiveIntegerField(default=1)), ('min_registration_limit', models.PositiveIntegerField(default=0)), @@ -127,6 +163,38 @@ class Migration(migrations.Migration): 'unique_together': {('semester', 'name', 'type')}, }, ), + migrations.CreateModel( + name='CourseProposal', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('faculty_name', models.CharField(max_length=100)), + ('faculty_code', models.CharField(max_length=10)), + ('code', models.CharField(max_length=10)), + ('name', models.CharField(max_length=100)), + ('credit', models.PositiveIntegerField(default=3)), + ('lecture_hours', models.PositiveIntegerField(default=3, null=True)), + ('tutorial_hours', models.PositiveIntegerField(default=0, null=True)), + ('pratical_hours', models.PositiveIntegerField(default=0, null=True)), + ('discussion_hours', models.PositiveIntegerField(default=0, null=True)), + ('project_hours', models.PositiveIntegerField(default=0, null=True)), + ('pre_requisits', models.TextField(blank=True, null=True)), + ('syllabus', models.TextField()), + ('percent_quiz_1', models.PositiveIntegerField(default=10)), + ('percent_midsem', models.PositiveIntegerField(default=20)), + ('percent_quiz_2', models.PositiveIntegerField(default=10)), + ('percent_endsem', models.PositiveIntegerField(default=30)), + ('percent_project', models.PositiveIntegerField(default=15)), + ('percent_lab_evaluation', models.PositiveIntegerField(default=10)), + ('percent_course_attendance', models.PositiveIntegerField(default=5)), + ('ref_books', models.TextField()), + ('status', models.PositiveIntegerField(default=0)), + ('disciplines', models.ManyToManyField(blank=True, to='programme_curriculum.Discipline')), + ('pre_requisit_courses', models.ManyToManyField(blank=True, to='programme_curriculum.Course')), + ], + options={ + 'unique_together': {('code', 'faculty_code')}, + }, + ), migrations.CreateModel( name='CourseInstructor', fields=[ diff --git a/FusionIIIT/applications/ps1/api/views.py b/FusionIIIT/applications/ps1/api/views.py index 37d6546e4..587c02e8a 100644 --- a/FusionIIIT/applications/ps1/api/views.py +++ b/FusionIIIT/applications/ps1/api/views.py @@ -53,7 +53,6 @@ def createProposal(request): designation = Designation.objects.get(id=HoldsDesignation.objects.select_related('user', 'working', 'designation').get(id=design).designation_id) upload_file = request.FILES.get('myfile') item_name = request.data.get('item_name') - grade = request.data.get('grade') quantity = request.data.get('quantity') present_stock = request.data.get('present_stock') estimated_cost = request.data.get('estimated_cost') @@ -89,7 +88,6 @@ def createProposal(request): estimated_cost=estimated_cost, purpose=purpose, specification=specification, - grade=grade, item_type=item_type, nature=nature, indigenous=indigenous, @@ -445,12 +443,11 @@ def currentStockView(request,id): else: return Response({"message": "Invalid designation"}, status=status.HTTP_403_FORBIDDEN) - grouped_items = stocks.values('StockEntryId__item_id__item_type', 'StockEntryId__item_id__grade', 'department').annotate(total_quantity=Count('id')) + grouped_items = stocks.values('StockEntryId__item_id__item_type', 'department').annotate(total_quantity=Count('id')) grouped_items_list = [ { 'item_type': item['StockEntryId__item_id__item_type'], - 'grade': item['StockEntryId__item_id__grade'], 'department': DepartmentInfo.objects.get(id=item['department']).name, 'total_quantity': item['total_quantity'] } @@ -462,25 +459,22 @@ def currentStockView(request,id): elif request.method == 'POST': # Handle POST request department = request.data.get('department') - grade = request.data.get('grade') item_type = request.data.get('item_type') - if not department or not grade or not item_type: + if not department or not item_type: return Response({"message": "Missing required parameters"}, status=status.HTTP_400_BAD_REQUEST) # Filter StockItem based on provided filters StockItems = StockItem.objects.filter( department=department, - StockEntryId__item_id__grade=grade, StockEntryId__item_id__item_type=item_type ) - grouped_items = StockItems.values('StockEntryId__item_id__item_type', 'StockEntryId__item_id__grade', 'department').annotate(total_quantity=Count('id')) + grouped_items = StockItems.values('StockEntryId__item_id__item_type', 'department').annotate(total_quantity=Count('id')) grouped_items_list = [ { 'item_type': item['StockEntryId__item_id__item_type'], - 'grade': item['StockEntryId__item_id__grade'], 'department': DepartmentInfo.objects.get(id=department).name, 'total_quantity': item['total_quantity'] } @@ -544,11 +538,9 @@ def stockTransfer(request,id): temp1=IndentFile.objects.get(file_info=temp) item_type_required =temp1.item_type - item_grade_required = temp1.grade available_items=StockItem.objects.filter( StockEntryId__item_id__item_type=item_type_required, - StockEntryId__item_id__grade=item_grade_required, inUse=False ) diff --git a/FusionIIIT/applications/ps1/migrations/0001_initial.py b/FusionIIIT/applications/ps1/migrations/0001_initial.py index ae2c581e0..4d5674c39 100644 --- a/FusionIIIT/applications/ps1/migrations/0001_initial.py +++ b/FusionIIIT/applications/ps1/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.db import migrations, models import django.db.models.deletion diff --git a/FusionIIIT/applications/ps1/models.py b/FusionIIIT/applications/ps1/models.py index d5aa60d93..ffbe50020 100644 --- a/FusionIIIT/applications/ps1/models.py +++ b/FusionIIIT/applications/ps1/models.py @@ -15,7 +15,6 @@ class IndentFile(models.Model): estimated_cost=models.IntegerField(null=True, blank=False) purpose=models.CharField(max_length=250,blank=False ) specification=models.CharField(max_length=250) - grade = models.CharField(max_length=1, choices=[('A', 'A'), ('B', 'B'), ('C', 'C')],default='A') item_type=models.CharField(max_length=250) nature=models.BooleanField(default = False) indigenous= models.BooleanField(default = False) @@ -34,14 +33,11 @@ class Meta: class Constants: Locations = ( - ('H1', 'Vashistha Hostel'), - ('H4', 'Vivekananda Hostel'), - ('H3', 'AryaBhatta Hostel'), - ('SR1', 'Storage Room 1'), - ('SR2', 'Storage Room 2'), - ('SR3', 'Storage Room 3'), - ('SR4', 'Storage Room 4'), - ('SR5', 'Storage Room 5'), + ('SR1', 'LHTC'), + ('SR2', 'Computer Center'), + ('SR3', 'Panini Hostel'), + ('SR4', 'Lab complex'), + ('SR5', 'Admin Block'), ) class StockEntry(models.Model): diff --git a/FusionIIIT/applications/ps1/urls.py b/FusionIIIT/applications/ps1/urls.py index 793d34ec5..148e0c753 100644 --- a/FusionIIIT/applications/ps1/urls.py +++ b/FusionIIIT/applications/ps1/urls.py @@ -12,21 +12,22 @@ url(r'^composed_indents/$', views.composed_indents, name='composed_indents'), # here id is the Holdsdesignation id. - url(r'^indentview/(?P\d+)$', views.indentview, name='indentview'), + url(r'^indentview/(?P\d+)/$', views.indentview, name='indentview'), + url(r'^archieveview/(?P\d+)/$', views.archieveview, name='archieveview'), url(r'^drafts/$', views.drafts, name='drafts'), - url(r'^draftview/(?P\d+)$', views.draftview, name='draftview'), + url(r'^draftview/(?P\d+)/$', views.draftview, name='draftview'), url(r'^inwardIndent/$', views.inward, name='inward'), # indentview2 is to get all the indentFiles inwarded towards the request.user. - url(r'^indentview2/(?P\d+)$', views.indentview2, name='indentview2'), - url(r'^confirmdelete/(?P\d+)$', views.confirmdelete, name='confirm_delete'), - url(r'^delete/(?P\d+)$',views.delete, name='delete'), + url(r'^indentview2/(?P\d+)/$', views.indentview2, name='indentview2'), + url(r'^confirmdelete/(?P\d+)/$', views.confirmdelete, name='confirm_delete'), + url(r'^delete/(?P\d+)/$',views.delete, name='delete'), # forward Indent is to see a specific forwarded indent to ourselves url(r'^forwardindent/(?P\d+)/$', views.forwardindent, name='forwardindent'), url(r'^createdindent/(?P\d+)/$', views.createdindent, name='createdindent'), - + url(r'^forwardedIndent/(?P\d+)/$', views.forwardedIndent, name='forwardedIndent'), url(r'^entry/$', views.entry, name='entry'), url(r'^StockEntry/$', views.Stock_Entry, name='Stock_Entry'), @@ -43,6 +44,7 @@ # to display stock items which are having similar item_type ,grade and department.(used in current_stock_view) url(r'^stock_item_view/$', views.stock_item_view, name='stock_item_view'), + url(r'^archieved_indents/$', views.archieved_files, name='archieved_indents_view'), @@ -62,7 +64,7 @@ url(r'^stock_transfer/$', views.stock_transfer, name='stock_transfer'), url(r'^view_transfer/$', views.view_transfer, name='view_transfer'), - url(r'^outboxview2/$', views.outboxview2, name='outboxview2'), + url(r'^outboxview2/(?P\d+)/$', views.outboxview2, name='outboxview2'), url(r'^outboxview/$', views.outboxview, name='outboxview'), diff --git a/FusionIIIT/applications/ps1/views.py b/FusionIIIT/applications/ps1/views.py index f3e603ec5..c07889c43 100644 --- a/FusionIIIT/applications/ps1/views.py +++ b/FusionIIIT/applications/ps1/views.py @@ -14,6 +14,8 @@ from django.utils import timezone from datetime import datetime from applications.globals.models import DepartmentInfo +from applications.filetracking.sdk.methods import * +from datetime import datetime import re import json @@ -34,6 +36,8 @@ @login_required(login_url = "/accounts/login/") def ps1(request): + notifs = request.user.notifications.all() + des_obj = HoldsDesignation.objects.filter(user=request.user) if des_obj: @@ -88,16 +92,24 @@ def create_proposal(request): financial_approval=False purchased =request.POST.get('purchased') """ + if request.session['currentDesignationSelected'] in dept_admin_design + ["ps_admin"]: + return redirect('/purchase-and-store/inwardIndent') print("request.user.id : ", request.user.id) - + notifs = request.user.notifications.all() if request.method =="POST": try: if 'save' in request.POST: uploader = request.user.extrainfo subject = request.POST.get('title') description = request.POST.get('desc') - design = request.POST.get('design') - designation = Designation.objects.get(id = HoldsDesignation.objects.select_related('user','working','designation').get(id = design).designation_id) + # design = request.POST.get('design') + design = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + + #print('design : ',design,'design2' , design2); + + + designation = Designation.objects.get(id = HoldsDesignation.objects.select_related('user','working','designation').get(id = design.id).designation_id) + upload_file = request.FILES.get('myfile') item_name=request.POST.get('item_name') quantity= request.POST.get('quantity') @@ -117,16 +129,20 @@ def create_proposal(request): financial_approval=False purchased =False - file=File.objects.create( + ##get the uploader username + uploader = request.user.username + print("uploader : ",uploader) + file_id=create_draft( uploader=uploader, - description=description, - subject=subject, - designation=designation, - upload_file=upload_file + uploader_designation=designation, + src_module="ps1", + src_object_id="", + file_extra_JSON={"value": 2}, + attached_file=upload_file ) IndentFile.objects.create( - file_info=file, + file_info=get_object_or_404(File, pk=file_id), item_name= item_name, quantity=quantity, present_stock=present_stock, @@ -149,13 +165,24 @@ def create_proposal(request): if 'send' in request.POST: - print('request.POST : ',request.POST); + # print('request.POST : ',request.POST); + uploader = request.user.extrainfo subject = request.POST.get('title') description = request.POST.get('desc') - design = request.POST.get('design') - designation = Designation.objects.get(id = HoldsDesignation.objects.select_related('user','working','designation').get(id = design).designation_id) + # design = request.POST.get('design') + + design = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + + designation = Designation.objects.get(id = HoldsDesignation.objects.select_related('user','working','designation').get(id = design.id).designation_id) + + # print(designation) + # print(design) + # print('design : ',design.id); + + + upload_file = request.FILES.get('myfile') item_name=request.POST.get('item_name') quantity= request.POST.get('quantity') @@ -164,7 +191,6 @@ def create_proposal(request): purpose=request.POST.get('purpose') specification=request.POST.get('specification') item_type=request.POST.get('item_type') - grade=request.POST.get('grade') nature=request.POST.get('nature') indigenous=request.POST.get('indigenous') replaced =request.POST.get('replaced') @@ -177,22 +203,16 @@ def create_proposal(request): purchased = False designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user = request.user) - for des in designations: - if request.session['currentDesignationSelected'] == "Director": - head_approval=True - director_approval=True - financial_approval=True - break - + if request.session['currentDesignationSelected'] == "Director": + head_approval=True + director_approval=True + financial_approval=True # current_id = request.user.extrainfo # remarks = request.POST.get('remarks') - sender = request.POST.get('design') - current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=sender) - receiver = request.POST.get('receiver') try: @@ -230,7 +250,6 @@ def create_proposal(request): specification=specification, item_type=item_type, nature=nature, - grade=grade, indigenous=indigenous, replaced = replaced , budgetary_head=budgetary_head, @@ -255,8 +274,9 @@ def create_proposal(request): today = timezone.now().strftime('%Y-%m-%d') currDesig = request.session['currentDesignationSelected'] - dept_admin_design = ['dept_admin1', 'dept_admin2', 'dept_admin3'] # Replace with actual department admin designations - isAdmin = currDesig == 'ps_admin' or currDesig in dept_admin_design + dept_admin_designs = dept_admin_design + isAdmin = currDesig == 'ps_admin' or currDesig in dept_admin_designs + notifs = request.user.notifications.all() context = { 'file': file, @@ -265,30 +285,46 @@ def create_proposal(request): 'designations': designations, 'today': today, 'isAdmin': isAdmin, + 'notifications':notifs } return render(request, 'ps1/composeIndent.html', context) -# @login_required(login_url = "/accounts/login") -# def compose_indent(request): -# file = File.objects.select_related('uploader__user','uploader__department','designation').all() -# extrainfo = ExtraInfo.objects.select_related('user','department').all() -# holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() -# designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user = request.user) -# context = { -# 'file': file, -# 'extrainfo': extrainfo, -# 'holdsdesignations': holdsdesignations, -# 'designations': designations, -# } -# return render(request, 'ps1/composeIndent.html', context) + +@login_required(login_url = "/accounts/login") +def composed_indents(request): + """ + The function is used to get all the files created by user(employee). + It gets all files created by user by filtering file(table) object by user i.e, uploader. + It displays user and file details of a file(table) of filetracking(model) in the + template of 'Saved files' tab. + + @param: + request - trivial. + + @variables: + draft - The File object filtered by uploader(user). + extrainfo - The Extrainfo object. + context - Holds data needed to make necessary changes in the template. + """ + + # draft = File.objects.filter(uploader=request.user.extrainfo) + # draft = File.objects.filter(uploader=request.user.extrainfo).order_by('-upload_date') + + # print(File.objects) + # extrainfo = ExtraInfo.objects.all() + # designation = Designation.objects.get(id=HoldsDesignation.objects.get(user=request.user).designation_id) + if request.session['currentDesignationSelected'] == "student": + return redirect('/dashboard') + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + print(designation) - + return redirect(f'/purchase-and-store/indentview/{designation.id}') @login_required(login_url = "/accounts/login") -def composed_indents(request): +def archieved_files(request): """ The function is used to get all the files created by user(employee). It gets all files created by user by filtering file(table) object by user i.e, uploader. @@ -310,16 +346,13 @@ def composed_indents(request): # print(File.objects) # extrainfo = ExtraInfo.objects.all() # designation = Designation.objects.get(id=HoldsDesignation.objects.get(user=request.user).designation_id) - des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() if request.session['currentDesignationSelected'] == "student": return redirect('/dashboard') - designation = HoldsDesignation.objects.filter(user=request.user) - context = { - # 'draft': draft, - # 'extrainfo': extrainfo, - 'designation': designation, - } - return render(request, 'ps1/composed_indents.html', context) + + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + + + return redirect(f'/purchase-and-store/archieveview/{designation.id}') @@ -366,21 +399,24 @@ def drafts(request): # print(File.objects) # extrainfo = ExtraInfo.objects.all() # designation = Designation.objects.get(id=HoldsDesignation.objects.get(user=request.user).designation_id) - des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() if request.session['currentDesignationSelected'] == "student": return redirect('/dashboard') - designation = HoldsDesignation.objects.filter(user=request.user) - context = { - # 'draft': draft, - # 'extrainfo': extrainfo, - 'designation': designation, - } - return render(request, 'ps1/drafts.html', context) + + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + + + return redirect(f'/purchase-and-store/draftview/{designation.id}') @login_required(login_url = "/accounts/login") def indentview(request,id): - print("id : ",id); - + print("id : ",id) + if request.session['currentDesignationSelected'] == "student": + return redirect('/dashboard') + + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + + if str(id) != str(designation.id): + return redirect(f'/purchase-and-store/indentview/{designation.id}') tracking_objects=Tracking.objects.all() tracking_obj_ids=[obj.file_id for obj in tracking_objects] draft_indent = IndentFile.objects.filter(file_info__in=tracking_obj_ids) @@ -391,14 +427,52 @@ def indentview(request,id): abcd = HoldsDesignation.objects.get(pk=id) s = str(abcd).split(" - ") designations = s[1] + notifs = request.user.notifications.all() context = { 'indents' : indents, 'extrainfo': extrainfo, 'designations': designations, + 'notifications':notifs } return render(request, 'ps1/indentview.html', context) +@login_required(login_url = "/accounts/login") +def archieveview(request,id): + if request.session['currentDesignationSelected'] == "student": + return redirect('/dashboard') + + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + + if str(id) != str(designation.id): + return redirect(f'/purchase-and-store/archieveview/{designation.id}') + print("id : ",id); + print("request.user : ",request.user); + + abcd = HoldsDesignation.objects.get(pk=id) + s = str(abcd).split(" - ") + designations = s[1] + print("designations : ",designations); + + archived_files = view_archived( + username=request.user, + designation=designations, + src_module="ps1" + ) + + print("archived_files : ",archived_files); + for files in archived_files: + files['upload_date']=datetime.fromisoformat(files['upload_date']) + files['upload_date']=files['upload_date'].strftime("%B %d, %Y, %I:%M %p") + + notifs = request.user.notifications.all() + context = { + 'archieves' : archived_files, + 'designations': designations, + 'notifications':notifs + } + return render(request, 'ps1/archieve_view.html', context) + # @login_required(login_url = "/accounts/login") # def draftview_multiple_items_indent(request,id): @@ -445,10 +519,13 @@ def indentview(request,id): @login_required(login_url = "/accounts/login") def draftview(request,id): - - des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() if request.session['currentDesignationSelected'] == "student": return redirect('/dashboard') + + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + + if str(id) != str(designation.id): + return redirect(f'/purchase-and-store/draftview/{designation.id}') indents= IndentFile.objects.filter(file_info__in=request.user.extrainfo.uploaded_files.all()).select_related('file_info') indent_ids=[indent.file_info for indent in indents] @@ -461,16 +538,25 @@ def draftview(request,id): abcd = HoldsDesignation.objects.get(pk=id) s = str(abcd).split(" - ") designations = s[1] + notifs = request.user.notifications.all() context = { 'draft': draft_files, 'extrainfo': extrainfo, 'designations': designations, + 'notifications':notifs } return render(request, 'ps1/draftview.html', context) @login_required(login_url = "/accounts/login") def indentview2(request,id): + if request.session['currentDesignationSelected'] == "student": + return redirect('/dashboard') + + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + + if str(id) != str(designation.id): + return redirect(f'/purchase-and-store/indentview2/{designation.id}') abcd = HoldsDesignation.objects.get(pk=id) s = str(abcd).split(" - ") designations = s[1] @@ -482,10 +568,13 @@ def indentview2(request,id): for item in data: item['upload_date'] = datetime.fromisoformat(item['upload_date']) + + notifs = request.user.notifications.all() context = { 'receive_design':abcd, 'in_file': data, + 'notifications':notifs } return render(request, 'ps1/indentview2.html', context) @@ -511,16 +600,13 @@ def inward(request): in_file - The Tracking object filtered by receiver_id i.e, present working user. context - Holds data needed to make necessary changes in the template. """ - des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() - if str(des.designation) == "student": + if request.session['currentDesignationSelected'] == "student": return redirect('/dashboard') - designation = HoldsDesignation.objects.filter(user=request.user) - context = { - 'designation': designation, - } + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + - return render(request, 'ps1/inwardIndent.html', context) + return redirect(f'/purchase-and-store/indentview2/{designation.id}') @@ -573,8 +659,23 @@ def forwardindent(request, id): file=indent.file_info # start = timer() track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department', -'current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file) +'current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('forward_date') # end = timer() + + lastTrackInstance = track.last(); + + # print(lastTrackInstance.receiver_id ," : " ,lastTrackInstance.receive_design) + # print(request.user); + # print(request.user == lastTrackInstance.receiver_id) + + fileHistory=view_history(file.id) + lastElement = fileHistory[-1] + current_id=lastElement['current_id'] + isArchivable = False + print(request.user.username,"request.user.username") + print(current_id,"current_id") + if current_id == request.user.username: + isArchivable = True if request.method == "POST": # print('Mohit Will Win : ' , request.POST); @@ -583,10 +684,24 @@ def forwardindent(request, id): file.complete_flag = True file.save() + if 'Archieve' in request.POST: + print("inside archieve") + is_archived = archive_file(file_id=file.id) + print("is_archived : ",is_archived) + + if is_archived: + messages.success(request, 'Indent File Archived successfully') + return redirect('/purchase-and-store/forwardedIndent/{0}'.format(file.id)) + else: + messages.error(request, 'Indent File could not be archived') + if 'send' in request.POST: current_id = request.user.extrainfo remarks = request.POST.get('remarks') - sender_design_id = request.POST.get('sender') + + sender_design_id = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first().id + + sender_designationobj = HoldsDesignation.objects.get(id=sender_design_id).designation sender_designation_name = sender_designationobj.name @@ -595,6 +710,10 @@ def forwardindent(request, id): receiver = receiverHdobj.user.username receive_design = receiverHdobj.designation.name + # print("sender_design_id : ", sender_design_id ); + + + try: receiver_id = User.objects.get(username=receiver) except Exception as e: @@ -617,6 +736,7 @@ def forwardindent(request, id): 'designations': designations, 'file': file, 'track': track, + 'lastTrackingInstance':lastTrackInstance } return render(request, 'ps1/forwardindent.html', context) @@ -631,19 +751,14 @@ def forwardindent(request, id): file_attachment=upload_file ) - - - if (str(receive_design) in dept_admin_design): - indent.head_approval=True - elif (( - (sender_designation_name in dept_admin_design) - or - (sender_designation_name == "ps_admin") - ) - and (str(receive_design) == "Accounts Admin")): - indent.director_approval=True - indent.financial_approval=True - indent.head_approval=True + # CREATOR -> HOD -> DIRECTOR/REGISTRAR -> DEPT_ADMIN -> + if((sender_designation_name in ["HOD (CSE)", "HOD (ECE)", "HOD (ME)", "HOD (SM)", "HOD (Design)", "HOD (Liberal Arts)", "HOD (Natural Science)"]) and (str(receive_design) in ["Director","Registrar"])): + indent.head_approval=True + elif ((sender_designation_name in ["Director","Registrar"]) and (str(receive_design) in dept_admin_design)): + indent.director_approval=True + elif ((sender_designation_name == "Accounts Admin") and ((str(receive_design) in dept_admin_design) or str(receive_design) == "ps_admin")): + indent.financial_approval=True + designs =[] designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) @@ -668,7 +783,9 @@ def forwardindent(request, id): 'designations':designations, 'file': file, 'track': track, - 'indent':indent + 'indent':indent, + 'isArchivable':isArchivable, + 'lastTrackingInstance':lastTrackInstance } return render(request, 'ps1/forwardindent.html', context) @@ -720,6 +837,9 @@ def createdindent(request, id): current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=sender) receiver = request.POST.get('receiver') + print("receiver: ", receiver) + print("receiverid : ", User.objects.get(username=receiver)) + try: receiver_id = User.objects.get(username=receiver) except Exception as e: @@ -751,15 +871,24 @@ def createdindent(request, id): return render(request, 'ps1/createdindent.html', context) upload_file = request.FILES.get('myfile') # return HttpResponse ("success") - Tracking.objects.create( - file_id=file, - current_id=current_id, - current_design=current_design, - receive_design=receive_design, - receiver_id=receiver_id, + receiver_obj = User.objects.get(username=receiver) + forwarded_file_id = forward_file( + file_id=file.id, + receiver=receiver, + receiver_designation=receive_design, + file_extra_JSON={"key": 2}, remarks=remarks, - upload_file=upload_file, + file_attachment=upload_file ) + # Tracking.objects.create( + # file_id=file, + # current_id=current_id, + # current_design=current_design, + # receive_design=receive_design, + # receiver_id=receiver_id, + # remarks=remarks, + # upload_file=upload_file, + # ) messages.success(request, 'Indent File sent successfully') @@ -774,7 +903,52 @@ def createdindent(request, id): return render(request, 'ps1/createdindent.html', context) +@login_required(login_url = "/accounts/login") +def forwardedIndent(request, id): + """ + The function is used to forward created indent files by user(employee) . + @param: + request - trivial. + id - id of the file object which the user intends to forward to other employee. + @variables: + file - The File object. + track - The Tracking object. + remarks = Remarks posted by user. + receiver = Receiver to be selected by user for forwarding file. + receiver_id = Receiver_id who has been selected for forwarding file. + upload_file = File attached by user. + extrainfo = ExtraInfo object. + holdsdesignations = HoldsDesignation objects. + context - Holds data needed to make necessary changes in the template. + """ + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if request.session['currentDesignationSelected'] == "student": + return redirect('/dashboard') + # start = timer() + + # end = timer() + indent=IndentFile.objects.select_related('file_info').get(file_info=id) + file=indent.file_info + # start = timer() + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department', +'current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file) + # end = timer() + + + + + + + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + + context = { + 'designations':designations, + 'file': file, + 'track': track, + 'indent':indent, + } + return render(request, 'ps1/forwardedIndent.html', context) def AjaxDropdown1(request): des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() @@ -922,22 +1096,19 @@ def current_stock_view(request): if request.method=="POST": print('the requested data : ', request.POST) department = request.POST.get('department') - grade = request.POST.get('grade') type = request.POST.get('type') # StockEntryId__item_id__file_info_grade StockItems = StockItem.objects.filter( department=department, - StockEntryId__item_id__grade=grade, StockEntryId__item_id__item_type=type ) - grouped_items = StockItems.values('StockEntryId__item_id__item_type', 'StockEntryId__item_id__grade','department').annotate(total_quantity=Count('id')) + grouped_items = StockItems.values('StockEntryId__item_id__item_type', 'department').annotate(total_quantity=Count('id')) grouped_items_list = [ { 'item_type': item['StockEntryId__item_id__item_type'], - 'grade': item['StockEntryId__item_id__grade'], 'department': DepartmentInfo.objects.get(id=department), 'total_quantity': item['total_quantity'] } @@ -946,6 +1117,8 @@ def current_stock_view(request): firstStock=StockItems.first() + + return render(request,'ps1/current_stock_view.html',{'stocks':grouped_items_list,'first_stock':firstStock, 'stockItems':StockItems}) @@ -954,33 +1127,32 @@ def current_stock_view(request): # THIS IS HARDCODED FOR NOW . itemsTypes=['Equipment','Machinery','Furniture','Fixture'] - grades=['A','B','C'] departmentUser=request.user.extrainfo.department if request.session['currentDesignationSelected'] in dept_admin_design: # if department admin then only show the stocks of that department to them print(dept_admin_to_dept[request.session['currentDesignationSelected']]); - deptId = DepartmentInfo.objects.get(name=dept_admin_to_dept[request.session['currentDesignationSelected']]) + deptId = DepartmentInfo.objects.values('id', 'name').get(name=dept_admin_to_dept[request.session['currentDesignationSelected']]) departments=[deptId] StockItems = StockItem.objects.filter(department=deptId) elif request.session['currentDesignationSelected'] == "ps_admin": - departments=DepartmentInfo.objects.all() + departments=DepartmentInfo.objects.values('id','name').all() + StockItems = StockItem.objects.all() else : return redirect('/dashboard') - grouped_items = StockItems.values('StockEntryId__item_id__item_type', 'StockEntryId__item_id__grade','department').annotate(total_quantity=Count('id')) + grouped_items = StockItems.values('StockEntryId__item_id__item_type','department').annotate(total_quantity=Count('id')) grouped_items_list = [ { 'item_type': item['StockEntryId__item_id__item_type'], - 'grade': item['StockEntryId__item_id__grade'], - 'department': DepartmentInfo.objects.get(id=item['department']), + 'department': DepartmentInfo.objects.values('id','name').get(id=item['department']), 'departmentId': item['department'], 'total_quantity': item['total_quantity'] } @@ -988,9 +1160,9 @@ def current_stock_view(request): ] - return render(request,'ps1/current_stock_view_filter.html',{'itemsTypes':itemsTypes,'grades':grades,'departments':departments,'stocks':grouped_items_list}) + return render(request,'ps1/current_stock_view_filter.html',{'itemsTypes':itemsTypes,'departments':departments,'stocks':grouped_items_list}) -# to display stock items which are having similar item_type ,grade and department.(used in current_stock_view) +# to display stock items which are having similar item_type and department.(used in current_stock_view) @login_required(login_url = "/accounts/login") def stock_item_view(request): @@ -1000,13 +1172,11 @@ def stock_item_view(request): if request.method=="POST": departmentId = request.POST.get('departmentId') - grade = request.POST.get('grade') type = request.POST.get('item_type') # StockEntryId__item_id__file_info_grade StockItems = StockItem.objects.filter( department=departmentId, - StockEntryId__item_id__grade=grade, StockEntryId__item_id__item_type=type ) @@ -1020,7 +1190,6 @@ def stock_entry_view(request): if request.session['currentDesignationSelected'] not in dept_admin_design + ["ps_admin"]: return redirect('/dashboard') - department = request.user.extrainfo.department if request.session['currentDesignationSelected'] in dept_admin_design: # if department admin then only show the stocks of that department to them @@ -1305,11 +1474,9 @@ def stock_transfer(request): temp1=IndentFile.objects.get(file_info=temp) item_type_required =temp1.item_type - item_grade_required = temp1.grade available_items = StockItem.objects.filter( StockEntryId__item_id__item_type=item_type_required, # Foreign key traversal to IndentFile model - StockEntryId__item_id__grade=item_grade_required, # Foreign key traversal to IndentFile model inUse=False # Filter for inUse=False ) @@ -1339,7 +1506,6 @@ def view_transfer(request): return render(request,'ps1/view_transfer.html',{'stockTransfers': stockTransfers}) - @login_required(login_url = "/accounts/login") def outboxview2(request,id): abcd = HoldsDesignation.objects.get(pk=id) @@ -1360,12 +1526,13 @@ def outboxview2(request,id): @login_required(login_url = "/accounts/login") def outboxview(request): - designation = HoldsDesignation.objects.filter(user=request.user) - context = { - 'designation': designation, - } + if request.session['currentDesignationSelected'] == "student": + return redirect('/dashboard') + + designation = HoldsDesignation.objects.filter(user=request.user, designation__name=request.session['currentDesignationSelected']).first() + - return render(request, 'ps1/outboxview.html', context) + return redirect(f'/purchase-and-store/outboxview2/{designation.id}') @login_required(login_url="/accounts/login") diff --git a/FusionIIIT/applications/recruitment/migrations/0001_initial.py b/FusionIIIT/applications/recruitment/migrations/0001_initial.py index 9cf2d3a77..386d6d6fb 100644 --- a/FusionIIIT/applications/recruitment/migrations/0001_initial.py +++ b/FusionIIIT/applications/recruitment/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.conf import settings diff --git a/FusionIIIT/applications/research_procedures/migrations/0001_initial.py b/FusionIIIT/applications/research_procedures/migrations/0001_initial.py index ec4b77a48..2befdff1a 100644 --- a/FusionIIIT/applications/research_procedures/migrations/0001_initial.py +++ b/FusionIIIT/applications/research_procedures/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.conf import settings diff --git a/FusionIIIT/applications/scholarships/migrations/0001_initial.py b/FusionIIIT/applications/scholarships/migrations/0001_initial.py index 176422fd9..13627011e 100644 --- a/FusionIIIT/applications/scholarships/migrations/0001_initial.py +++ b/FusionIIIT/applications/scholarships/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 import datetime from django.db import migrations, models @@ -10,8 +10,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('academic_information', '0001_initial'), ('globals', '0001_initial'), + ('academic_information', '0001_initial'), ] operations = [ @@ -85,7 +85,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('programme', models.CharField(default='B.Tech', max_length=10)), - ('year', models.IntegerField(default=2023)), + ('year', models.IntegerField(default=2024)), ('award_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='scholarships.award_and_scholarship')), ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), ], diff --git a/FusionIIIT/applications/visitor_hostel/migrations/0001_initial.py b/FusionIIIT/applications/visitor_hostel/migrations/0001_initial.py index f4229feb2..96df7d704 100644 --- a/FusionIIIT/applications/visitor_hostel/migrations/0001_initial.py +++ b/FusionIIIT/applications/visitor_hostel/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2024-04-15 23:58 from django.conf import settings from django.db import migrations, models @@ -89,14 +89,13 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('meal_date', models.DateField()), - ('morning_tea', models.BooleanField(default=False)), - ('eve_tea', models.BooleanField(default=False)), - ('breakfast', models.BooleanField(default=False)), - ('lunch', models.BooleanField(default=False)), - ('dinner', models.BooleanField(default=False)), + ('morning_tea', models.IntegerField(default=0)), + ('eve_tea', models.IntegerField(default=0)), + ('breakfast', models.IntegerField(default=0)), + ('lunch', models.IntegerField(default=0)), + ('dinner', models.IntegerField(default=0)), ('persons', models.IntegerField(default=0)), ('booking', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='visitor_hostel.bookingdetail')), - ('room', models.ForeignKey(default=0, on_delete=django.db.models.deletion.CASCADE, to='visitor_hostel.roomdetail')), ('visitor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='visitor_hostel.visitordetail')), ], ), @@ -126,6 +125,7 @@ class Migration(migrations.Migration): ('meal_bill', models.IntegerField(default=0)), ('room_bill', models.IntegerField(default=0)), ('payment_status', models.BooleanField(default=False)), + ('bill_date', models.DateField(blank=True, default=django.utils.timezone.now)), ('booking', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='visitor_hostel.bookingdetail')), ('caretaker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ('room', models.ManyToManyField(to='visitor_hostel.RoomDetail')), diff --git a/FusionIIIT/media/feeds/profile_pictures/Snapchat-1401287705.jpg b/FusionIIIT/media/feeds/profile_pictures/Snapchat-1401287705.jpg deleted file mode 100644 index 4dc7ab350..000000000 Binary files a/FusionIIIT/media/feeds/profile_pictures/Snapchat-1401287705.jpg and /dev/null differ diff --git a/FusionIIIT/media/feeds/profile_pictures/rahul.jpg b/FusionIIIT/media/feeds/profile_pictures/rahul.jpg deleted file mode 100644 index e9a3f8fd0..000000000 Binary files a/FusionIIIT/media/feeds/profile_pictures/rahul.jpg and /dev/null differ diff --git a/FusionIIIT/media/feeds/profile_pictures/sid.jpg b/FusionIIIT/media/feeds/profile_pictures/sid.jpg deleted file mode 100644 index d18c7e75e..000000000 Binary files a/FusionIIIT/media/feeds/profile_pictures/sid.jpg and /dev/null differ diff --git a/FusionIIIT/media/sample_a2In3HQ.jpg b/FusionIIIT/media/sample_a2In3HQ.jpg deleted file mode 100644 index 0a18df12f..000000000 Binary files a/FusionIIIT/media/sample_a2In3HQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/sample_maFMAz9.jpg b/FusionIIIT/media/sample_maFMAz9.jpg deleted file mode 100644 index 0a18df12f..000000000 Binary files a/FusionIIIT/media/sample_maFMAz9.jpg and /dev/null differ diff --git a/FusionIIIT/notification/views.py b/FusionIIIT/notification/views.py index 5f5bfdf57..114bac1ce 100644 --- a/FusionIIIT/notification/views.py +++ b/FusionIIIT/notification/views.py @@ -123,16 +123,23 @@ def healthcare_center_notif(sender, recipient, type): sender = sender recipient = recipient verb = '' + if type == 'appoint': verb = "Your Appointment has been booked" - if type == 'amb_request': + elif type == 'amb_request': verb = "Your Ambulance request has been placed" - if type == 'Presc': + elif type == 'Presc': verb = "You have been prescribed some medicine" - if type == 'appoint_req': + elif type == 'appoint_req': verb = "You have a new appointment request" - if type == 'amb_req': + elif type == 'amb_req': verb = "You have a new ambulance request" + elif type == 'rel_forward': + verb = "You have a new medical relief forward request" + elif type == 'rel_approve': + verb = "You have a new medical relief approval request" + elif type == 'rel_approved': + verb = 'Your medical relief request has been approved' notify.send(sender=sender, recipient=recipient, url=url, module=module, verb=verb) @@ -409,3 +416,26 @@ def research_procedures_notif(sender,recipient,type): notify.send(sender=sender,recipient=recipient,url=url,module=module,verb=verb) +def hostel_notifications(sender, recipient, type): + url = 'hostelmanagement:hostel_view' + module = 'Hostel Management' + + sender = sender + recipient = recipient + verb = "" + if type == "leave_accept": + verb = "Your leave request has been Accepted." + elif type == "leave_reject": + verb = "Your leave request has been Rejected." + elif type == "guestRoom_accept": + verb = "Your Guest Room request has been Accepted." + elif type == "guestRoom_reject": + verb = "Your Guest Room request has been Rejected." + elif type == "leave_request": + verb = "You have a new Leave Request." + elif type == "guestRoom_request": + verb = "You have a new Guest Room Request." + elif type == "fine_imposed": + verb = "A fine has been imposed on you." + + notify.send(sender=sender,recipient=recipient,url=url,module=module,verb=verb) \ No newline at end of file diff --git a/FusionIIIT/templates/dashboard/alerts.html b/FusionIIIT/templates/dashboard/alerts.html index 42edc5df7..34090dd45 100755 --- a/FusionIIIT/templates/dashboard/alerts.html +++ b/FusionIIIT/templates/dashboard/alerts.html @@ -54,10 +54,10 @@ var status = document.getElementById("notif-sp"+id).innerHTML; var url; if(status=="Mark as Unread"){ - url = '{% url 'notifications:mark_as_unread' 0 %}'.replace('0', slug); + url = `{% url 'notifications:mark_as_unread' 0 %}`.replace('0', slug); } else{ - url = '{% url 'notifications:mark_as_read' 0 %}'.replace('0', slug); + url = `{% url 'notifications:mark_as_read' 0 %}`.replace('0', slug); } $.ajax( { diff --git a/FusionIIIT/templates/dashboard/alerts1.html b/FusionIIIT/templates/dashboard/alerts1.html index 442570f29..ae78bdebd 100644 --- a/FusionIIIT/templates/dashboard/alerts1.html +++ b/FusionIIIT/templates/dashboard/alerts1.html @@ -57,10 +57,10 @@ var status = document.getElementById("notif-sp"+id).innerHTML; var url; if(status=="Mark as Unread"){ - url = '{% url 'notifications:mark_as_unread' 0 %}'.replace('0', slug); + url = `{% url 'notifications:mark_as_unread' 0 %}`.replace('0', slug); } else{ - url = '{% url 'notifications:mark_as_read' 0 %}'.replace('0', slug); + url = `{% url 'notifications:mark_as_read' 0 %}`.replace('0', slug); } $.ajax( { diff --git a/FusionIIIT/templates/dashboard/dashboard.html b/FusionIIIT/templates/dashboard/dashboard.html index db390a426..b65710e69 100644 --- a/FusionIIIT/templates/dashboard/dashboard.html +++ b/FusionIIIT/templates/dashboard/dashboard.html @@ -1,162 +1,204 @@ -{% extends 'globals/base.html' %} {% load static %} {% block title %} Dashboard -{% endblock %} {% block css %} - - - -{% endblock %} {% block body %} {% block navBar %} {% include -'dashboard/navbar.html' %} {% endblock %} {% comment %}The grid starts here!{% -endcomment %} +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Dashboard +{% endblock %} + +{% block css %} + + + +{% 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 %} {% block - usercard %} {% include 'globals/usercard.html' %} {% endblock %} {% comment - %}The user image card ends here!{% endcomment %} - -
- - {% comment %}The Tab-Menu starts here!{% endcomment %} - - {% comment %}The Tab-Menu ends here!{% endcomment %} {% if 'student' != - request.user.extrainfo.user_type %} {% comment %}The Tab-Menu starts here!{% - endcomment %} - - {% comment %}The Tab-Menu ends here!{% endcomment %} {% endif %} {% comment - %}The Tab-Menu starts here!{% endcomment %} {% if - request.user.extrainfo.user_type == 'faculty' %} {%for desig in designat%} - {% if 'hradmin' == desig.designation.name %} - - - {% endif %} {%endfor %} {% endif %} {% comment %}The Tab-Menu 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 'dashboard/alerts.html' %} {% endblock - %} + + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu starts here!{% endcomment %} + -
-
-
- Work in Progress, coming soon! + {% comment %}The Tab-Menu ends here!{% endcomment %} + + + {% if 'student' != request.user.extrainfo.user_type %} + + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + + {% endif %} + + {% comment %}The Tab-Menu starts here!{% endcomment %} + + + {% if request.user.extrainfo.user_type == 'faculty' %} + {%for desig in designat%} + {% if 'hradmin' == desig.designation.name %} + + + {% endif %} + {%endfor %} + {% endif %} + {% comment %}The Tab-Menu ends here!{% endcomment %} + + + + + + + +
-
-
-
- {% block alerts1 %} {% include 'dashboard/alerts1.html' %} {% endblock - %} + {% 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 'dashboard/alerts.html' %} + {% endblock %} +
+
+
-
+
+ Work in Progress, coming soon! +
+
+
+ +
+ {% block alerts1 %} + {% include 'dashboard/alerts1.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 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 right-margin segment!{% endcomment %} -
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+
-{% comment %}The grid ends here!{% endcomment %} {% endblock %} {% block -javascript %} - +{% comment %}The grid ends here!{% endcomment %} + + + +{% endblock %} + +{% block javascript %} + - + + }); + /*$(document).ready(function(){ + $("#textLoader").toggle(); + $("#replacement-card").toggle(); + setTimeout(loader, 1750); + }); + function loader() { + $("#textLoader").toggle(); + $("#replacement-card").toggle(); + $("#loader").removeClass("active"); + $("#loader").addClass("disabled"); + }*/ + - - + + - + - + }); + - + - + - + @@ -937,4 +926,4 @@

Scheduled Meetings

-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/FusionIIIT/templates/dashboard/modules.html b/FusionIIIT/templates/dashboard/modules.html index 7f7822476..1a0a493f7 100644 --- a/FusionIIIT/templates/dashboard/modules.html +++ b/FusionIIIT/templates/dashboard/modules.html @@ -19,7 +19,7 @@ {% comment %}A single modules row starts here!{% endcomment %} - {% if request.user.extrainfo.user_type != "staff" or "acadadmin" == global_var or "corelabcaretaker" == global_var %} + {% if request.user.extrainfo.user_type != "staff" or "Acadadmin" == global_var %}
@@ -36,8 +36,7 @@
{% endif %} - {% if request.user.extrainfo.user_type == "student" or "acadadmin" == global_var %} - + {% if request.user.extrainfo.user_type == "student" or "Professor" == global_var or "Dean Academics" == global_var or "Acadadmin" == global_var or "Assistant Professor" == global_var or "Hod" == global_var %}
@@ -60,7 +59,7 @@ {% comment %}A single modules row starts here!{% endcomment %} - {% if request.user.extrainfo.user_type == "student" or "mess_manager" == global_var or "mess_warden" == global_var %} + {% if request.user.extrainfo.user_type == "student" or "mess_caretaker" == global_var or "mess_warden" == global_var %}
@@ -96,7 +95,7 @@ {% comment %}A single modules row ends here!{% endcomment %} {% comment %}A single modules row starts here!{% endcomment %} - + {% if request.user.extrainfo.user_type == "student" or request.user.extrainfo.user_type == "faculty" or request.user.extrainfo.user_type == "staff" or "Compounder" %}
@@ -112,6 +111,7 @@
+ {% endif %} {% if request.user.extrainfo.user_type != "student" %}
@@ -170,8 +170,7 @@ {% comment %}A single modules row ends here!{% endcomment %} - {% if request.user.extrainfo.user_type == "student" or "placement chairman" == global_var or "placement officer" == global_var %} - + {% if request.user.extrainfo.user_type != "staff" or "administrator" == global_var %}
@@ -224,6 +223,7 @@
{% endif %} + {% if request.user.extrainfo.user_type == "faculty" or "rspc_admin" == global_var or "HOD (CSE)" == global_var or "HOD (ECE)" == global_var or "HOD (ME)" == global_var or "HOD (NS)" == global_var or "HOD (Design)" == global_var or "HOD (Liberal Arts)" == global_var or "dean_rspc" == global_var or "director" == global_var %}
@@ -239,7 +239,7 @@
- + {% endif %} {% comment %}A single modules row ends here!{% endcomment %} @@ -283,7 +283,7 @@
- +
@@ -300,7 +300,7 @@
- +
{% endif %} - {% if request.user.extrainfo.user_type != "staff" %} + {% if request.user.extrainfo.user_type != "staff" or "administrator" == global_var %}
- +
@@ -355,37 +355,35 @@ {% comment %}A single modules row ends here!{% endcomment %} + {% if request.user.extrainfo.user_type == "student" or "dean_s" == global_var or request.user.extrainfo.user_type == "faculty" %} +
+ +
+
+ +
- {% if request.user.extrainfo.user_type == "student" or "dean_s" == global_var or request.user.extrainfo.user_type == "faculty" %} -
- {% endif %} - - {% if "Executive Engineer (Civil)" == global_var or "EE" == global_var or "Admin IWD" == global_var or "Electrical_AE" == global_var or "Electrical_JE" == global_var or "Civil_AE" == global_var or "Civil_JE" == global_var or "Director" == global_var or "Dean_s" == global_var or "dean_s" == global_var or "DeanPnD" == global_var %} + +
+ {% endif %} + {% if request.user.extrainfo.user_type != "student" %}
- +
- IWD + Institute Work Departments
@@ -395,11 +393,12 @@ {% comment %}A single modules row ends here!{% endcomment %} - {% if request.user.extrainfo.user_type == "student" or "hall1caretaker" == global_var or "hall2caretaker" == global_var or "hall3caretaker" == global_var%} + {% if request.user.extrainfo.user_type == "student" or user in hall_caretaker or user in hall_warden or request.user.is_superuser %} +
- +
diff --git a/FusionIIIT/templates/globals/base.html b/FusionIIIT/templates/globals/base.html index 3f5b3e1c0..e7614c08a 100644 --- a/FusionIIIT/templates/globals/base.html +++ b/FusionIIIT/templates/globals/base.html @@ -95,7 +95,7 @@ + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/add_student.html b/FusionIIIT/templates/hostelmanagement/add_student.html index 2ae897173..0baa46402 100644 --- a/FusionIIIT/templates/hostelmanagement/add_student.html +++ b/FusionIIIT/templates/hostelmanagement/add_student.html @@ -12,10 +12,10 @@

Student Room Allotment Application Form



{% comment %} {% endcomment %}
@@ -27,7 +27,7 @@

Student Room Allotment Application Form



diff --git a/FusionIIIT/templates/hostelmanagement/admin_hostel_list.html b/FusionIIIT/templates/hostelmanagement/admin_hostel_list.html new file mode 100644 index 000000000..ffee96966 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/admin_hostel_list.html @@ -0,0 +1,63 @@ + +{% block View_Hostels %} +

Hostel List

+
+ + + + + + + + + + + + + + + + + {% for detail in hostel_details %} + + + + + + + + + + + + + + + + + + + + + {% endfor %} + +
Hall IDHall NameSeater TypeMax AccommodationOccupiedVacant SeatsAssigned BatchAssigned CaretakerAssigned Warden
{{ detail.hall_id }}{{ detail.hall_name }}{{ detail.seater_type}}{{ detail.max_accomodation }}{{ detail.number_students }}{{ detail.vacant_seat}} + {{ detail.assigned_batch }}{{ detail.assigned_caretaker }}{{ detail.assigned_warden }}
+
+ +
+ + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/all_leave_data.html b/FusionIIIT/templates/hostelmanagement/all_leave_data.html new file mode 100644 index 000000000..5dfb101f1 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/all_leave_data.html @@ -0,0 +1,115 @@ +{% block leave_requests %} +

All Leave Requests

+
+ + + + + + + + + + + + + + + + {% for leave in all_leaves %} + + + + + + + + + + + + + {% endfor %} + +
Student NameRoll NumberReasonStart DateEnd DateStatusActionsRemarkPhone
{{ leave.student_name }}{{ leave.roll_num }}{{ leave.reason }}{{ leave.start_date }}{{ leave.end_date }}{{ leave.status }} + + +
+ + {% csrf_token %} + + + {%if leave.status == 'pending' %} + + {%endif%} +
+
+ {% csrf_token %} + + + + +
+ + + +
{{leave.remark}}{{leave.phone_number}}
+
+ + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/alloted_rooms_main.html b/FusionIIIT/templates/hostelmanagement/alloted_rooms_main.html new file mode 100644 index 000000000..3186c133b --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/alloted_rooms_main.html @@ -0,0 +1,174 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Hostel +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + + +
+ +
+ +
+ +
+
+
+

Alloted rooms

+
+ +
+ +
+
+ + + + + + + + + + + + + +
HallRoom NumberBlock NumberRoom CapacityOccupancy
+
+
+ +
+ +
+ +{% endblock %} +{% block javascript %} + + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/assign_batch.html b/FusionIIIT/templates/hostelmanagement/assign_batch.html new file mode 100644 index 000000000..7f29caedd --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/assign_batch.html @@ -0,0 +1,66 @@ +{% block manage_Hostel %} + +
+ + {% csrf_token %} +

Assign Batch

+
+ + +
+
+ + +
+ +
+ + + +{% endblock %} diff --git a/FusionIIIT/templates/hostelmanagement/assign_caretaker.html b/FusionIIIT/templates/hostelmanagement/assign_caretaker.html new file mode 100644 index 000000000..516d5e18b --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/assign_caretaker.html @@ -0,0 +1,83 @@ +{% block manage_Caretaker %} +
+ {% csrf_token %} +

Assign Caretaker

+
+ + + +
+
+ + + + + +
+ + +
+ + + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/assign_warden.html b/FusionIIIT/templates/hostelmanagement/assign_warden.html new file mode 100644 index 000000000..31f266527 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/assign_warden.html @@ -0,0 +1,81 @@ +{% block manage_Warden %} +
+ {% csrf_token %} +

Assign Warden

+
+ + + +
+
+ + + + + +
+ + +
+ + + + + + + +{% endblock %} + diff --git a/FusionIIIT/templates/hostelmanagement/book_guest_room.html b/FusionIIIT/templates/hostelmanagement/book_guest_room.html new file mode 100644 index 000000000..0fbd79176 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/book_guest_room.html @@ -0,0 +1,227 @@ +{% block book_guest_room %} +
+
+
+ + Book a Guest Room! +
+ {{ form.non_field_errors }} +
+
+ {% csrf_token %} +
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ {% comment %}
+ + + +
{% endcomment %} + +
+
+ {{ form.guests.errors }} + + +
+
+ {{ form.nationality.errors }} + + +
+
+
+
+ {{ form.rooms_required.errors }} + + +
+
+ + +
+ + +
+
+ +
+ +
+
+
+ + + +
+ +
+ {{ form.guest_name.errors }} + + +
+
+ {{ form.guest_address.errors }} + + +
+ +
+ +
+
+ {{ form.guest_email.errors }} + + +
+
+ {{ form.guest_phone.errors }} + + + +
+
+ + +
+ {{ form.purpose.errors }} + + +
+ + + + +
+
+ + +
+
+
+
+
+
+ + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/book_guest_room_status.html b/FusionIIIT/templates/hostelmanagement/book_guest_room_status.html new file mode 100644 index 000000000..48e98e6ad --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/book_guest_room_status.html @@ -0,0 +1,60 @@ +{% block book_guest_room_status %} + {% for user_request in user_guest_room_requests %} +
+
+
+

Room for {{user_request.total_guest}} in {{user_request.hall.hall_id}}

+
+
+
+ + + + + + + + + + + + + + + + + {% if user_request.status == 'Accepted' %} + + {% elif user_request.status == 'Rejected' %} + + {% else %} + + {% endif %} + + + + + + +
Requested ForContactArrivalDepartureStatus
{{user_request.guest_name}}{{user_request.guest_phone}}{{user_request.arrival_date}}{{user_request.departure_date}}{{user_request.status}}{{user_request.status}}{{user_request.status}}
+
+
+ + Reason +
+
+

Description

+ +
+
+
+
+
+
+
+ +
+
+
+ {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/create_leave.html b/FusionIIIT/templates/hostelmanagement/create_leave.html new file mode 100644 index 000000000..cbfb43337 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/create_leave.html @@ -0,0 +1,88 @@ +{% block create_leave %} +

Leave Form

+
+ {% csrf_token %} +
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/edit_student.html b/FusionIIIT/templates/hostelmanagement/edit_student.html new file mode 100644 index 000000000..9026a4f42 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/edit_student.html @@ -0,0 +1,179 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Hostel +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} +{% block content %} +
+
+
+
+ {% block userCard %} + {% include 'globals/usercard.html' %} + {% endblock %} +
+ +
+
+
+ + +

Edit Student Details

+
+ {% csrf_token %} + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+ + +
+ +
+ + + +
+ +
+ + Back to Homepage + +
+
+
+
+ +
+{% endblock %} + + + + +{% endblock %} diff --git a/FusionIIIT/templates/hostelmanagement/hall_list.html b/FusionIIIT/templates/hostelmanagement/hall_list.html new file mode 100644 index 000000000..5422c634f --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/hall_list.html @@ -0,0 +1,16 @@ + + + + + + Hall List + + +

Hall List

+ + + diff --git a/FusionIIIT/templates/hostelmanagement/hostel.html b/FusionIIIT/templates/hostelmanagement/hostel.html index b86676914..5cdea03c7 100644 --- a/FusionIIIT/templates/hostelmanagement/hostel.html +++ b/FusionIIIT/templates/hostelmanagement/hostel.html @@ -2,130 +2,509 @@ {% load static %} {% block title %} - Hostel +Hostel {% endblock %} {% block body %} - {% block navBar %} - {% include 'dashboard/navbar.html' %} - {% endblock %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} -
+
-
+
-
+
-
- {% block userCard %} - {% include 'globals/usercard.html' %} - {% endblock %} -
+
+ {% block userCard %} + {% include 'globals/usercard.html' %} + {% endblock %} +
-
+
-
- -
-
- {% block alloted_hostel_room %} - {% include 'hostelmanagement/alloted_hostel_room.html'%} - {% endblock %} -
+
- {% if user in hall_caretaker or hall_warden%} -
- {% block staff_schedule %} - {% include 'hostelmanagement/staff_schedule.html'%} - {% endblock %} -
- {% endif %} -
- {% block notice_board %} - {% include 'hostelmanagement/notice.html'%} - {% endblock %} -
+
+
+ {% block alloted_hostel_room %} + {% include 'hostelmanagement/alloted_hostel_room.html'%} + {% endblock %} +
-
- {% block attendance %} - {% include 'hostelmanagement/attendance.html' %} - {% endblock %} -
- {% comment %}
- {% block guest_room %} - {% include 'hostelmanagement/guestroom_booking.html'%} - {% endblock %} -
{% endcomment %} + {% if user in hall_caretaker or user in hall_warden%} +
+ {% block staff_schedule %} + {% include 'hostelmanagement/staff_schedule.html'%} + {% endblock %} +
+ {% endif %} + + +
+ {% block notice_board %} + {% include 'hostelmanagement/notice.html'%} + {% endblock %} +
+ +
+ {% block attendance %} + {% include 'hostelmanagement/attendance.html' %} + {% endblock %} +
+ +
+ {% block post_complaint_form %} + {% include 'hostelmanagement/post_complaint_form.html' %} + {% endblock %} +
+ +
+ {% block create_leave%} + {% include 'hostelmanagement/create_leave.html' %} + {% endblock %} +
+ +
+ {% block leave_status %} + {% include 'hostelmanagement/my_leaves.html' %} + {% endblock %} +
+ +
+ {% block leave_requests %} + {% include 'hostelmanagement/all_leave_data.html' %} + {% endblock %} +
+ +
+ {% block all_complaints %} + {% include 'hostelmanagement/hostel_complaint.html' %} + {% endblock %} +
+ +
+ {% block inventory_form %} + {% include 'hostelmanagement/inventory_form.html' %} + {% endblock %} +
+ + +
+ {% block hall_all_students %} + {% include 'hostelmanagement/student_details.html' %} + {% endblock %} +
+ + {% if user.username in all_students_id %} +
+ {% block book_guest_room %} + {% include 'hostelmanagement/book_guest_room.html' %} + {% endblock %} +
+ {% endif %} + + + {% if user in hall_caretaker %} +
+ {% block request_list %} + {% include 'hostelmanagement/update_guest_room.html' %} + {% endblock %} +
+ {% endif %} + + {% if user.username in all_students_id %} +
+ {% block book_guest_room_status %} + {% include 'hostelmanagement/book_guest_room_status.html' %} + {% endblock %} +
+ {% endif %} + + {% if is_superuser %} +
+ {% block manage_Hostel %} + {% include 'hostelmanagement/assign_batch.html' %} + {% endblock %}
+ {% endif %} + + {% if is_superuser %} +
+ {% block manage_Caretaker %} + {% include 'hostelmanagement/assign_caretaker.html' %} + {% endblock %} +
+ {% endif %} + + {% if is_superuser %} +
+ {% block manage_Warden %} + {% include 'hostelmanagement/assign_warden.html' %} + {% endblock %} +
+ {% endif %} + + {% if is_superuser %} +
+ {% block Add_hostel %} + {% include 'hostelmanagement/add_hostel.html' %} + {% endblock %} +
+ {% endif %} + + {% if is_superuser %} +
+ + {% block Hostel_Transactions %} + {% include 'hostelmanagement/hostel_transactions.html' %} + {% endblock %} +
+ {% endif %} + + + {% if is_superuser %} +
+ {% block Hostel_history %} + {% include 'hostelmanagement/hostel_history.html' %} + {% endblock %} +
+ {% endif %} + + {% if is_superuser %} +
+ {% block View_Hostels %} + {% include 'hostelmanagement/admin_hostel_list.html' %} + {% endblock %} +
+ {% endif %} + + + + + + + {% if user in hall_caretaker%} +
+ {% block Impose_fine %} + {% include 'hostelmanagement/impose_fine.html' %} + {% endblock %} +
+ {% endif %} + + {% if user in hall_caretaker%} +
+ {% block fine_list %} + {% include 'hostelmanagement/hostel_fine_list.html' %} + {% endblock %} +
+ {% endif %} + + {% if user in hall_caretaker %} +
+ {% block inventory_list %} + {% include 'hostelmanagement/inventory_list.html' %} + {% endblock %} +
+ {% endif %} + + {% if user.username in all_students_id %} +
+ {% block my_fine %} + {% include 'hostelmanagement/student_fine_details.html' %} + {% endblock %} +
+ {% endif %}
+ + + + + +
+ {% endblock %} {% block javascript %} -{% endblock %} - +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/hostel_complaint.html b/FusionIIIT/templates/hostelmanagement/hostel_complaint.html new file mode 100644 index 000000000..393bdfb93 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/hostel_complaint.html @@ -0,0 +1,25 @@ +{% block all_complaints %} +

Complaints Data

+ + + + + + + + + + + + {% for complaint in all_complaints %} + + + + + + + + {% endfor %} + +
Hall NameStudent NameRoll NumberDescriptionContact Number
{{ complaint.hall_name }}{{ complaint.student_name }}{{ complaint.roll_number }}{{ complaint.description }}{{ complaint.contact_number }}
+{% endblock %} diff --git a/FusionIIIT/templates/hostelmanagement/hostel_fine_list.html b/FusionIIIT/templates/hostelmanagement/hostel_fine_list.html new file mode 100644 index 000000000..22b57e0b3 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/hostel_fine_list.html @@ -0,0 +1,127 @@ +{% block fine_list %} +

Hostel Fine List

+
+ + + + + + + + + + + + + + + {% for hostel_fine in hostel_fines %} + + + + + + + + + + + + + + {% endfor %} + +
Fine IDStudentHallStudent NameAmountStatusReasonAction
{{ hostel_fine.fine_id }}{{ hostel_fine.student }}{{ hostel_fine.hall }}{{ hostel_fine.student_name }}{{ hostel_fine.amount }} + + {{ hostel_fine.reason }} + + + + +
+
+ + + + +{% endblock %} + + diff --git a/FusionIIIT/templates/hostelmanagement/hostel_history.html b/FusionIIIT/templates/hostelmanagement/hostel_history.html new file mode 100644 index 000000000..0781f46ff --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/hostel_history.html @@ -0,0 +1,33 @@ + +{% load static %} +{% block Hostel_history %} + + + +{% for hall in all_hall %} +
+
+ {% block {{hall.hall_id}} %} + {% include 'hostelmanagement/hostel_history_data.html' with hall_id=hall.hall_id %} + {% endblock %} +
+
+{% endfor %} + +{% endblock %} + + + + \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/hostel_history_data.html b/FusionIIIT/templates/hostelmanagement/hostel_history_data.html new file mode 100644 index 000000000..1159eaf5c --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/hostel_history_data.html @@ -0,0 +1,38 @@ +{% load custom_tags %} + +{% block {{hall.hall_id}} %} +

{{hall.hall_id}} History

+
+ + + + + + + + + + + + + + + + {% for entry in hostel_history %} + + {% if entry.hall == hall %} + + + + + + + + + {% endif %} + {% endfor %} + +
HallBatchCaretakerWardenDate
{{entry.hall}}{{ entry.batch }}{{ entry.caretaker }}{{ entry.warden }}{{ entry.timestamp|date:"Y-m-d" }}
+
+ + {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/hostel_transactions.html b/FusionIIIT/templates/hostelmanagement/hostel_transactions.html new file mode 100644 index 000000000..9c03b9576 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/hostel_transactions.html @@ -0,0 +1,30 @@ + +{% block Hostel_Transactions %} +
+

Hostel Transaction History

+
+ + + + + + + + + + + + {% for transaction in hostel_transactions %} + + + + + + + + {% endfor %} + +
TimestampHallChange TypePrevious ValueNew Value
{{ transaction.timestamp }}{{ transaction.hall }}{{ transaction.change_type }}{{ transaction.previous_value }}{{ transaction.new_value }}
+
+
+{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/impose_fine.html b/FusionIIIT/templates/hostelmanagement/impose_fine.html new file mode 100644 index 000000000..23c4ddd0e --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/impose_fine.html @@ -0,0 +1,76 @@ +{% block Impose_fine %} +

Hostel Fine Form

+
+ {% csrf_token %} +
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+ +
+ + +{% endblock %} diff --git a/FusionIIIT/templates/hostelmanagement/impose_fine_edit.html b/FusionIIIT/templates/hostelmanagement/impose_fine_edit.html new file mode 100644 index 000000000..21b5bd085 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/impose_fine_edit.html @@ -0,0 +1,129 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} +Hostel +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+
+ +
+ +
+ {% block userCard %} + {% include 'globals/usercard.html' %} + {% endblock %} +
+ +
+ + +
+ +

Hostel Fine Form

+
+ {% csrf_token %} +
+ + +
+ {% if fines %} +
+ + +
+ {% endif %} +
+ + +
+ + +
+ + +
+ + +
+ +
+
+ + + Back To Homepage +
+ +
+ +
+
+
+ + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/inventory_form.html b/FusionIIIT/templates/hostelmanagement/inventory_form.html new file mode 100644 index 000000000..5afbb0be9 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/inventory_form.html @@ -0,0 +1,59 @@ +{% block inventory_form %} +

Hostel Inventory Form

+
+ {% csrf_token %} +
+ + + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/inventory_list.html b/FusionIIIT/templates/hostelmanagement/inventory_list.html new file mode 100644 index 000000000..8a71b241e --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/inventory_list.html @@ -0,0 +1,129 @@ +{% block inventory_list %} + + +

Hostel Inventory List

+
+ + + + + + + + + + + + + + {% for inventory in inventories %} + + + + + + + + + + + {% endfor %} + +
Hall IDInventory IDInventory NameCostQuantityDelete
{{ inventory.hall_id }}{{ inventory.inventory_id }}{{ inventory.inventory_name }}{{ inventory.cost }}{{ inventory.quantity }}
+
+ + +{% endblock %} diff --git a/FusionIIIT/templates/hostelmanagement/inventory_update_form.html b/FusionIIIT/templates/hostelmanagement/inventory_update_form.html new file mode 100644 index 000000000..605a5d38e --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/inventory_update_form.html @@ -0,0 +1,72 @@ + + + + + + + Hostel Inventory Form + + + +

Hostel Edit Inventory Form

+
+ + {% csrf_token %} + + +

+

+ + + +

+ + +

+ + +

+ + +
+ +
+ + + + + \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/my_leaves.html b/FusionIIIT/templates/hostelmanagement/my_leaves.html new file mode 100644 index 000000000..6b12edc2d --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/my_leaves.html @@ -0,0 +1,48 @@ +{% block leave_status %} +

My Leaves

+
+ + + + + + + + + + + + + {% for leave in my_leaves %} + + + + + + + + + {% endfor %} + +
Student NameReasonStart DateEnd DateStatusRemark
{{ leave.student_name }}{{ leave.reason }}{{ leave.start_date }}{{ leave.end_date }} + {{ leave.status }} + {{ leave.remark }}
+
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/notice.html b/FusionIIIT/templates/hostelmanagement/notice.html index 2f19361a8..ec01d741e 100644 --- a/FusionIIIT/templates/hostelmanagement/notice.html +++ b/FusionIIIT/templates/hostelmanagement/notice.html @@ -14,7 +14,7 @@ {% endfor %}
-{% if user in hall_caretaker or hall_warden %} +{% if user in hall_caretaker or user in hall_warden %}
diff --git a/FusionIIIT/templates/iwdModuleV2/Page2.html b/FusionIIIT/templates/iwdModuleV2/Page2.html index 9f933e3be..715244f82 100644 --- a/FusionIIIT/templates/iwdModuleV2/Page2.html +++ b/FusionIIIT/templates/iwdModuleV2/Page2.html @@ -65,7 +65,7 @@ Corrigendum
- +
@@ -73,7 +73,8 @@ Addendum
- + +
@@ -81,7 +82,8 @@ Pre-bid meeting details
- + +
@@ -89,7 +91,8 @@ Technical-bid meeting details
- + +
@@ -101,7 +104,8 @@ Financial-bid meeting details
- + +
@@ -113,7 +117,8 @@ Letter of intent
- + +
@@ -121,7 +126,8 @@ Work order
- + +
@@ -129,7 +135,8 @@ Agreement Letter
- + +
@@ -137,13 +144,15 @@ Milestones
- + +
- Next + Prev + Next
@@ -178,4 +187,4 @@ -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/Page3.html b/FusionIIIT/templates/iwdModuleV2/Page3.html index d19ae128d..ddde765e5 100644 --- a/FusionIIIT/templates/iwdModuleV2/Page3.html +++ b/FusionIIIT/templates/iwdModuleV2/Page3.html @@ -65,7 +65,8 @@ Extension of time
- + +
@@ -76,7 +77,8 @@ - Next + Prev + Back To Home
@@ -110,4 +112,4 @@ -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/addBudget.html b/FusionIIIT/templates/iwdModuleV2/addBudget.html new file mode 100644 index 000000000..6b12182cb --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/addBudget.html @@ -0,0 +1,111 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} + +
+ Add Budget +
+
+ {% csrf_token %} +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/addItemsView.html b/FusionIIIT/templates/iwdModuleV2/addItemsView.html new file mode 100644 index 000000000..b9b1f003c --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/addItemsView.html @@ -0,0 +1,120 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} + +
+ Add Items +
+
+ {% csrf_token %} +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/auditDocumentView.html b/FusionIIIT/templates/iwdModuleV2/auditDocumentView.html new file mode 100644 index 000000000..afb68fc59 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/auditDocumentView.html @@ -0,0 +1,121 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Audit Documents +
+
+
+
+ + + + + + + + + + + {% for f in obj %} + + + + + + + + {% endfor %} +
IdDocumentSend To
{{f.0}} {{f.1}} + +
+ {% csrf_token %} + + + +
+
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/billsView.html b/FusionIIIT/templates/iwdModuleV2/billsView.html new file mode 100644 index 000000000..89969b1b8 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/billsView.html @@ -0,0 +1,147 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} + Academic +{% endblock %} + + +{% block body %} + {% block navBar %} + {% include 'dashboard/navbar.html' %} + {% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + + + {% load static %} +
+ Bills +
+
{% csrf_token %} +
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+ {% comment %}the doctor appointment tab ends here {% endcomment %} + + + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+ {% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/budget.html b/FusionIIIT/templates/iwdModuleV2/budget.html new file mode 100644 index 000000000..6a35af9fe --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/budget.html @@ -0,0 +1,111 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} + + +
+ Budget +
+
+
+
+ + + + + + + + + + {% for f in obj %} + + + + + + + + {% endfor %} +
IdNameBudget Issued
{{f.0}}{{f.1}}{{f.2}}
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/createWork.html b/FusionIIIT/templates/iwdModuleV2/createWork.html index 04323ba15..7fa533571 100644 --- a/FusionIIIT/templates/iwdModuleV2/createWork.html +++ b/FusionIIIT/templates/iwdModuleV2/createWork.html @@ -4,20 +4,17 @@ Create Project Requisition:
-
+
- - -
+ -
+ - -
+ -
+
diff --git a/FusionIIIT/templates/iwdModuleV2/createdRequests.html b/FusionIIIT/templates/iwdModuleV2/createdRequests.html new file mode 100644 index 000000000..cce743dec --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/createdRequests.html @@ -0,0 +1,128 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Created Requests +
+
+
+
+ + + + + + + + + + + + + + + {% for f in obj %} + + + + + + + + + + + {% endfor %} +
Details:-
IdNameDescriptionAreaCreated BySend to
{{f.0}}{{f.1}}{{f.3}}{{f.2}}{{f.4}} + +
+ {% csrf_token %} + + + +
+
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/dashboard.html b/FusionIIIT/templates/iwdModuleV2/dashboard.html index 9f0e1db49..c8ffaa0ec 100644 --- a/FusionIIIT/templates/iwdModuleV2/dashboard.html +++ b/FusionIIIT/templates/iwdModuleV2/dashboard.html @@ -34,28 +34,71 @@
{% comment %}ROW #2 starts here!{% endcomment %} - {% if eligible %} + {% if eligible == "Junior Engineer" or eligible == "Executive Engineer (Civil)" or eligible == "Electrical_AE" or eligible == "Electrical_JE" or eligible == "EE" or eligible == "Civil_AE" or eligible == "Civil_AE" %}
{% comment %}The Tab-Menu starts here!{% endcomment %} + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %}ROW #2 ends here!{% endcomment %} + +
+ {% endif %} + {% if eligible == "Dean (P&D)" %} +
+ {% comment %}The Tab-Menu starts here!{% endcomment %} + {% comment %}The Tab-Menu ends here!{% endcomment %} @@ -67,24 +110,134 @@ {% comment %}The left-rail segment ends here!{% endcomment %} {% comment %}The central-rail segment starts here!{% endcomment %} -
- {% comment %}The Appointments Form starts here!{% endcomment %} -
- {% block appointment %} - {% include 'iwdModuleV2/createWork.html' %} - {% endblock %} + {% endif %} + {% if eligible == "Director" %} +
+ {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} +
- {% comment %}The appointment Form ends here!{% endcomment %} + {% comment %}ROW #2 ends here!{% endcomment %} + +
+ {% comment %}The left-rail segment ends here!{% endcomment %} + + {% comment %}The central-rail segment starts here!{% endcomment %} + {% endif %} + {% if eligible == "Admin IWD" %} +
+ {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %}ROW #2 ends here!{% endcomment %} + +
+ {% comment %}The left-rail segment ends here!{% endcomment %} + + {% comment %}The central-rail segment starts here!{% endcomment %} + {% endif %} + {% if eligible == "Accounts Admin" %} +
+ {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %}ROW #2 ends here!{% endcomment %} + +
+ {% comment %}The left-rail segment ends here!{% endcomment %} + + {% comment %}The central-rail segment starts here!{% endcomment %} + {% endif %} + {% if eligible == "Auditor" %} +
+ {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} - {% comment %}The patient history starts here!{% endcomment %} -
- {% block history %} - {% include 'iwdModuleV2/viewWork.html' %} - {% endblock %}
- {% comment %}The patient history ends here!{% endcomment %} + {% comment %}ROW #2 ends here!{% endcomment %}
+ {% comment %}The left-rail segment ends here!{% endcomment %} + + {% comment %}The central-rail segment starts here!{% endcomment %} + {% endif %} + {% if eligible != "Junior Engineer" and eligible != "Executive Engineer (Civil)" and eligible != "Electrical_AE" and eligible != "Electrical_JE" and eligible != "EE" and eligible != "Civil_AE" and eligible != "Civil_JE" and eligible != "Dean (P&D)" and eligible != "Director" and eligible != "Accounts Admin" and eligible != "Admin IWD" and eligible != "Auditor" and eligible != "student" %} +
+ {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %}ROW #2 ends here!{% endcomment %} + +
+ {% comment %}The left-rail segment ends here!{% endcomment %} + + {% comment %}The central-rail segment starts here!{% endcomment %} {% endif %} {% comment %}The central-rail segment ends here!{% endcomment %} diff --git a/FusionIIIT/templates/iwdModuleV2/deanProcessedRequests.html b/FusionIIIT/templates/iwdModuleV2/deanProcessedRequests.html new file mode 100644 index 000000000..98f9ad72f --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/deanProcessedRequests.html @@ -0,0 +1,110 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block title %} + Academic +{% endblock %} + +{% block body %} + {% block navBar %} + {% include 'dashboard/navbar.html' %} + {% endblock %} + + +
+
+
+ {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} +
+
+
+
+ + +
+
+ Dean processed Requests +
+ +
+
+
+ + + + + + + + + + + + + {% for f in obj %} + + + + + + + + + + + {% endfor %} +
Details:-
IdNameDescriptionAreaCreated By
{{f.0}}{{f.1}}{{f.3}}{{f.2}}{{f.4}} +
+
+ {% csrf_token %} + + + +
+
+ {% csrf_token %} + + + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+{% endblock %} diff --git a/FusionIIIT/templates/iwdModuleV2/editBudget.html b/FusionIIIT/templates/iwdModuleV2/editBudget.html new file mode 100644 index 000000000..892ba9481 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/editBudget.html @@ -0,0 +1,120 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} + +
+ Budget +
+
+
+
+ + + + + + + + + + + + {% for f in obj %} + + + + {% csrf_token %} + + + + + + + + {% endfor %} +
IdNameBudget Issued
{{f.0}} + + + + + + +
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/editInventory.html b/FusionIIIT/templates/iwdModuleV2/editInventory.html new file mode 100644 index 000000000..e06876b90 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/editInventory.html @@ -0,0 +1,124 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} + +
+ Inventory +
+
+
+
+ + + + + + + + + + + + + {% for f in obj %} + + + + {% csrf_token %} + + + + + + + + + {% endfor %} +
IdNameQuantityCost (in Rupees)
{{f.0}} + + + + + + + + +
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/engineerProcessedRequests.html b/FusionIIIT/templates/iwdModuleV2/engineerProcessedRequests.html new file mode 100644 index 000000000..6b7386054 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/engineerProcessedRequests.html @@ -0,0 +1,128 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} + Academic +{% endblock %} + + +{% block body %} + {% block navBar %} + {% include 'dashboard/navbar.html' %} + {% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Engineer Processed Requests +
+
+
+
+ + + + + + + + + + + + + + {% for f in obj %} + + + + + + + + + + + {% endfor %} +
Details:-
IdNameDescriptionAreaCreated By
{{f.0}}{{f.1}}{{f.3}}{{f.2}}{{f.4}} + +
+ {% csrf_token %} + + + +
+
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+ {% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/generatedBillsRequestsView.html b/FusionIIIT/templates/iwdModuleV2/generatedBillsRequestsView.html new file mode 100644 index 000000000..38badd860 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/generatedBillsRequestsView.html @@ -0,0 +1,127 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Generated Bills Requests +
+
+
+
+ + + + + + + + + + + + + {% for f in obj %} + + + + + + + {% csrf_token %} + + + + + + {% endfor %} +
IdNameCreated ByBillSend to
{{f.0}}{{f.1}}{{f.4}}
+ + + + + + +
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/inventory.html b/FusionIIIT/templates/iwdModuleV2/inventory.html new file mode 100644 index 000000000..4e35ce614 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/inventory.html @@ -0,0 +1,111 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} + +
+ Inventory +
+
+
+
+ + + + + + + + + + + + {% for f in obj %} + + + + + + + + + {% endfor %} +
IdNameQuantityCost (in Rupees)
{{f.0}}{{f.1}}{{f.2}}{{f.3}}
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/issueWorkOrder.html b/FusionIIIT/templates/iwdModuleV2/issueWorkOrder.html new file mode 100644 index 000000000..7aef765b2 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/issueWorkOrder.html @@ -0,0 +1,120 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Issue Work Order +
+
+
+
+ + + + + + + + + + + + + + {% for f in obj %} + + + + + + + + + + + {% endfor %} +
Details:-
IdNameDescriptionAreaCreated By
{{f.0}}{{f.1}}{{f.3}}{{f.2}}{{f.4}} + +
+ {% csrf_token %} + + +
+
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/page1_create.html b/FusionIIIT/templates/iwdModuleV2/page1_create.html index c549fe90f..de798b7cb 100644 --- a/FusionIIIT/templates/iwdModuleV2/page1_create.html +++ b/FusionIIIT/templates/iwdModuleV2/page1_create.html @@ -78,7 +78,7 @@
- +

+{% comment %}The grid ends here!{% endcomment %} {% endblock %} {% block javascript %} - - - + + + -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/rejectedRequests.html b/FusionIIIT/templates/iwdModuleV2/rejectedRequests.html new file mode 100644 index 000000000..b3f95e93b --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/rejectedRequests.html @@ -0,0 +1,118 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Rejected Requests +
+
+
+
+ + + + + + + + + + + + + {% for f in obj %} + + + + + + + + + + + {% endfor %} +
IdNameDescriptionAreaCreated By
{{f.0}}{{f.1}}{{f.3}}{{f.2}}{{f.4}} +
+ {% csrf_token %} + + +
+
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/requestFromInventory.html b/FusionIIIT/templates/iwdModuleV2/requestFromInventory.html new file mode 100644 index 000000000..8a1e53a1d --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/requestFromInventory.html @@ -0,0 +1,139 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} + +
+ Request from Inventory +
+
{% csrf_token %} +
+ +
+ +
+
+ + + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ {% csrf_token %} + + +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} diff --git a/FusionIIIT/templates/iwdModuleV2/requestsInProgress.html b/FusionIIIT/templates/iwdModuleV2/requestsInProgress.html new file mode 100644 index 000000000..bceaad0ab --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/requestsInProgress.html @@ -0,0 +1,140 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Requests in Progress +
+
+
+
+ + + + + + + + + + + + + + {% for f in obj %} + + + + + + + + + + + {% endfor %} +
Details:-
IdNameDescriptionAreaCreated By
{{f.0}}{{f.1}}{{f.3}}{{f.2}}{{f.4}} + {% if f.5 == 1 %} +
+ {% csrf_token %} + + +
+
+
+ {% csrf_token %} + + +
+ {% endif %} + {% if f.5 == 0 %} +
+ {% csrf_token %} + + +
+
+
+ {% csrf_token %} + + +
+ {% endif %} +
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/requestsStatus.html b/FusionIIIT/templates/iwdModuleV2/requestsStatus.html new file mode 100644 index 000000000..14711ab16 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/requestsStatus.html @@ -0,0 +1,114 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} + Academic +{% endblock %} + + +{% block body %} + {% block navBar %} + {% include 'dashboard/navbar.html' %} + {% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Requests Status +
+
+
+
+ + + + + + + + + + + + + + {% for f in obj %} + + + + + + + + + + + {% endfor %} +
Details:-
IdNameDescriptionAreaCreated ByStatus
{{f.0}}{{f.1}}{{f.3}}{{f.2}}{{f.4}}{{f.5}}
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+ {% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/requestsView.html b/FusionIIIT/templates/iwdModuleV2/requestsView.html new file mode 100644 index 000000000..882e84274 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/requestsView.html @@ -0,0 +1,135 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Requests +
+
{% csrf_token %} +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} + + + + diff --git a/FusionIIIT/templates/iwdModuleV2/settleBillsView.html b/FusionIIIT/templates/iwdModuleV2/settleBillsView.html new file mode 100644 index 000000000..928d3a092 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/settleBillsView.html @@ -0,0 +1,113 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Processed Bills +
+
+
+
+ + + + + + + + + + {% for f in obj %} + + + + + + + + {% endfor %} +
IdBill
{{f.0}} {{f.1}} + +
+ {% csrf_token %} + + +
+
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/updateRequests.html b/FusionIIIT/templates/iwdModuleV2/updateRequests.html new file mode 100644 index 000000000..3a63ab253 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/updateRequests.html @@ -0,0 +1,146 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Update Request +
+
{% csrf_token %} + +
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} + + + + diff --git a/FusionIIIT/templates/iwdModuleV2/viewBudget.html b/FusionIIIT/templates/iwdModuleV2/viewBudget.html new file mode 100644 index 000000000..bc84ae651 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/viewBudget.html @@ -0,0 +1,106 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} +
+ +
+
+ Budget +
+
+
+
+ + + + + + + + + + {% for f in obj %} + + + + + + + + {% endfor %} +
IdNameBudget Issued
{{f.0}}{{f.1}}{{f.2}}
+
+
+
+ + + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/viewWork.html b/FusionIIIT/templates/iwdModuleV2/viewWork.html index 3fb49831f..d67b8d528 100644 --- a/FusionIIIT/templates/iwdModuleV2/viewWork.html +++ b/FusionIIIT/templates/iwdModuleV2/viewWork.html @@ -1,6 +1,7 @@
-
{% csrf_token %} + + {% csrf_token %}

diff --git a/FusionIIIT/templates/iwdModuleV2/workOrder.html b/FusionIIIT/templates/iwdModuleV2/workOrder.html new file mode 100644 index 000000000..11f2f9d93 --- /dev/null +++ b/FusionIIIT/templates/iwdModuleV2/workOrder.html @@ -0,0 +1,175 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Academic +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %}The left-rail segment starts here!{% endcomment %} +
+ {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu ends here!{% endcomment %} +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ + + + {% load static %} + {% comment %}the main tab starts here {% endcomment %} + +
+ Work Order +
+ {% csrf_token %} +
+ +
+ + +
+
+ + + + + +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+{% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + +{% endblock %} + + + + diff --git a/FusionIIIT/templates/leaveModule.zip b/FusionIIIT/templates/leaveModule.zip deleted file mode 100644 index 2b6772b25..000000000 Binary files a/FusionIIIT/templates/leaveModule.zip and /dev/null differ diff --git a/FusionIIIT/templates/notifications/ps1_sidepanel.html b/FusionIIIT/templates/notifications/ps1_sidepanel.html new file mode 100644 index 000000000..7f2d7f15b --- /dev/null +++ b/FusionIIIT/templates/notifications/ps1_sidepanel.html @@ -0,0 +1,27 @@ +{% load static %} +{% block sidepanel %} + {% load notifications_tags %} + {% for notice in notifications %} + {% if notice.unread %} +
{{notice.data.module}}
+ {% if notice.data.module == "Academic's Module" %} +
+ +
+ +

{{ notice.verb }}

+
+
+ + + +
+
+ {% endif%} + {% endif %} + {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/phcModule/account_admin_medical_relief.html b/FusionIIIT/templates/phcModule/account_admin_medical_relief.html new file mode 100644 index 000000000..a63ebfeda --- /dev/null +++ b/FusionIIIT/templates/phcModule/account_admin_medical_relief.html @@ -0,0 +1,210 @@ +{% load static %} + +{% block account_admin_medical_relief %} + + +
+
+
{% csrf_token %} +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+
+ + +
+
+ + +
+
+ + + + + + + + + + + + + + + + {% for inbox in acc_admin_inbox %} + + + + + + + + + + + + + + + {% endfor %} + + +
+ Uploader ID + + Upload Date + + Description + + File + + Status +
+ {{inbox.uploader}} + + + {{inbox.upload_date}} + + + {{ inbox.desc}} + + + + + + + {% if inbox.status == True %} + Approved + {% else %} + Pending + {% endif %} + + {% if inbox.status == False %} + + {% endif %} +
+ + + +
+
+ + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/phcModule/appointment.html b/FusionIIIT/templates/phcModule/appointment.html old mode 100755 new mode 100644 diff --git a/FusionIIIT/templates/phcModule/comp_prescription.html b/FusionIIIT/templates/phcModule/comp_prescription.html old mode 100755 new mode 100644 index 252a82703..ce46c0284 --- a/FusionIIIT/templates/phcModule/comp_prescription.html +++ b/FusionIIIT/templates/phcModule/comp_prescription.html @@ -304,6 +304,12 @@
+
+ +
+ +
+
@@ -358,6 +364,15 @@ var user = document.getElementById('patient_b').value; var details = document.getElementById('details_b').value; var tbl = document.getElementById('sched_b'); + + // Get the file input element + var fileInput = document.getElementById('file'); + + // Get the files from the input element + var file = fileInput.files[0]; + + // Create a new FormData object + var formData = new FormData(); if(tbl.rows.length==0){ $('#usr_b').html("Please prescribe some medicine!"); return false; @@ -367,18 +382,19 @@ $('#usr_b').html("Please enter all the details!"); return false; } + formData.append('csrfmiddlewaretoken', '{{ csrf_token }}') + formData.append('file', file); + formData.append('user', $("#patient_b").val()); + formData.append('doctor', $("#doctor_b").val()); + formData.append('details', $("#details_b").val()); + formData.append('tests', $("#tests_b").val()); + formData.append('prescribe_b', $("#prescribe_b").val()); $.ajax({ type:'post', url:'/healthcenter/compounder/', - data: { - csrfmiddlewaretoken: '{{ csrf_token }}', - user:$("#patient_b").val(), - doctor:$("#doctor_b").val(), - details:$("#details_b").val(), - tests:$("#tests_b").val(), - // appointment:$("#appointment").val(), - prescribe_b:$("#prescribe_b").val() - }, + data: formData, + processData: false, // Don't process the data as a query string + contentType: false, // Let the browser set the Content-Type header automatically success: function(data){ if (data.status == 1){ alert("prescribed medicine"); diff --git a/FusionIIIT/templates/phcModule/compounder_medical_relief.html b/FusionIIIT/templates/phcModule/compounder_medical_relief.html new file mode 100644 index 000000000..f02f69ee5 --- /dev/null +++ b/FusionIIIT/templates/phcModule/compounder_medical_relief.html @@ -0,0 +1,109 @@ +{% load static %} + +{% block CompounderMedicalReliefView %} + + + +
+
+ + + + + + + + + + + + + + + {% for inbox in inbox_files %} + + + + + + + + + + + + + + {% endfor %} + + +
+ Uploader ID + + Upload Date + + Description + + File + + Status +
+ {{ inbox.uploader }} + + {{ inbox.upload_date }} + + {{ inbox.desc }} + + + + + + {% if inbox.status1 %} + Approved + {% elif inbox.status %} + Forwarded + {% else %} + Pending + {% endif %} + + {% if not inbox.status %} + + {% endif %} +
+ + + +
+
+ + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/phcModule/feedback.html b/FusionIIIT/templates/phcModule/feedback.html index 9c41d6fd2..693739898 100644 --- a/FusionIIIT/templates/phcModule/feedback.html +++ b/FusionIIIT/templates/phcModule/feedback.html @@ -1,127 +1,127 @@ -{% load static %} -{% block feedback %} - {% comment %}The tab menu starts here!{% endcomment %} - - -
-
- - {% comment %}Form Tag starts here!{% endcomment %} -
- {% comment %}The add a new skill Accordian starts here!{% endcomment %} -
- -
- The Feedback form for PHC: -
- -
- -
-
- - -
- -
- - -
-
- -
- - -
- -
- - -
-
-
- {% comment %}Form Tag ends here!{% endcomment %} - -
-
-
- -
-
- -
-
- -
- -
- Zlatan Ibrahimovic - Medicines - -
- Forgive and Forget mess food? I am neither Jesus nor do I have Alzheimer. -
-
- -
- August 10 '18 -
-
- -
- -
- Zlatan Ibrahimovic - Medicines - -
- Diarrhea: The original detox. -
-
- -
- August 09 '18 -
-
- -
- -
- Zlatan Ibrahimovic - Cleanliness - -
- Before you leave, take a minute to clean from the next time! -
-
- -
- August 08 '18 -
-
- -
- -
-
+{% load static %} +{% block feedback %} + {% comment %}The tab menu starts here!{% endcomment %} + + +
+
+ + {% comment %}Form Tag starts here!{% endcomment %} +
+ {% comment %}The add a new skill Accordian starts here!{% endcomment %} +
+ +
+ The Feedback form for PHC: +
+ +
+ +
+
+ + +
+ +
+ + +
+
+ +
+ + +
+ +
+ + +
+
+
+ {% comment %}Form Tag ends here!{% endcomment %} + +
+
+
+ +
+
+ +
+
+ +
+ +
+ Zlatan Ibrahimovic + Medicines + +
+ Forgive and Forget mess food? I am neither Jesus nor do I have Alzheimer. +
+
+ +
+ August 10 '18 +
+
+ +
+ +
+ Zlatan Ibrahimovic + Medicines + +
+ Diarrhea: The original detox. +
+
+ +
+ August 09 '18 +
+
+ +
+ +
+ Zlatan Ibrahimovic + Cleanliness + +
+ Before you leave, take a minute to clean from the next time! +
+
+ +
+ August 08 '18 +
+
+ +
+ +
+
{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/phcModule/history.html b/FusionIIIT/templates/phcModule/history.html old mode 100755 new mode 100644 index 8d091eabb..f0c161c12 --- a/FusionIIIT/templates/phcModule/history.html +++ b/FusionIIIT/templates/phcModule/history.html @@ -36,12 +36,16 @@

D - No.of days,    T - No.of times per day

Date - Details + Details - Test + Test + + + Report + @@ -77,6 +81,14 @@

+ + + + - - + @@ -46,7 +45,6 @@

- diff --git a/FusionIIIT/templates/ps1/current_stock_view_filter.html b/FusionIIIT/templates/ps1/current_stock_view_filter.html index d57b85d00..d5ec0df6b 100644 --- a/FusionIIIT/templates/ps1/current_stock_view_filter.html +++ b/FusionIIIT/templates/ps1/current_stock_view_filter.html @@ -22,10 +22,10 @@

{% csrf_token %}
- +
@@ -40,20 +40,11 @@

-
- - -
-

- - + @@ -104,14 +94,12 @@

- - + - + diff --git a/FusionIIIT/templates/ps1/ps1.html b/FusionIIIT/templates/ps1/ps1.html index a44422160..c79184378 100644 --- a/FusionIIIT/templates/ps1/ps1.html +++ b/FusionIIIT/templates/ps1/ps1.html @@ -7,11 +7,13 @@ {% endblock %} + {% block body %} {% block navBar %} {% include 'dashboard/navbar.html' %} {% endblock %} + {% comment %}The grid starts here!{% endcomment %} {% comment %}The right-rail segment ends here!{% endcomment %} diff --git a/FusionIIIT/templates/ps1/stock_edit.html b/FusionIIIT/templates/ps1/stock_edit.html index 7e484a64b..a946be70f 100644 --- a/FusionIIIT/templates/ps1/stock_edit.html +++ b/FusionIIIT/templates/ps1/stock_edit.html @@ -54,19 +54,15 @@


- +
-
- +
+
-
-
- -
- +

@@ -93,12 +89,11 @@


diff --git a/FusionIIIT/templates/ps1/stock_entry_item_view.html b/FusionIIIT/templates/ps1/stock_entry_item_view.html index 42141e283..886ffcd6d 100644 --- a/FusionIIIT/templates/ps1/stock_entry_item_view.html +++ b/FusionIIIT/templates/ps1/stock_entry_item_view.html @@ -1,8 +1,51 @@ + {% extends 'ps1/ps2.html' %} {% load static %} {% block filetracking_tab %} +

{{pre.test}} + {% if pre.file != None %} + + + + {% endif %} + diff --git a/FusionIIIT/templates/phcModule/medical_relief.html b/FusionIIIT/templates/phcModule/medical_relief.html new file mode 100644 index 000000000..715b363aa --- /dev/null +++ b/FusionIIIT/templates/phcModule/medical_relief.html @@ -0,0 +1,195 @@ +{% load static %} +{% block medical_relief %} + + {% comment %} + The left-rail segment ends here! + {% endcomment %} + + {% comment %} + The central-rail segment starts here! + {% endcomment %} + +
+
+
{% csrf_token %} +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+ + + + + + + +
+
+ +
+
+
+ + + + + + + + + + + + + + + {% for inbox in medicalRelief %} + + + + + + + + + + + + + + + {% endfor %} + + +
+ Upload Date + + Approval Date + + Description + + File + + Status +
+ {{ inbox.upload_date}} + + + + {{inbox.approval_date}} + + + {{ inbox.desc}} + + + + + + + {% if inbox.status == True %} + Approved + {% else %} + Pending + {% endif %} + +
+ + + + + + + + +{% endblock %} + diff --git a/FusionIIIT/templates/phcModule/patientlog.html b/FusionIIIT/templates/phcModule/patientlog.html old mode 100755 new mode 100644 index 839cbc9dc..2cdff080f --- a/FusionIIIT/templates/phcModule/patientlog.html +++ b/FusionIIIT/templates/phcModule/patientlog.html @@ -390,10 +390,13 @@

Date

- Details + Details - Test + Test + + Report @@ -437,6 +440,13 @@

{{pre.test}} + {% if pre.file %} + + + + {% endif %} + @@ -450,7 +460,7 @@

@@ -460,34 +470,36 @@

- +
- + var dis = this; + var d = window.confirm('Are you sure, you want to cancel the prescription?'); + if(d == false){ + return; + } + $('#'+id).parent().parent().remove(); + alert("prescription cancelled"); - - + $.ajax({ + type:'post', + url:'/healthcenter/compounder/', + data: {'cancel_presc':id,}, + + beforeSend: function(xhr) { + xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}"); + }, + success: function(data){ + } + }); + + + } + + + + {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/phcModule/phc.html b/FusionIIIT/templates/phcModule/phc.html old mode 100755 new mode 100644 diff --git a/FusionIIIT/templates/phcModule/phc_compounder.html b/FusionIIIT/templates/phcModule/phc_compounder.html index 2e4cd8d70..46c67d7c5 100644 --- a/FusionIIIT/templates/phcModule/phc_compounder.html +++ b/FusionIIIT/templates/phcModule/phc_compounder.html @@ -63,10 +63,14 @@ Feedback/Response - - + + {% comment %} Make Announcements + {% endcomment %} + + Medical Relief + {% comment %}The Tab-Menu ends here!{% endcomment %} @@ -126,17 +130,27 @@ {% endblock %} -
+ {% comment %}
{% block make_announce_comp %} - {% include 'phcModule/make_announce_comp.html' with all_complaints=all_complaints%} + {% include 'phcModule/make_announce_comp.html' with all_complaints=all_complaints %} + {% endblock %} +
{% endcomment %} +
+ {% block CompounderMedicalReliefView %} + {% include 'phcModule/compounder_medical_relief.html' with inbox_files=inbox_files medicalRelief=medicalRelief %} {% endblock %}
+ {% comment %}The Doctors and Pathologists Form ends here!{% endcomment %}
{% comment %}The central-rail segment ends here!{% endcomment %} {% comment %}The right-rail segment starts here!{% endcomment %}
+ {% comment %}
+ {% block sidepanel %} {% include 'notifications/sidepanel.html' with notifications=notifications %} + {% endblock %} +
{% endcomment %}
{% comment %}The right-rail segment ends here!{% endcomment %} diff --git a/FusionIIIT/templates/phcModule/phc_student.html b/FusionIIIT/templates/phcModule/phc_student.html index eb042fc7d..014899530 100644 --- a/FusionIIIT/templates/phcModule/phc_student.html +++ b/FusionIIIT/templates/phcModule/phc_student.html @@ -56,6 +56,13 @@ + {% if 'student' != request.user.extrainfo.user_type %} + + Medical Relief + + + {% endif %} + {% comment %} {% if usertype == "fx" %} Medical Relief @@ -102,18 +109,33 @@ {% include 'phcModule/schedule_student.html'%} {% endblock %} - {% comment %} {% if global_var=="faculty"%} {% endcomment %} - {% comment %}
- {% block medical_relief %} - {% include 'phcModule/medical_relief.html'%} - {% endblock %} -
{% endcomment %} + {% if global_var != 'Accounts Admin' %} +
+ {% block medical_relief %} + {% include 'phcModule/medical_relief.html'%} + {% endblock %} +
+ {% endif %} + + {% if global_var == 'Accounts Admin' %} +
+ {% block account_admin_medical_relief %} + {% include 'phcModule/account_admin_medical_relief.html' with acc_admin_inbox=acc_admin_inbox medicalRelief=medicalRelief %} + {% endblock %} +
+ {% endif %} + + {% comment %}The complaint/feedback ends here!{% endcomment %} {% comment %}The central-rail segment ends here!{% endcomment %} {% comment %}The right-rail segment starts here!{% endcomment %}
+ {% comment %}
+ {% block sidepanel %} {% include 'notifications/sidepanel.html' with notifications=notifications %} + {% endblock %} +
{% endcomment %}
{% comment %}The right-rail segment ends here!{% endcomment %} diff --git a/FusionIIIT/templates/phcModule/viewschedule.html b/FusionIIIT/templates/phcModule/viewschedule.html index b5f60df04..d0bafd10e 100644 --- a/FusionIIIT/templates/phcModule/viewschedule.html +++ b/FusionIIIT/templates/phcModule/viewschedule.html @@ -1,72 +1,72 @@ -{% load static %} -{% block viewschedule %} - {% comment %}the main tab starts here {% endcomment %} -
- {% comment %}the ambulance schedule tab starts here {% endcomment %} -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9:00-10:0010:00-11:0011:00-12:0012:00-1:00
MONDAYHall - 1Hall - 3MessLHTC
TUESDAYHall - 1Hall - 3MessLHTC
WEDNESDAYHall - 1Hall - 3MessLHTC
THURSDAYHall - 1Hall - 3MessLHTC
FRIDAYHall - 1Hall - 3MessLHTC
- -
- -
- -
-
- {% comment %}the ambulance schedule tab ends here {% endcomment %} - - -{% endblock %} +{% load static %} +{% block viewschedule %} + {% comment %}the main tab starts here {% endcomment %} + + {% comment %}the ambulance schedule tab starts here {% endcomment %} +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
9:00-10:0010:00-11:0011:00-12:0012:00-1:00
MONDAYHall - 1Hall - 3MessLHTC
TUESDAYHall - 1Hall - 3MessLHTC
WEDNESDAYHall - 1Hall - 3MessLHTC
THURSDAYHall - 1Hall - 3MessLHTC
FRIDAYHall - 1Hall - 3MessLHTC
+ +
+ +
+ +
+
+ {% comment %}the ambulance schedule tab ends here {% endcomment %} + + +{% endblock %} diff --git a/FusionIIIT/templates/ps1/StockEntry.html b/FusionIIIT/templates/ps1/StockEntry.html index 411fa841a..2e7b39fdd 100644 --- a/FusionIIIT/templates/ps1/StockEntry.html +++ b/FusionIIIT/templates/ps1/StockEntry.html @@ -55,8 +55,8 @@

-
- +
+
-
-
- -

@@ -98,12 +94,11 @@


@@ -112,7 +107,7 @@

- +

diff --git a/FusionIIIT/templates/ps1/archieve_view.html b/FusionIIIT/templates/ps1/archieve_view.html new file mode 100644 index 000000000..7526af5a8 --- /dev/null +++ b/FusionIIIT/templates/ps1/archieve_view.html @@ -0,0 +1,41 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + +
+ + + + + + + + + + + + + {% for archieve in archieves %} + + + + + + + + + {% endfor %} + +
Created ByFile IDSubjectDateView Indent
{{ archieve.uploader }} - {{ request.user.extrainfo.department.name }}{{ request.user.extrainfo.department.name }}-#{{ archieve.id }}{{ archieve.subject }}{{ archieve.upload_date }}
+
+{% endblock %} diff --git a/FusionIIIT/templates/ps1/archieved_indents.html b/FusionIIIT/templates/ps1/archieved_indents.html new file mode 100644 index 000000000..4e2aa9249 --- /dev/null +++ b/FusionIIIT/templates/ps1/archieved_indents.html @@ -0,0 +1,26 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + +
+
+ {% endfor %} + + + +
+ +{% endblock %} diff --git a/FusionIIIT/templates/ps1/composeIndent.html b/FusionIIIT/templates/ps1/composeIndent.html index 13aba43ce..8c406a8b6 100644 --- a/FusionIIIT/templates/ps1/composeIndent.html +++ b/FusionIIIT/templates/ps1/composeIndent.html @@ -1,3 +1,4 @@ + {% extends 'ps1/ps1.html' %} {% load static %} @@ -67,16 +68,7 @@

- -
- - -
- +
@@ -139,7 +131,7 @@
Replaced*
-
+
- - +
+ + +
+ +

@@ -194,7 +190,7 @@
Replaced*
-             +
{% endcomment %} @@ -206,19 +202,19 @@

Replaced*
-             +
@@ -247,42 +243,7 @@
Replaced*
{% comment %}the compounder prescription tab ends here {% endcomment %} - + {% endblock %} diff --git a/FusionIIIT/templates/ps1/createdindent.html b/FusionIIIT/templates/ps1/createdindent.html index 1940bde2b..dd5c06a75 100644 --- a/FusionIIIT/templates/ps1/createdindent.html +++ b/FusionIIIT/templates/ps1/createdindent.html @@ -2,6 +2,20 @@ {% load static %} {% block filetracking_tab %} + + @@ -344,38 +407,34 @@ - diff --git a/FusionIIIT/templates/ps1/current_stock_view.html b/FusionIIIT/templates/ps1/current_stock_view.html index bfb93f38c..88153c82a 100644 --- a/FusionIIIT/templates/ps1/current_stock_view.html +++ b/FusionIIIT/templates/ps1/current_stock_view.html @@ -35,8 +35,7 @@

Item TypeItem Gradedepartmentdepartment/Section Quantity
{{s.item_type}} {{s.grade}} {{s.department}} {{s.total_quantity}}
Item TypeItem Gradedepartmentdepartment/section Quantity View Stocks
{{s.item_type}} {{s.grade}} {{s.department}} {{s.department.name}} {{s.total_quantity}} {% csrf_token %} - diff --git a/FusionIIIT/templates/ps1/draftview.html b/FusionIIIT/templates/ps1/draftview.html index 2af3d32fa..69158bfd2 100644 --- a/FusionIIIT/templates/ps1/draftview.html +++ b/FusionIIIT/templates/ps1/draftview.html @@ -13,7 +13,10 @@

- +
+ + +
@@ -45,6 +48,8 @@

Created By
+ +
diff --git a/FusionIIIT/templates/ps1/entry.html b/FusionIIIT/templates/ps1/entry.html index 53d91ab48..b0333c05b 100644 --- a/FusionIIIT/templates/ps1/entry.html +++ b/FusionIIIT/templates/ps1/entry.html @@ -23,7 +23,7 @@

{% if IndentFiles %} -
+
@@ -53,7 +53,7 @@

diff --git a/FusionIIIT/templates/ps1/forwardedIndent.html b/FusionIIIT/templates/ps1/forwardedIndent.html new file mode 100644 index 000000000..d149ec563 --- /dev/null +++ b/FusionIIIT/templates/ps1/forwardedIndent.html @@ -0,0 +1,394 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + + + + +
+ + + + + {% csrf_token %} + +
+
+
Subject- {{file.subject}}
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + {% for t in track %} +
+
+
+ {{t.current_design}} + + + +
+ Received by: {{t.receiver_id}}-{{t.receive_design}} +
+ +
+
+                                                        {% if t.remarks %}
+                                                            {{t.remarks}}
+                                                        {% else %}
+                                                            No Remarks
+                                                        {% endif %}
+
+                                                     
+
+
+
+
+ {% endfor %} + +
+ +
+ + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + + +
+
+ + + + + + + + + + +{% endblock %} + + + \ No newline at end of file diff --git a/FusionIIIT/templates/ps1/forwardindent.html b/FusionIIIT/templates/ps1/forwardindent.html index 709c4ec77..5c5e17ab1 100644 --- a/FusionIIIT/templates/ps1/forwardindent.html +++ b/FusionIIIT/templates/ps1/forwardindent.html @@ -36,73 +36,117 @@
-
{{file.description}}
- -
Indent Name: {{indent.item_name}}
- -
Indent Quantity: {{indent.quantity}}
- -
Indent Present Stock: {{indent.present_stock}}
- -
Indent Estimated Cost: {{indent.estimated_cost}}
- -
Indent Purpose: {{indent.purpose}}
- -
Indent Specification: {{indent.specification}}
- -
Indent Type: {{indent.item_type}}
- - {% if indent.nature == True %} -
Item Nature: Consumable
- {% else %} -
Item Nature: Non Consumable
- {% endif %} - - {% if indent.indigenous == True %} -
Indent Indigenous: Yes
- {% else %} -
Indent Indigenous: No
- {% endif %} - - {% if indent.replaced == True %} -
Indent Replaced: Yes
- {% else %} -
Indent Replaced: No
- {% endif %} - -
Indent Budgetary Head: {{indent.budgetary_head}}
- -
Indent Expected Delivery: {{indent.expected_delivery}}
- -
Indent Sources of Supply: {{indent.sources_of_supply}}
- - {% if indent.head_approval == True %} -
Indent Head Approval: Yes
- {% else %} -
Indent Head Approval: No
- {% endif %} - - {% if indent.director_approval == True %} -
Indent Director Approval: Yes
- {% else %} -
Indent Director Approval: No
- {% endif %} - - {% if indent.financial_approval == True %} -
Indent Financial Approval: Yes
- {% else %} -
Indent Financial Approval: No
- {% endif %} - - {% if indent.purchased == True %} -
Indent Purchased: Yes
- {% else %} -
Indent Purchased: No
- {% endif %} + + + + + + + + + + + + + + + + + + + + +
- {% for t in track %}
@@ -113,7 +157,7 @@ -
+
Received by: {{t.receiver_id}}-{{t.receive_design}}
@@ -138,46 +182,51 @@
-
- -
+ -
+ {% if lastTrackingInstance.receiver_id == request.user %} -
- +
- {% for designation in designations %} - - {% endfor %} - - -
+ + +
+ +
+ +
-
- - -
+ +
+ + +
+ + {% endif %}
@@ -192,10 +241,20 @@

- - +
+ {% if lastTrackingInstance.receiver_id == request.user %} + + {% endif %} + + {% if isArchivable == True %} + + + {% endif %} +

diff --git a/FusionIIIT/templates/ps1/generate_report.html b/FusionIIIT/templates/ps1/generate_report.html index 8f1153740..7374c533d 100644 --- a/FusionIIIT/templates/ps1/generate_report.html +++ b/FusionIIIT/templates/ps1/generate_report.html @@ -147,7 +147,7 @@

No Records present in database

- + diff --git a/FusionIIIT/templates/ps1/indentview.html b/FusionIIIT/templates/ps1/indentview.html index 8e5d1896c..3d300399c 100644 --- a/FusionIIIT/templates/ps1/indentview.html +++ b/FusionIIIT/templates/ps1/indentview.html @@ -13,7 +13,9 @@

-

{% csrf_token %}
Stock_Name Quantity dealing assistant idDepartmentDepartment/Section stock Report
+
+ +
@@ -32,7 +34,7 @@

- {% if indent.head_approval == False or indent.director_approval == False or indent.financial_approval == False %} @@ -54,6 +56,7 @@

Created By{{request.user.extrainfo.department.name}}-{{indent.file_info.upload_date.year}}-{{indent.file_info.upload_date.month}}-#{{indent.file_info.id}} {{indent.file_info.subject}} {{indent.file_info.upload_date}}
+

diff --git a/FusionIIIT/templates/ps1/outboxview.html b/FusionIIIT/templates/ps1/outboxview.html new file mode 100644 index 000000000..d75661474 --- /dev/null +++ b/FusionIIIT/templates/ps1/outboxview.html @@ -0,0 +1,36 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + +
+ + +
+
+ {% endfor %} + + + + + +
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps1/outboxview2.html b/FusionIIIT/templates/ps1/outboxview2.html new file mode 100644 index 000000000..d5e6bca1f --- /dev/null +++ b/FusionIIIT/templates/ps1/outboxview2.html @@ -0,0 +1,53 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + +
+
+ + + + + + + + + + + + + + + + + {% for j in in_file %} + + + + + + + + + + + {% endfor %} + + +
Received asSend byFile IDSubjectDateView File
{{receive_design}}{{j.uploader}}{{j.id}} {{j.subject}}{{j.upload_date}}
+
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps1/perform_transfer1.html b/FusionIIIT/templates/ps1/perform_transfer1.html index 6fc8430d0..22fdaeb7d 100644 --- a/FusionIIIT/templates/ps1/perform_transfer1.html +++ b/FusionIIIT/templates/ps1/perform_transfer1.html @@ -35,7 +35,7 @@

Stock_Name Quantity dealing assistant idDepartmentDepartment/Section Transfer stocks
@@ -77,7 +242,7 @@

{% if s.StockEntryId.item_id.purchased %}

- + diff --git a/FusionIIIT/templates/ps1/stock_entry_view.html b/FusionIIIT/templates/ps1/stock_entry_view.html index 2b58e8596..1cc509832 100644 --- a/FusionIIIT/templates/ps1/stock_entry_view.html +++ b/FusionIIIT/templates/ps1/stock_entry_view.html @@ -149,9 +149,8 @@

No Records present in database

- + - @@ -171,13 +170,19 @@

No Records present in database

- + - - diff --git a/FusionIIIT/templates/ps1/stock_item_view.html b/FusionIIIT/templates/ps1/stock_item_view.html index 6bffb79d6..e2a562010 100644 --- a/FusionIIIT/templates/ps1/stock_item_view.html +++ b/FusionIIIT/templates/ps1/stock_item_view.html @@ -35,7 +35,7 @@

- + @@ -49,7 +49,7 @@

- + diff --git a/FusionIIIT/templates/ps1/stock_transfer.html b/FusionIIIT/templates/ps1/stock_transfer.html index 78b0d21dd..048e145e8 100644 --- a/FusionIIIT/templates/ps1/stock_transfer.html +++ b/FusionIIIT/templates/ps1/stock_transfer.html @@ -36,9 +36,8 @@

- + - @@ -56,7 +55,6 @@

- @@ -71,12 +69,11 @@


diff --git a/FusionIIIT/templates/ps1/view_transfer.html b/FusionIIIT/templates/ps1/view_transfer.html index 7a0740cef..6cb11448c 100644 --- a/FusionIIIT/templates/ps1/view_transfer.html +++ b/FusionIIIT/templates/ps1/view_transfer.html @@ -35,12 +35,12 @@

- + - - + + @@ -54,15 +54,15 @@

{% for s in stockTransfers %} - - + + - - + + diff --git a/dbdump b/dbdump new file mode 100644 index 000000000..e69de29bb diff --git a/manage.py b/manage.py new file mode 100644 index 000000000..444b72e07 --- /dev/null +++ b/manage.py @@ -0,0 +1,16 @@ + +import os +import sys +from django.core.management import execute_from_command_line +from django.contrib.auth.management.commands.createsuperuser import Command + + +def create_superuser(): + command = Command() + command.handle(username='admin', email='') + + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "your_project.settings") + create_superuser() + execute_from_command_line(sys.argv)
{{s.nomenclature}} {{s.department}}{{s.department.name}} {{s.location}} {{s.isTransferred}} item Type dealing assistant id vendorDepartmentDepartment/Section QuantityGrade Location Storage recieved_date bill {{s.item_id.item_type}} {{s.dealing_assistant_id}} {{s.vendor}}{{s.item_id.file_info.uploader.department}}{{s.item_id.file_info.uploader.department.name}} {{s.current_stock}}{{s.item_id.grade}} {{s.location}} {{s.recieved_date}}{{s.bill}} + + + {% if s.bill %} + {{ s.bill }} + {% else %} + No bill available + {% endif %} +
Nomenclature Item NameCurrent DepartmentCurrent Department/Section Current Location Transferred InUse
{{s.nomenclature}} {{s.StockEntryId.item_id.item_name}} {{s.department}}{{s.department.name}} {{s.location}} {{s.isTransferred}} Nomenclature Item Type Current LocationCurrent DepartmentCurrent Department/Section VendorGrade Choose For Transfer
{{item.department}} {{item.StockEntryId.vendor}}{{item.StockEntryId.item_id.grade}}
File IdStock Item ID Item Type Item Name NomenclatureSrc DeptDest DeptSrc Dept/SecDest Dept/Sec Src Location Dest Location dateTime
{{s.indent_file.file_info}} {{s.stockItem}} {{s.indent_file.file_info.id}} {{s.indent_file.item_type}} {{s.indent_file.item_name}} {{s.stockItem.nomenclature}} {{s.src_dept}}{{s.dest_dept}}{{s.src_dept.name}}{{s.dest_dept.name}} {{s.src_location}} {{s.dest_location}} {{s.dateTime}}