added addIssue endpoint and updated offeraccepted
This commit is contained in:
parent
62033249e9
commit
37615876d6
|
@ -149,12 +149,17 @@ def updateOfferAccepted(request, id, email, user_type):
|
|||
opening_type= data[OPENING_TYPE]
|
||||
else:
|
||||
opening_type= "Placement"
|
||||
if DEADLINE_DATETIME in data:
|
||||
deadline_datetime = datetime.datetime.strptime(data[DEADLINE_DATETIME], '%Y-%m-%d %H:%M:%S %z')
|
||||
else:
|
||||
deadline_datetime = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) + datetime.timedelta(days=2)
|
||||
if opening_type == "Internship":
|
||||
opening = get_object_or_404(Internship, pk=data[OPENING_ID])
|
||||
else:
|
||||
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
|
||||
if opening.offer_accepted is None:
|
||||
opening.offer_accepted = offer_accepted == "true"
|
||||
opening.deadline_datetime = deadline_datetime
|
||||
opening.changed_by = get_object_or_404(User, id=id)
|
||||
opening.save()
|
||||
if opening.offer_accepted:
|
||||
|
|
|
@ -73,6 +73,10 @@ CDC_REPS_EMAILS = [
|
|||
"suvamay.jana@iitdh.ac.in",
|
||||
"ramesh.nayaka@iitdh.ac.in"
|
||||
]
|
||||
CDC_REPS_EMAILS_FOR_ISSUE=[ #add reps emails
|
||||
"support.cdc@iitdh.ac.in"
|
||||
"irontwist00@gmail.com"
|
||||
]
|
||||
|
||||
# To be Configured Properly
|
||||
CLIENT_ID = os.environ.get('GOOGLE_OAUTH_CLIENT_ID') # Google Login Client ID
|
||||
|
@ -207,7 +211,9 @@ APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone N
|
|||
'Resume', 'Selected', ]
|
||||
|
||||
|
||||
|
||||
ISSUE_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Issue Submitted'
|
||||
STUDENT_ISSUE_SUBMITTED_TEMPLATE = 'student_issue_submitted.html'
|
||||
REPS_ISSUE_SUBMITTED_TEMPLATE = 'reps_issue_submitted.html'
|
||||
# Internships
|
||||
INTERNSHIP = 'Internship'
|
||||
INTERNSHIP_ID = 'internship_id'
|
||||
|
@ -225,6 +231,7 @@ FACILITIES = 'facilities'
|
|||
OTHER_FACILITIES = 'other_facilities'
|
||||
STIPEND_DETAILS_PDF = 'compensation_details_pdf'
|
||||
STIPEND_DETAILS_PDF_NAMES = 'stipend_description_pdf_names'
|
||||
INTERNSHIP_OPENING_URL = "https://cdc.iitdh.ac.in/portal/student/dashboard/internships/{id}" # On frontend, this is the URL to be opened
|
||||
|
||||
SEASONS = (
|
||||
'Summer',
|
||||
|
|
|
@ -479,3 +479,30 @@ class Contributor(models.Model):
|
|||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Issues(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
title = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="")
|
||||
description = models.CharField(max_length=200, blank=False, default="")
|
||||
opening=(models.ForeignKey(Placement, on_delete=models.CASCADE, blank=False) or models.ForeignKey(Internship, on_delete=models.CASCADE, blank=False))
|
||||
#status = models.CharField(max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, blank=False, default="")
|
||||
student=models.ForeignKey(Student, on_delete=models.CASCADE, blank=False)
|
||||
created_at = models.DateTimeField(blank=False, default=None, null=True)
|
||||
updated_at = models.DateTimeField(blank=False, default=None, null=True)
|
||||
changed_by = models.ForeignKey(User, on_delete=models.RESTRICT, blank=True, null=True)
|
||||
history = HistoricalRecords(user_model=User)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
''' On save, add timestamps '''
|
||||
if not self.created_at:
|
||||
self.created_at = timezone.now()
|
||||
self.updated_at = timezone.now()
|
||||
|
||||
return super(Issues, self).save(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return self.title + " - " + self.student.name
|
||||
class Meta:
|
||||
verbose_name_plural = "Issues"
|
||||
|
|
@ -3,14 +3,14 @@ from django.urls import path
|
|||
from . import studentViews
|
||||
|
||||
urlpatterns = [
|
||||
path('login/', studentViews.login, name="Login"), #done for intern
|
||||
path('profile/', studentViews.studentProfile, name="Student Profile"), #done for intern
|
||||
path('getDashboard/', studentViews.getDashboard, name="Dashboard"), # customised dashboard.. check are we checking registedred check allowed branch/batches filter in
|
||||
path("addResume/", studentViews.addResume, name="Upload Resume"), #done for intern
|
||||
path("deleteResume/", studentViews.deleteResume, name="Upload Resume"),#done for intern
|
||||
path("submitApplication/", studentViews.submitApplication, name="Submit Application"), #done for intern
|
||||
path("deleteApplication/", studentViews.deleteApplication, name="Delete Application"), #done for intern check for opening type data in headers
|
||||
path('login/', studentViews.login, name="Login"),
|
||||
path('profile/', studentViews.studentProfile, name="Student Profile"),
|
||||
path('getDashboard/', studentViews.getDashboard, name="Dashboard"),
|
||||
path("addResume/", studentViews.addResume, name="Upload Resume"),
|
||||
path("deleteResume/", studentViews.deleteResume, name="Delete Resume"),
|
||||
path("submitApplication/", studentViews.submitApplication, name="Submit Application"),
|
||||
path("deleteApplication/", studentViews.deleteApplication, name="Delete Application"),
|
||||
path("getContributorStats/", studentViews.getContributorStats, name="Get Contributor Stats"),
|
||||
path("studentAcceptOffer/", studentViews.studentAcceptOffer, name="Student Accept Offer"), #same as above check header
|
||||
path("studentAcceptOffer/", studentViews.studentAcceptOffer, name="Student Accept Offer"),
|
||||
path("addIssue/",studentViews.addIssue,name= "Add Issue")
|
||||
]
|
||||
#store all files..
|
|
@ -347,3 +347,51 @@ def studentAcceptOffer(request, id, email, user_type):
|
|||
|
||||
return Response({'action': "Accept Offer", 'message': "Something Went Wrong"},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
#view for addIssue
|
||||
|
||||
@api_view(['POST'])
|
||||
@isAuthorized(allowed_users=[STUDENT])
|
||||
@precheck(required_data=["Title","Description","opening_id"])
|
||||
def addIssue(request, id, email, user_type):
|
||||
try:
|
||||
data = request.data
|
||||
student = get_object_or_404(Student, id=id)
|
||||
issue = Issues()
|
||||
issue.student = student
|
||||
issue.title = data["Title"]
|
||||
issue.description = data["Description"]
|
||||
# issue.opening=get_object_or_404(Placement, id=data["opening_id"]) or get_object_or_404(Internship, id=data["opening_id"])
|
||||
try:
|
||||
issue.opening=get_object_or_404(Placement, id=data["opening_id"])
|
||||
except:
|
||||
try:
|
||||
issue.opening=get_object_or_404(Internship, id=data["opening_id"])
|
||||
except:
|
||||
return Response({'action': "Add Issue", 'message': "Opening Not Found"},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
issue.save()
|
||||
subject=ISSUE_SUBMITTED_TEMPLATE_SUBJECT
|
||||
data={
|
||||
"name":student.name,
|
||||
"application_type":PLACEMENT if isinstance(issue.opening,Placement) else INTERNSHIP,
|
||||
"company_name":issue.opening.company_name,
|
||||
"additional_info":{
|
||||
"Title":issue.title,
|
||||
"Description":issue.description
|
||||
},
|
||||
"email":email
|
||||
}
|
||||
sendEmail(email, subject, data, STUDENT_ISSUE_SUBMITTED_TEMPLATE)
|
||||
#send_mail_to reps
|
||||
sendEmail(CDC_REPS_EMAILS_FOR_ISSUE,"Issue Raised",data,REPS_ISSUE_SUBMITTED_TEMPLATE)
|
||||
return Response({'action': "Add Issue", 'message': "Issue Added"},
|
||||
status=status.HTTP_200_OK)
|
||||
except Http404:
|
||||
return Response({'action': "Add Issue", 'message': 'Student Not Found'},
|
||||
status=status.HTTP_404_NOT_FOUND)
|
||||
except:
|
||||
logger.warning("Add Issue: " + str(sys.exc_info()))
|
||||
return Response({'action': "Add Issue", 'message': "Something Went Wrong"},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
|
@ -428,7 +428,7 @@ def send_opening_notifications(opening_id, opening_type=PLACEMENT):
|
|||
"opening_type": "INTERNSHIP" if isinstance(opening, Internship) else "PLACEMENT",
|
||||
"designation": opening.designation,
|
||||
"deadline": deadline_datetime.strftime("%A, %-d %B %Y, %-I:%M %p"),
|
||||
"link": PLACEMENT_OPENING_URL.format(id=opening.designation)
|
||||
"link": PLACEMENT_OPENING_URL.format(id=opening.designation) if opening_type == PLACEMENT else INTERNSHIP_OPENING_URL.format(id=opening.designation),
|
||||
}
|
||||
emails.append(student_user.email)
|
||||
#sendEmail(student_user.email, subject, data, NOTIFY_STUDENTS_OPENING_TEMPLATE)
|
||||
|
@ -451,7 +451,7 @@ def exception_email(opening):
|
|||
"company_name": opening["company_name"],
|
||||
}
|
||||
pdfhtml = opening_description_table_html(opening)
|
||||
name = opening["company_name"] + '_jnf_response.pdf'
|
||||
name = opening["company_name"] + '_jnf_response.pdf' if opening[OPENING_TYPE]!="INF" else opening["company_name"] + '_inf_response.pdf'
|
||||
attachment_jnf_respone = {
|
||||
"name": name,
|
||||
"html": pdfhtml,
|
||||
|
@ -474,6 +474,10 @@ def store_all_files(request):
|
|||
for file in files.getlist(COMPENSATION_DETAILS_PDF):
|
||||
file_location = STORAGE_DESTINATION_COMPANY_ATTACHMENTS + "temp" + '/'
|
||||
saveFile(file, file_location)
|
||||
#stipend details pdf for internships
|
||||
for file in files.getlist(STIPEND_DETAILS_PDF):
|
||||
file_location = STORAGE_DESTINATION_COMPANY_ATTACHMENTS + "temp" + '/'
|
||||
saveFile(file, file_location)
|
||||
# selection procedure details pdf
|
||||
for file in files.getlist(SELECTION_PROCEDURE_DETAILS_PDF):
|
||||
file_location = STORAGE_DESTINATION_COMPANY_ATTACHMENTS + "temp" + '/'
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<title></title>
|
||||
<!--[if mso]>
|
||||
<noscript>
|
||||
<xml>
|
||||
<o:OfficeDocumentSettings>
|
||||
<o:PixelsPerInch>96</o:PixelsPerInch>
|
||||
</o:OfficeDocumentSettings>
|
||||
</xml>
|
||||
</noscript>
|
||||
<![endif]-->
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link rel="shortcut icon" href="favicon.ico"/>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
table, td, div, h1, p {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;">
|
||||
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
|
||||
<tr>
|
||||
<td align="center" style="padding:0;">
|
||||
<table role="presentation"
|
||||
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
|
||||
<tr>
|
||||
<td align="center" style="padding:40px 0 30px 0;background:#334878;">
|
||||
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
|
||||
style="height:auto;display:block;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:36px 30px 42px 30px;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="padding:0 0 36px 0;color:#153643;">
|
||||
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
|
||||
">Hello, Folks</h1>
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
|
||||
We have received a issue regarding a <b>{{ application_type }}</b> opening at
|
||||
<b>
|
||||
{{ company_name }}</b> From {{name}}.
|
||||
{% if additional_info_items %}
|
||||
We received these additional details
|
||||
<br>
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:
|
||||
'Roboto', sans-serif;text-align: center">
|
||||
|
||||
<table style="border:solid 1px; margin: auto; text-align: center;width: 80%;
|
||||
border-radius:15px; background-color: #e0e3ee">
|
||||
|
||||
{% for i,j in additional_info.items %}
|
||||
|
||||
<tr>
|
||||
<td style="padding:8px 10px;color:#153643; ">{{ i }}:</td>
|
||||
<td style="padding:8px 10px;color:#153643;">{{ j }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
</p>
|
||||
</p>
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
|
||||
please look into it and take necessary actions.
|
||||
get in touch with the student at at <nobr><u>{{ email }}</u></nobr>
|
||||
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="width:260px;padding:0;vertical-align:top;color:#334878;">
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:30px;background:#334878;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;font-size:9px;font-family: 'Roboto', sans-serif;">
|
||||
<tr>
|
||||
<td style="padding:0;width:50%;" align="left">
|
||||
<p style="margin:0;font-size:14px;line-height:16px;font-family: 'Roboto', sans-serif;color:#ffffff;">
|
||||
® CDC,IIT Dharwad,2021<br/>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,118 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<title></title>
|
||||
<!--[if mso]>
|
||||
<noscript>
|
||||
<xml>
|
||||
<o:OfficeDocumentSettings>
|
||||
<o:PixelsPerInch>96</o:PixelsPerInch>
|
||||
</o:OfficeDocumentSettings>
|
||||
</xml>
|
||||
</noscript>
|
||||
<![endif]-->
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link rel="shortcut icon" href="favicon.ico"/>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
table, td, div, h1, p {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;">
|
||||
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
|
||||
<tr>
|
||||
<td align="center" style="padding:0;">
|
||||
<table role="presentation"
|
||||
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
|
||||
<tr>
|
||||
<td align="center" style="padding:40px 0 30px 0;background:#334878;">
|
||||
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
|
||||
style="height:auto;display:block;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:36px 30px 42px 30px;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="padding:0 0 36px 0;color:#153643;">
|
||||
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
|
||||
">Hello, {{ name }}</h1>
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
|
||||
We have received your issue regarding a <b>{{ application_type }}</b> opening at
|
||||
<b>
|
||||
{{ company_name }}</b>.
|
||||
{% if additional_info_items %}
|
||||
We received these additional details
|
||||
<br>
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:
|
||||
'Roboto', sans-serif;text-align: center">
|
||||
|
||||
<table style="border:solid 1px; margin: auto; text-align: center;width: 80%;
|
||||
border-radius:15px; background-color: #e0e3ee">
|
||||
|
||||
{% for i,j in additional_info.items %}
|
||||
|
||||
<tr>
|
||||
<td style="padding:8px 10px;color:#153643; ">{{ i }}:</td>
|
||||
<td style="padding:8px 10px;color:#153643;">{{ j }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
</p>
|
||||
</p>
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
|
||||
We will get back to you if we find it legitimate. If you have any queries, please
|
||||
feel to
|
||||
write to
|
||||
<nobr><u>cdc.support@iitdh.ac.in</u></nobr>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="width:260px;padding:0;vertical-align:top;color:#334878;">
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:30px;background:#334878;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;font-size:9px;font-family: 'Roboto', sans-serif;">
|
||||
<tr>
|
||||
<td style="padding:0;width:50%;" align="left">
|
||||
<p style="margin:0;font-size:14px;line-height:16px;font-family: 'Roboto', sans-serif;color:#ffffff;">
|
||||
® CDC,IIT Dharwad,2021<br/>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue