Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1fcc71a
changed urls and views according to new frontend
Anitesh2004 Oct 21, 2024
e315e89
Merge pull request #1 from Anitesh2004/gad-6
ShashankShekhar07 Oct 22, 2024
39e4f8e
changed indentview api to work with new frontend
Anitesh2004 Oct 22, 2024
ace1746
Merge pull request #3 from Anitesh2004/gad-6
ShashankShekhar07 Oct 22, 2024
166d0ed
[feat]: added controllers for viewing and deleting indents
ShashankShekhar07 Oct 23, 2024
e094c08
forward indent apis completed
Anitesh2004 Nov 14, 2024
746c67a
Merge pull request #7 from Anitesh2004/gad-6
ShashankShekhar07 Nov 14, 2024
a571c26
Added Archieved indent controller (#8)
Ritik8527 Nov 18, 2024
6f28068
added approval functionality in indent,bill approval
ShashankShekhar07 Nov 19, 2024
969b0d5
Dynamic user access for outbox indents and archieve view. (#9)
Himanshu8850 Nov 20, 2024
a4ccf87
Integrated notifications (#10)
Anitesh2004 Nov 20, 2024
4221543
updated backend
ShashankShekhar07 Jan 9, 2025
31955e1
Gad 6 (#12)
Pheonix7113 Mar 24, 2025
c212574
fixed stock entry
ShashankShekhar07 Mar 24, 2025
3c1a69c
Test os 3 (#1700)
aarav0012 Jan 27, 2025
0764b02
Dashboard client (#1697)
shramanpaul Jan 28, 2025
2e2a7eb
All changes of Complaint Management (#1704)
Charan2437 Feb 4, 2025
f922a63
eis module version 1 (#1706)
RameshBabuAsh Feb 4, 2025
e305a62
Minor changes for integration with frontend
pred695 Nov 16, 2024
efe2a4d
fix: some minor fixes
pred695 Nov 20, 2024
195f999
minor fixes
pred695 Nov 20, 2024
b0369dd
add: updated urls.py and file upload
pred695 Nov 21, 2024
82b8889
fix: multiple file uploads, and ajax dropdown cbv
pred695 Feb 10, 2025
bad86bd
add: added multiple drafts upload
pred695 Feb 12, 2025
01624de
fix: uncommented mess migrations
pred695 Feb 16, 2025
57fb6fd
Department module Version 1 (#1709)
Vithesh2215 Feb 17, 2025
7129c6f
[Dashboard] Modified Profile views to fetch relevant data only (#1711)
Pratik2026 Feb 19, 2025
f6c3444
SA-2 [New-UI] - updated APIs for use with fusion-client (#1717)
Adi8712 Mar 4, 2025
ee87bef
SA-2 new UI updates (#1718)
Adi8712 Mar 4, 2025
083d955
Old version(gad 2) (#1721)
dcoder13 Mar 18, 2025
6f47954
Revert "Old version(gad 2) (#1721)" (#1723)
dcoder13 Mar 18, 2025
3f34917
Gad 2 (Request based system) (#1726)
dcoder13 Mar 18, 2025
9d00b59
SPACS Module version 1 (#1722)
AkashPaloju Mar 20, 2025
9cefeff
Dashboard client (#1727)
ChallaBharadwajReddy Mar 21, 2025
a14f348
Dev gymkhana merge into dashboard : SA-3 GYMKHANA MODULE (#1729)
RISHIKESHk07 Mar 23, 2025
b3e5397
Merge branch 'dashboard_client' into gad-6
ShashankShekhar07 Mar 24, 2025
89cb10a
fix : remove migration
ShashankShekhar07 Mar 24, 2025
120dc51
Delete Test/Fusion Automation Testing/.settings/org.eclipse.jdt.apt.c…
dcoder13 Mar 24, 2025
4cb94f4
updated stockentry
ShashankShekhar07 Apr 11, 2025
fab51d3
Merge branch 'gad-6' of https://github.com/ShashankShekhar07/Fusion i…
ShashankShekhar07 Apr 11, 2025
4d3ce11
fix : merge
ShashankShekhar07 Apr 14, 2025
370825f
fixed model
ShashankShekhar07 Apr 14, 2025
f39af68
fixed migrations
ShashankShekhar07 Apr 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ class Migration(migrations.Migration):
name='img',
field=models.ImageField(default=None, upload_to='mess/images/registration_request/%Y/%m/%d/'),
),
]
]
2 changes: 1 addition & 1 deletion FusionIIIT/applications/filetracking/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def post(self, request):
class ViewFileView(APIView):
authentication_classes = [TokenAuthentication]
permission_classes = [permissions.IsAuthenticated]

def get(self, request, file_id):
try:
file_details = view_file(int(file_id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,4 @@ class Migration(migrations.Migration):
('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')),
],
),
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class Migration(migrations.Migration):
name='verified',
field=models.BooleanField(default=False),
),
]
]
1 change: 1 addition & 0 deletions FusionIIIT/applications/ps1/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@
path('archieveview/<str:username>/', views.archieveview, name='archievedview'),
path('outboxview2/<str:username>/', views.outboxview2, name='outboxview2'),
path('stockEntry/<str:username>/', views.stockEntry, name='stock-entry'),
path('my-indents/<str:username>/', views.my_indents_view, name='my-indents-view'),
]
126 changes: 85 additions & 41 deletions FusionIIIT/applications/ps1/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from notification.views import office_module_notif
from django.contrib import messages
from django.contrib.auth.models import User
from notification.views import purchase_notif,iwd_notif
from applications.filetracking.sdk.methods import *
from datetime import datetime
from django.http import HttpResponseForbidden,JsonResponse
Expand Down Expand Up @@ -52,26 +53,6 @@ def getDesignations(request):

@api_view(['POST'])
@permission_classes([IsAuthenticated])
# def getOneFiledIndent(request):
# try:
# file_id = request.data.get('file_id')
# # console.log(file_id)
# indent = IndentFile.objects.get(file_info_id=file_id)
# fileinfo = File.objects.get(pk=file_id)
# # console.log(indent)
# serializer = IndentFileSerializer(indent)
# serializer_file = FileSerializer(fileinfo)
# department = request.user.extrainfo.department.name
# return Response({
# 'indent': serializer.data,
# 'file': serializer_file.data,
# 'department': department
# }, status=status.HTTP_200_OK)
# # return Response(serializer.data, status=status.HTTP_200_OK)
# except IndentFile.DoesNotExist:
# return Response({"error": "Indent not found."}, status=status.HTTP_404_NOT_FOUND)
# except Exception as e:
# return Response({"error": str(e)}, status=status.HTTP_400_BAD_REQUEST)
def getOneFiledIndent(request):
try:
file_id = request.data.get('file_id')
Expand Down Expand Up @@ -101,6 +82,7 @@ def getOneFiledIndent(request):




@api_view(['POST'])
@permission_classes([IsAuthenticated])
def delete_indent(request):
Expand Down Expand Up @@ -165,7 +147,6 @@ def createDraft(request):
file_extra_JSON={"value": 2},
attached_file=upload_file
)

# Create IndentFile object
indent_file = IndentFile.objects.create(
file_info=get_object_or_404(File, pk=file_id),
Expand Down Expand Up @@ -199,10 +180,6 @@ def createDraft(request):
'message': 'Indent Filed Successfully!',
}, status=status.HTTP_201_CREATED)

# except HoldsDesignation.DoesNotExist:
# return Response({
# 'error': 'The specified designation does not exist.'
# }, status=status.HTTP_404_NOT_FOUND)

except Exception as e:
return Response({
Expand Down Expand Up @@ -337,7 +314,7 @@ def draftView(request, username):
indents = IndentFile.objects.filter(file_info__in=request.user.extrainfo.uploaded_files.all()).select_related('file_info')
department = request.user.extrainfo.department.name
# print("gaurva")
print(department)
print(department)
indent_ids = [indent.file_info for indent in indents]
filed_indents = Tracking.objects.filter(file_id__in=indent_ids)
filed_indent_ids = [indent.file_id for indent in filed_indents]
Expand Down Expand Up @@ -427,7 +404,7 @@ def ForwardIndentFile(request, id):
print('hdfjaldfalk' , request.data)
try:
indent = IndentFile.objects.select_related('file_info').get(file_info=id)
file = indent.file_info
file = indent.file_info_id
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)
except IndentFile.DoesNotExist:
return Response({"message": "Indent file does not exist"}, status=status.HTTP_404_NOT_FOUND)
Expand Down Expand Up @@ -496,6 +473,7 @@ def ForwardIndentFile(request, id):
return Response({"message": "Method not allowed"}, status=status.HTTP_405_METHOD_NOT_ALLOWED)



@api_view(['GET'])
@permission_classes([IsAuthenticated])
def archieve_file(request,id):
Expand Down Expand Up @@ -557,6 +535,7 @@ def entry(request,id):
except IndentFile.DoesNotExist:
return Response({"message": "Corresponding indent file does not exist"}, status=status.HTTP_404_NOT_FOUND)


@api_view(['GET'])
@permission_classes([IsAuthenticated])
def stockEntryView(request,id):
Expand Down Expand Up @@ -954,7 +933,7 @@ def stockEntry(request,username):
print("location-",location)
try:
# temp1 = File.objects.get(id=id)
temp = IndentItem.objects.get(indent_file_id=id)
temp = IndentItem.objects.get(id=id)
except (File.DoesNotExist, IndentFile.DoesNotExist):
return Response({"message": "File with given ID does not exist"}, status=status.HTTP_404_NOT_FOUND)

Expand Down Expand Up @@ -987,12 +966,13 @@ def forwardIndent(request, id):
try:
indent=IndentFile.objects.select_related('file_info').get(file_info=id)
file=indent.file_info

print("file details",file);
upload_file = request.FILES.get('file')
receiverName = request.data.get('forwardTo')
receiver_id = User.objects.get(username=receiverName)
receive_design = request.data.get('receiverDesignation')
remarks = request.data.get('remarks')
print("remarks",remarks);
sender_designation_name = request.data.get('role')
# vkjain -> director
print(receiver_id) #bhartenduks
Expand All @@ -1012,20 +992,25 @@ def forwardIndent(request, id):
remarks=remarks,
file_attachment=upload_file
)

office_module_notif(request.user, receiver_id)
print("noti",request.user);
print("noti2",receiver_id);
# iwd_notif(request.user, receiver_id, "Request_added")
purchase_notif(request.user,receiver_id)
# office_module_notif(request.user, receiver_id)
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 ["Professor","Accounts Admin"]) and indent.purchased==True):
elif ((sender_designation_name in ["Director","Registrar"]) and (str(receive_design) in ["ps_admin"]) ):
indent.director_approval=True
indent.financial_approval=True
elif ((sender_designation_name in ["Director","Registrar"]) and (str(receive_design) in ["Professor"]) ):
indent.director_approval=True
elif ((sender_designation_name in ["Professor"]) and (str(receive_design) in ["ps_admin"] )):
elif ((sender_designation_name in ["Professor","Assistant Professor"]) and (str(receive_design) in ["ps_admin"] )):
indent.purchased=True
elif ((sender_designation_name in ["ps_admin"]) and str(receive_design) in ["Director","Registrar"]):
indent.head_approval=True
elif ((sender_designation_name in ["Director","Registrar"]) and (str(receive_design) in ["Professor","Accounts Admin","Assistant Professor"]) and indent.purchased==True):
print("financial approval");
indent.director_approval=True
indent.financial_approval=True

# elif ((sender_designation_name in ["ps_admin"]) and str(receive_design) in ["Director","Registrar"]):
# indent.head_approval=True
# 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

Expand Down Expand Up @@ -1111,8 +1096,7 @@ def createProposal(request):
sources_of_supply=item.get('sources_of_supply', ''),
)

# Notify the receiver
office_module_notif(request.user, receiver)
purchase_notif(request.user,receiver)

# Auto-approve if receiver is 'ps_admin'
if receiver_designation == "ps_admin":
Expand Down Expand Up @@ -1148,4 +1132,64 @@ def user_suggestions(request):
# user = Faculty.objects.all().values('id')
# print(users)
# print(user)
return JsonResponse({'users': list(users)})
return JsonResponse({'users': list(users)})

@api_view(['GET'])
@permission_classes([IsAuthenticated])
def my_indents_view(request, username):
try:
# Validate user
user = User.objects.get(username=username)
if user != request.user:
return Response({'error': 'Unauthorized access'}, status=status.HTTP_403_FORBIDDEN)

# Get all files created by this user
created_files = File.objects.filter(uploader=user.extrainfo).order_by('-upload_date')

# Get associated indent files
indent_files = IndentFile.objects.filter(
file_info__in=created_files
).select_related(
'file_info'
).prefetch_related(
'items'
).order_by('-file_info__upload_date')

# Serialize the data
data = []
for indent in indent_files:
# Get last tracking info if exists
tracking = Tracking.objects.filter(file_id=indent.file_info_id).select_related(
'receiver_id'
).last()

indent_data = {
'id': indent.file_info_id,
'indent_name': indent.indent_name,
'description': indent.description,
'upload_date': indent.file_info.upload_date,
'status': {
'head_approval': indent.head_approval,
'director_approval': indent.director_approval,
'financial_approval': indent.financial_approval,
'purchased': indent.purchased
},
'current_receiver': tracking.receiver_id.username if tracking else None,
'items': [{
'name': item.item_name,
'quantity': item.quantity,
'estimated_cost': item.estimated_cost
} for item in indent.items.all()]
}
data.append(indent_data)

return Response({
'count': len(data),
'results': data,
'department': user.extrainfo.department.name
})

except User.DoesNotExist:
return Response({'error': 'User not found'}, status=status.HTTP_404_NOT_FOUND)
except Exception as e:
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)
9 changes: 5 additions & 4 deletions FusionIIIT/applications/ps1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class IndentFile(models.Model):
director_approval = models.BooleanField(default=False)
financial_approval = models.BooleanField(default=False)
purchased = models.BooleanField(default=False)

class Meta:
db_table = 'IndentFile'

Expand All @@ -37,7 +36,6 @@ class IndentItem(models.Model):

class Meta:
db_table = 'IndentItem'

class Constants:
Locations = (
('SR1', 'LHTC'),
Expand Down Expand Up @@ -112,6 +110,9 @@ def create_stock_items(sender, instance, created, **kwargs):
if created:
# Automatically create 'n' number of StockItem instances based on current_stock of StockEntry
# instance is stockEntry
department = instance.item_id.indent_file.file_info.uploader.department
current_stock = int(instance.current_stock)
for _ in range(current_stock):
StockItem.objects.create(StockEntryId=instance,location=instance.location,department=instance.item_id.file_info.uploader.department)
for _ in range(current_stock):
StockItem.objects.create(StockEntryId=instance,location=instance.location,department=department)
# for _ in range(current_stock):
# StockItem.objects.create(StockEntryId=instance,location=instance.location,department=instance.item_id.file_info.uploader.department)
6 changes: 6 additions & 0 deletions FusionIIIT/notification/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,4 +714,10 @@ def iwd_notif(sender,recipient,type):
verb = "Request approved by " + sender.username + "."
if type == "Request_rejected":
verb = "Request rejected by " + sender.username + "."
notify.send(sender=sender,recipient=recipient,url=url,module=module,verb=verb)

def purchase_notif(sender,recipient):
module= 'purchase-and-store'
url= 'purchase'
verb="A new Indent Received"
notify.send(sender=sender,recipient=recipient,url=url,module=module,verb=verb)