diff --git a/.gitignore b/.gitignore index f02eb6e3e..0b044e066 100644 --- a/.gitignore +++ b/.gitignore @@ -100,3 +100,5 @@ FusionIIIT/Fusion/settings.py # dbinsertscripts FusionIIIT/dbinsertscripts + +FusionIIIT/Fusion/fusion.db \ No newline at end of file diff --git a/FusionIIIT/Fusion/fusion.db b/FusionIIIT/Fusion/fusion.db deleted file mode 100644 index 7ddff21c4..000000000 Binary files a/FusionIIIT/Fusion/fusion.db and /dev/null differ diff --git a/FusionIIIT/applications/eis/views.py b/FusionIIIT/applications/eis/views.py index 34cb1cae2..729dfc085 100644 --- a/FusionIIIT/applications/eis/views.py +++ b/FusionIIIT/applications/eis/views.py @@ -308,7 +308,7 @@ def profile(request): flag_rspc = 0 for i in a1: print(i.designation) - if(str(i.designation)=='Dean (RSPC)'): + if(str(i.designation)=='Dean (R&D)'): flag_rspc = 1 print(flag_rspc) # done edit diff --git a/FusionIIIT/applications/office_module/admin.py b/FusionIIIT/applications/office_module/admin.py index ee6be80ec..11888c660 100644 --- a/FusionIIIT/applications/office_module/admin.py +++ b/FusionIIIT/applications/office_module/admin.py @@ -1,7 +1,7 @@ from django.contrib import admin from .models import * - +admin.site.register(Project_Registration) admin.site.register(Requisitions) admin.site.register(Filemovement) admin.site.register(stock) diff --git a/FusionIIIT/applications/office_module/models.py b/FusionIIIT/applications/office_module/models.py index cc92cacb1..f6c8f2f13 100644 --- a/FusionIIIT/applications/office_module/models.py +++ b/FusionIIIT/applications/office_module/models.py @@ -184,6 +184,7 @@ class Project_Registration(models.Model): sponsored_agency = models.CharField(max_length=100) CO_PI = models.CharField(max_length=100 ,null=True) start_date = models.DateField(null=True,blank=True) + duration = models.CharField(default='0', max_length=100) agreement = models.CharField(choices=Constants.TICK_TYPE, max_length=10, default='NO') @@ -200,7 +201,7 @@ class Project_Registration(models.Model): max_length=10, default='Pending') applied_date=models.DateField(null=True,blank=True) description=models.CharField(max_length=200,null=True) - + file = models.FileField(null=True, upload_to='documents/') def __str__(self): return self.project_title diff --git a/FusionIIIT/applications/office_module/urls.py b/FusionIIIT/applications/office_module/urls.py index e0888271b..0f13c1531 100644 --- a/FusionIIIT/applications/office_module/urls.py +++ b/FusionIIIT/applications/office_module/urls.py @@ -19,7 +19,7 @@ url(r'^officeOfDeanRSPC/extention/$',views.project_extension,name='p_extension'), url(r'^officeOfDeanRSPC/close/$',views.project_closure,name='p_closure'), url(r'^officeOfDeanRSPC/reallocate/$',views.project_reallocation,name='p_reallocation'), - url(r'^officeOfDeanRSPC/action/$',views.project_registration_permission,name='registration'), + url(r'^officeOfDeanRSPC/action/$',views.project_registration_permission, name='registration'), url(r'^officeOfDeanRSPC/extension/$',views.project_extension_permission,name='extension'), url(r'^officeOfDeanRSPC/closure/$',views.project_closure_permission,name='closure'), url(r'^officeOfDeanRSPC/reallocation/$',views.project_reallocation_permission,name='reallocation'), diff --git a/FusionIIIT/applications/office_module/views.py b/FusionIIIT/applications/office_module/views.py index 79c98b0bc..8dd717960 100644 --- a/FusionIIIT/applications/office_module/views.py +++ b/FusionIIIT/applications/office_module/views.py @@ -1,5 +1,5 @@ import datetime -from datetime import date, datetime +from datetime import date, datetime, timedelta from django.contrib.auth import authenticate, login from django.contrib.auth.decorators import login_required @@ -12,19 +12,22 @@ from applications.globals.models import (Designation, ExtraInfo, HoldsDesignation, User) from applications.scholarships.models import Mcm - +from applications.eis.models import emp_research_projects, emp_patents, emp_consultancy_projects from .forms import * from .models import * from .models import (Project_Closure, Project_Extension, Project_Reallocation, Project_Registration) from .views_office_students import * - +@login_required def officeOfDeanRSPC(request): - project=Project_Registration.objects.all() - project1=Project_Extension.objects.all() - project2=Project_Closure.objects.all() - project3=Project_Reallocation.objects.all() + projects = emp_research_projects.objects.all().order_by('-start_date') + consultancy = emp_consultancy_projects.objects.all().order_by('-start_date') + patents = emp_patents.objects.all().order_by('-p_year', '-a_month') + project = Project_Registration.objects.all() + project1 = Project_Extension.objects.all() + project2 = Project_Closure.objects.all() + project3 = Project_Reallocation.objects.all() design = HoldsDesignation.objects.filter(working=request.user) print(design) @@ -32,7 +35,7 @@ def officeOfDeanRSPC(request): for i in design: desig.append(str(i.designation)) - context = {'project':project, 'project1':project1, 'project2':project2, 'project3':project3, 'desig':desig} + context = {'projects': projects, 'consultancy': consultancy, 'patents': patents, 'project': project, 'project1': project1, 'project2': project2, 'project3': project3, 'desig': desig} return render(request, "officeModule/officeOfDeanRSPC/officeOfDeanRSPC.html", context) @@ -272,20 +275,23 @@ def project_register(request): CO_PI = request.POST.get('copi_name') # start_date = datetime.strptime(request.POST.get('start_date'), "%Y-%m-%d") start_date = request.POST.get('start_date') + duration = request.POST.get('duration') #duration = datetime.timedelta('duration') agreement=request.POST.get('agreement') amount_sanctioned = request.POST.get('amount_sanctioned') project_type = request.POST.get('project_type') - remarks=request.POST.get('remarks') + #remarks=request.POST.get('remarks') #fund_recieved_date=datetime.strptime(request.POST.get('fund_recieved_date'), "%Y-%m-%d") project_operated = request.POST.get('project_operated') fund_recieved_date = request.POST.get('fund_recieved_date') + file = request.FILES['load'] + description = request.POST.get('remarks') request_obj = Project_Registration(PI_id=extrainfo, project_title=project_title, sponsored_agency=sponsored_agency, CO_PI=CO_PI, agreement=agreement, amount_sanctioned=amount_sanctioned, project_type=project_type, - remarks=remarks,duration=duration,fund_recieved_date=fund_recieved_date,start_date=start_date) + duration=duration,fund_recieved_date=fund_recieved_date,start_date=start_date, description=description, file=file) request_obj.save() context={} return render(request,"eisModulenew/profile.html",context) @@ -293,25 +299,57 @@ def project_register(request): # Project Registration Table End................................................................................. def project_registration_permission(request): + if 'approve' in request.POST: - id=request.POST.get('id') - obj=Project_Registration.objects.get(pk=id) - if obj.DRSPC_response == 'Pending': - obj.DRSPC_response='Approve' - obj.save() - elif 'forward' in request.POST: - id=request.POST.get('id') - obj=Project_Registration.objects.get(pk=id) - if obj.DRSPC_response == 'Pending': - obj.DRSPC_response='Forward' - obj.save() - elif 'reject' in request.POST: - id=request.POST.get('id') - obj=Project_Registration.objects.get(pk=id) - print(obj.DRSPC_response) - if obj.DRSPC_response == 'Pending': - obj.DRSPC_response='Disapprove' - obj.save() + id_list=request.POST.getlist('id[]') + for id in id_list: + obj=Project_Registration.objects.get(pk=id) + if "Pending" in obj.DRSPC_response or "Disapprove" in obj.DRSPC_response: + + + #approved project should be registered in project displayed to dean rspc + pf_no=obj.PI_id.id + pi = obj.PI_id.user.first_name + " " + obj.PI_id.user.last_name + co_pi = obj.CO_PI + title = obj.project_title + funding_agency = obj.sponsored_agency + start_date = obj.start_date + days = int(obj.duration)*7 + finish_date = start_date + timedelta(days=days) + financial_outlay = obj.amount_sanctioned + ptype = obj.project_type + print(ptype) + date_entry = obj.applied_date + status="Ongoing" + if ptype == "sponsoered research": + emp_projects = emp_research_projects(pi=pi, co_pi=co_pi, title=title, funding_agency=funding_agency, + start_date=start_date, finish_date=finish_date, date_entry=date_entry, + financial_outlay=financial_outlay, status=status, pf_no=pf_no, ptype=ptype) + emp_projects.save() + elif ptype == "consultancy": + emp_projects = emp_consultancy_projects(consultants=pi, title=title, client=funding_agency, + start_date=start_date, end_date=finish_date, + duration=obj.duration + " " + "weeks", financial_outlay=financial_outlay, + pf_no=pf_no, date_entry=date_entry) + emp_projects.save() + obj.DRSPC_response = "Approve" + obj.save() + + elif "forward" in request.POST: + id_list = request.POST.getlist('id[]') + for id in id_list: + obj=Project_Registration.objects.get(pk=id) + if obj.DRSPC_response == 'Pending': + obj.DRSPC_response="Forward" + obj.save() + elif "reject" in request.POST: + id_list = request.POST.getlist('id[]') + for id in id_list: + obj=Project_Registration.objects.get(pk=id) + #print(obj.DRSPC_response) + if obj.DRSPC_response == 'Pending': + obj.DRSPC_response="Disapprove" + obj.save() return HttpResponseRedirect('/office/officeOfDeanRSPC/') @@ -319,22 +357,22 @@ def project_extension_permission(request): if 'approve' in request.POST: id=request.POST.get('id') obj=Project_Extension.objects.get(pk=id) - if obj.DRSPC_response == 'Pending': - obj.DRSPC_response='Approve' - obj.save() + #if obj.DRSPC_response == 'Pending': + obj.DRSPC_response='Approve' + obj.save() elif 'forward' in request.POST: id=request.POST.get('id') obj=Project_Extension.objects.get(pk=id) - if obj.DRSPC_response == 'Pending': - obj.DRSPC_response='Forward' - obj.save() + #if obj.DRSPC_response == 'Pending': + obj.DRSPC_response='Forward' + obj.save() elif 'reject' in request.POST: id=request.POST.get('id') obj=Project_Extension.objects.get(pk=id) print(obj.DRSPC_response) - if obj.DRSPC_response == 'Pending': - obj.DRSPC_response='Disapprove' - obj.save() + #if obj.DRSPC_response == 'Pending': + obj.DRSPC_response='Disapprove' + obj.save() return HttpResponseRedirect('/office/officeOfDeanRSPC/') diff --git a/FusionIIIT/templates/dashboard/sidenavbar.html b/FusionIIIT/templates/dashboard/sidenavbar.html index a3c82d5e6..475152edd 100644 --- a/FusionIIIT/templates/dashboard/sidenavbar.html +++ b/FusionIIIT/templates/dashboard/sidenavbar.html @@ -100,14 +100,15 @@

File Tracking

{% comment %}The email Item ends here!{% endcomment %} -{% if "Dean (RSPC)" in desig %} + +{% comment %}if "Dean (RSPC)" in desig{% endcomment %} {% comment %}The Profile Item starts here!{% endcomment %} Office Of Dean RSPC +{% comment %}endif {% endcomment %} -{% endif %} Office Of Dean Academics diff --git a/FusionIIIT/templates/eisModulenew/profile.html b/FusionIIIT/templates/eisModulenew/profile.html index b8e608366..88b3c5a28 100644 --- a/FusionIIIT/templates/eisModulenew/profile.html +++ b/FusionIIIT/templates/eisModulenew/profile.html @@ -188,7 +188,8 @@ {% comment %}The others ends here!{% endcomment %} - {% comment %}The Thesis Supervision starts here!{% endcomment %} + + {% comment %}The Project management form starts here!{% endcomment %}
{% block form1 %} diff --git a/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Applications.html b/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Applications.html index 284bab295..751e1476a 100644 --- a/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Applications.html +++ b/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Applications.html @@ -6,16 +6,16 @@ Project Registration - + Project Closure - + Project Extension - + Fund Allocation
diff --git a/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Applications_content.html b/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Applications_content.html index 8cef095c7..e4404610f 100644 --- a/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Applications_content.html +++ b/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Applications_content.html @@ -1,5 +1,7 @@ {% load static %} +
{% csrf_token %}
+ + - - {% csrf_token %} - {% for pr in project %} - {% if pr.HOD_response == 'Forwarded'%} - + + {% for pr in project %} + + {% comment %}if pr.HOD_response == 'Forwarded' {% endcomment %} + - - - - - - - {% endif %} + {% comment %} endif {% endcomment %} {% endfor%} @@ -123,13 +134,13 @@
@@ -31,51 +34,59 @@ Date - view Details + View Details
-
- -
+ {% if "Dean (R&D)" in desig %} + + {% endif %}
- {{pr.PI_id}} + + {{pr.PI_id.user.first_name}} {{pr.PI_id.user.last_name}} + {{pr.project_title}} + {{pr.project_type}} - {{pr.DRSPC_response}} + + {% if pr.DRSPC_response == "Approve" %} + {{pr.DRSPC_response}} + {% elif pr.DRSPC_response == "Pending" %} + {{pr.DRSPC_response}} + {% elif pr.DRSPC_response == "Disapprove" %} + {{pr.DRSPC_response}} + {% elif pr.DRSPC_response == "Forward" %} + {{pr.DRSPC_response}} + {% endif %} + {{pr.start_date}} + Details
-
-{% if "Dean (RSPC)" in desig %} - +{% if "Dean (R&D)" in desig %} + + {% endif %} @@ -137,7 +148,6 @@ {% endif %} --> -

diff --git a/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Project_extension_content.html b/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Project_extension_content.html index 8a5e4f73c..f7051a681 100644 --- a/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Project_extension_content.html +++ b/FusionIIIT/templates/officeModule/officeOfDeanRSPC/Project_extension_content.html @@ -40,7 +40,7 @@
{% csrf_token %} {% for pr in project1 %} - {% if pr.HOD_response == 'Forwarded'%} + {%comment%} if pr.HOD_response == 'Forwarded'{%endcomment%} @@ -74,7 +74,15 @@ - {{pr.DRSPC_response}} + {% if pr.DRSPC_response == "Approve" %} + {{pr.DRSPC_response}} + {% elif pr.DRSPC_response == "Pending" %} + {{pr.DRSPC_response}} + {% elif pr.DRSPC_response == "Disapprove" %} + {{pr.DRSPC_response}} + {% elif pr.DRSPC_response == "Forward" %} + {{pr.DRSPC_response}} + {% endif %} @@ -90,7 +98,7 @@ - {% endif %} + {%comment%} endif {%endcomment%} {% endfor%} @@ -143,7 +151,7 @@ -{% if "Dean (RSPC)" in desig %} +{% if "Dean (R&D)" in desig %} +
+ + {% if obj.file.size is not 0 %} + Attached File + {% else %} + + {% endif %} +
+
- +