Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e74b53c
Began implementing changes for the withdrawal functionality for CCEMinor
Kafui123 Feb 27, 2025
160d47c
Changes to withdrawal functionality
Kafui123 Feb 28, 2025
973429c
Worked on withdrawal functionality for proposal....yet to implement t…
Kafui123 Mar 2, 2025
6a91a51
SET up ajax request and routes to handle withdrawal functionality
Kafui123 Mar 3, 2025
ffae90d
Further implementations
Kafui123 Mar 3, 2025
2934541
Changes
Kafui123 Mar 3, 2025
31797bf
Changes
Kafui123 Mar 3, 2025
27d1591
Withdrawal functionality works now
Kafui123 Mar 4, 2025
f38771c
Withdrawal functionality has been successfully implemented
Kafui123 Mar 5, 2025
616915e
Cleaned up code
Kafui123 Mar 6, 2025
d3a2622
Changes
Kafui123 Mar 6, 2025
f55f2f4
Changes
Kafui123 Mar 6, 2025
013c017
Preliminary changes for testing withdrawal functionality
Kafui123 Mar 6, 2025
d900e02
Changes
Kafui123 Mar 7, 2025
8656c23
Testing for withdrawal functionality
Kafui123 Mar 7, 2025
18a351f
Testing for withdrawal functionality
Kafui123 Mar 7, 2025
a4ddabf
Changes
Kafui123 Mar 12, 2025
18299d2
Merge branch '1411_OtherEngagementFiles' into 1397_WithdrawalFunction…
bledsoef Mar 17, 2025
752a765
Further changes
Kafui123 Mar 17, 2025
458dd12
Changes to Withdraw Functionality
Kafui123 Mar 17, 2025
602e23a
Tests for saving files in manage proposals
Kafui123 Mar 18, 2025
f6e7c82
Testing removal functionality of uploaded file
Kafui123 Mar 20, 2025
8ba3220
Further implementations
Kafui123 Mar 21, 2025
188e5c5
Testing file changes
Kafui123 Mar 22, 2025
ccc7f5a
Withdrawal Functionality done and dusted
Kafui123 Mar 24, 2025
54bc761
Resolved an issue
Kafui123 Mar 25, 2025
d21e53c
Changes to Lawrence's code
Kafui123 Mar 27, 2025
931cd9b
cleaned up testing suite
bledsoef Mar 28, 2025
7b086f6
fixed merge conflicts
bledsoef Mar 28, 2025
47e4c7e
made withdrawing take you back to the manageproposals tab
bledsoef Mar 28, 2025
32a3313
Fixed bracket issue
Kafui123 Apr 7, 2025
40a1099
resolved conflicts
bledsoef Apr 8, 2025
fc1ae9b
fixed reload problems
bledsoef Apr 8, 2025
bbd30e0
fixed summer experience bug
bledsoef Apr 8, 2025
db0963e
added required labels
bledsoef Apr 8, 2025
9507785
Changes to select action
Kafui123 Apr 8, 2025
e59174c
changes
Kafui123 Apr 8, 2025
f1129ea
Merge branch '1397_WithdrawalFunctionality' of github.com:BCStudentSo…
Kafui123 Apr 8, 2025
ebcf93b
Changes
Kafui123 Apr 8, 2025
5e00087
Merge branch 'development' into 1397_WithdrawalFunctionality
Kafui123 Apr 14, 2025
c7580c1
Merge branch 'development' into 1397_WithdrawalFunctionality
bledsoef Apr 17, 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
17 changes: 16 additions & 1 deletion app/controllers/minor/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from app.models.term import Term
from app.logic.fileHandler import FileHandler
from app.logic.utils import selectSurroundingTerms, getFilesFromRequest
from app.logic.minor import createOtherEngagementRequest, setCommunityEngagementForUser, getSummerExperience, getEngagementTotal, createSummerExperience, getProgramEngagementHistory, getCourseInformation, getCommunityEngagementByTerm, getCCEMinorProposals, createOtherEngagementRequest, getMinorSpreadsheet
from app.logic.minor import createOtherEngagementRequest, setCommunityEngagementForUser, getSummerExperience, getEngagementTotal, createSummerExperience, getProgramEngagementHistory, getCourseInformation, getCommunityEngagementByTerm, getCCEMinorProposals, createOtherEngagementRequest, removeProposal, getMinorSpreadsheet

@minor_bp.route('/profile/<username>/cceMinor', methods=['GET'])
def viewCceMinor(username):
Expand Down Expand Up @@ -85,6 +85,21 @@ def getEngagementInformation(username, type, id, term):

return information


@minor_bp.route('/cceMinor/withdraw/<username>/<proposalID>', methods = ['POST'])
def withdrawProposal(username, proposalID):
try:
if g.current_user.isAdmin or g.current_user.isFaculty or g.current_user == username:
removeProposal(proposalID)
flash("Experience successfully withdrawn", 'success')
else:
flash("Unauthorized to perform this action", 'warning')
except Exception as e:
print(e)
flash("Withdrawal Unsuccessful", 'warning')
return ""


@minor_bp.route('/cceMinor/getMinorSpreadsheet', methods=['GET'])
def returnMinorSpreadsheet():
"""
Expand Down
8 changes: 5 additions & 3 deletions app/logic/fileHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from flask import redirect, url_for
from app import app
from app.models.attachmentUpload import AttachmentUpload
from app.models.cceMinorProposal import CCEMinorProposal
from app.models.program import Program
import glob

Expand All @@ -14,7 +15,8 @@ def __init__(self, files=None, courseId=None, eventId=None, programId=None, prop
self.courseId = courseId
self.eventId = eventId
self.programId = programId
self.proposalId = proposalId
self.proposalId = proposalId

if courseId:
self.path = os.path.join(self.path, app.config['files']['course_attachment_path'], str(courseId))
elif eventId:
Expand All @@ -41,6 +43,7 @@ def getFileFullPath(self, newfilename=''):
pass
except FileExistsError:
pass

return filePath

def saveFiles(self, saveOriginalFile=None):
Expand Down Expand Up @@ -74,8 +77,7 @@ def saveFiles(self, saveOriginalFile=None):
AttachmentUpload.create(program=self.programId, fileName=fileName)
currentProgramID = fileName
saveFileToFilesystem = currentProgramID



elif self.proposalId:
fileType = file.filename.split('.')[-1]
fileName = f"{self.proposalId}.{fileType}"
Expand Down
18 changes: 18 additions & 0 deletions app/logic/minor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
from app.models.individualRequirement import IndividualRequirement
from app.models.certificationRequirement import CertificationRequirement
from app.models.cceMinorProposal import CCEMinorProposal
from app.logic.createLogs import createActivityLog
from app.logic.fileHandler import FileHandler
from app.logic.serviceLearningCourses import deleteCourseObject
from app.models.attachmentUpload import AttachmentUpload


def createSummerExperience(username, formData):
Expand Down Expand Up @@ -393,3 +397,17 @@ def removeSummerExperience(username):
"""
term, summerExperienceToDelete = getSummerExperience(username)
IndividualRequirement.delete().where(IndividualRequirement.username == username, IndividualRequirement.description == summerExperienceToDelete).execute()

def removeProposal(proposalID) -> None:
"""
Delete summer experience or other engagement objects from the CCEMinorProposal table.
File objects attached to the CCEMinorProposal object are also deleted.
"""
proposalID = int(proposalID)

proposalAttachment = AttachmentUpload.get_or_none(proposal=proposalID)
Comment thread
Kafui123 marked this conversation as resolved.
if proposalAttachment:
proposalFileHandler = FileHandler(proposalId=proposalID)
proposalFileHandler.deleteFile(proposalAttachment.id)

CCEMinorProposal.delete().where(CCEMinorProposal.id == proposalID).execute()
2 changes: 1 addition & 1 deletion app/models/attachmentUpload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from app.models.event import Event
from app.models.course import Course
from app.models.program import Program
from app.models.cceMinorProposal import CCEMinorProposal
from app.models.cceMinorProposal import CCEMinorProposal

class AttachmentUpload(baseModel):
event = ForeignKeyField(Event, null=True)
Expand Down
41 changes: 41 additions & 0 deletions app/static/js/minorProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,53 @@ import { validateEmail } from "./emailValidation.mjs";

$(document).ready(function() {
$("#supervisorEmail").on('input', validateEmail);
$("#withdrawBtn").on("click", withdrawProposal);

function changeAction(action){
let proposalID = action.id;
let proposalAction = action.value;
// decides what to do based on selection
if (proposalAction == "Withdraw"){
$('#proposalID').val(proposalID);
$('#withdrawModal').modal('show');

}
resetAllSelections()
}


function resetAllSelections() {
$('.form-select').val('---');
}


function withdrawProposal(){
// uses hidden label to withdraw course
let proposalID = $("#proposalID").val();
let username = $("#username").val()
$.ajax({
url: `/cceMinor/withdraw/${username}/${proposalID}`,
type: "POST",
success: function(s){
window.location.href = `/profile/${username}/cceMinor?tab=manageProposals`
},
Comment thread
Kafui123 marked this conversation as resolved.
error: function(request, status, error) {
console.log(status, error);
}
})
resetAllSelections()
};


window.changeAction = changeAction;

$('input.phone-input').inputmask('(999)-999-9999')
$('input.phone-input').on('input', function(){
let matches = $(this).val().match(/\d/g);
let digits = matches?matches.length:0;
if (digits == 0 || digits == 10){
this.setCustomValidity('')

}
else{
this.setCustomValidity('Please enter a valid phone number.')
Expand All @@ -24,6 +64,7 @@ $(document).ready(function() {
e.stopPropagation()

let engagementData = $(this).parents('.engagement-row').data('engagement-data');

toggleEngagementCredit($(this).is(':checked'), engagementData, this)
});

Expand Down
2 changes: 1 addition & 1 deletion app/static/js/slcManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function renew(){
}
})
resetAllSelections()
}
}
function withdraw(){
// uses hidden label to withdraw course
let courseID = $("#courseID").val();
Expand Down
8 changes: 5 additions & 3 deletions app/templates/minor/cceMinorProposalManagement.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

Comment thread
bledsoef marked this conversation as resolved.
<div class="tab-pane fade show {{ 'active' if activeTab == 'manageProposals' else '' }}" id="pills-manageProposals" role="tabpanel" aria-labelledby="manageProposals">

<div class="table-responsive" id="proposalTable">
<table class="table table-striped">
Comment thread
bledsoef marked this conversation as resolved.
<thead>
Expand Down Expand Up @@ -38,6 +36,7 @@

Comment thread
Kafui123 marked this conversation as resolved.
</tbody>
</table>
<input id="proposalID" type="hidden">
{% if not proposalList %}
<p class="text-center">{{user.firstName}} {{user.lastName}} has no associated CCE Minor proposals.</p>
{% endif %}
Expand All @@ -64,6 +63,7 @@ <h5 class="modal-title" id="withdrawModalLabel">Withdraw Proposal</h5>
<button type="button" class="btn btn-primary" id="withdrawBtn">Withdraw</button>
</div>
</div>
</input>
</div>
</div>
<div class="modal fade" id="renewModal" tabindex="-1" aria-labelledby="renewModalLabel" aria-hidden="true">
Expand Down Expand Up @@ -105,4 +105,6 @@ <h5 class="modal-title" id="renewModalLabel">Renew Course</h5>
</div>
</div>
</div>
</div>
</div>


8 changes: 4 additions & 4 deletions app/templates/minor/companyOrganizationInformation.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ <h4>Company/Organization Information</h4>
</div>

<div class="form-group">
<label class="form-label" for="orgName"><strong>Name</strong></label>
<label class="required form-label" for="orgName"><strong>Name</strong></label>
<input class="form-control" id="orgName" name="orgName" placeholder="Company or organization's name" required/>
</div>

<br>

<div class="form-group">
<label class="form-label" for="orgAddress"><strong>Address</strong></label>
<label class="required form-label" for="orgAddress"><strong>Address</strong></label>
<input class="form-control" id="orgAddress" name="orgAddress" placeholder="Company or organization's physical address" required/>
</div>

<br>

<div class="row">
<div class="form-group col-6">
<label class="form-label" for="orgPhone"><strong>Phone Number</strong></label>
<label class="required form-label" for="orgPhone"><strong>Phone Number</strong></label>
<input class="form-control phone-input" type="text" id="orgPhone" name="orgPhone" placeholder="Company or organization's phone number" required/>
</div>
<div class="form-group col-6">
<label class="form-label" for="orgWebsite"><strong>Website</strong></label>
<label class="required form-label" for="orgWebsite"><strong>Website</strong></label>
<input class="form-control" id="orgWebsite" name="orgWebsite" placeholder="Company or organization's website" required/>
</div>
</div>
12 changes: 6 additions & 6 deletions app/templates/minor/requestOtherEngagement.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h4 class='form-label' for='studentUser'> Proposal for Other Community Engaged E
</div>

<div class="form-group">
<label class="form-label" for="term"><strong>Term</strong></label>
<label class="required form-label" for="term"><strong>Term</strong></label>
<select class="form-select" name="term" id="term" required {% if other_experience %}disabled{% endif %}>
<option value="" disabled selected>Select Year</option>
{% for term in selectableTerms %}
Expand All @@ -44,7 +44,7 @@ <h4 class='form-label' for='studentUser'> Proposal for Other Community Engaged E
<br>

<div class="form-group">
<label class="form-label" for="experienceName"><strong>Experience Title</strong></label>
<label class="required form-label" for="experienceName"><strong>Experience Title</strong></label>
<input class="form-control" id="experienceName" placeholder="Enter a name for your experience" name="experienceName" required value="{{ other_experience.activity if other_experience else '' }}" {% if other_experience %}disabled{% endif %}/>
</div>

Expand All @@ -55,7 +55,7 @@ <h4 class='form-label' for='studentUser'> Proposal for Other Community Engaged E
{% include "minor/supervisorInformation.html" %}

<div class="form-group">
<label class="mb-2" for="supervisorAttachment"><strong>Upload Confirmation of Participation</strong> (From Supervisor)</label>
<label class="mb-2 required" for="supervisorAttachment"><strong>Upload Confirmation of Participation</strong> (From Supervisor)</label>
<input class="form-control" id="supervisorAttachment" name="attachmentObject" type="file" multiple accept=".png, .jpg, .pdf, .jpeg, .docx, .xlsx" {% if other_experience %}disabled{% endif %}/>
</div>

Expand All @@ -66,21 +66,21 @@ <h4>Experience Information</h4>
</div>

<div class="form-group">
<label class="form-label" for="totalHours"><strong>Total Hours</strong></label>
<label class="required form-label" for="totalHours"><strong>Total Hours</strong></label>
<input class="form-control" id="totalHours" placeholder="Enter the total hours worked" required type="number" name="totalHours" value="{{ other_experience.hours if other_experience else '' }}" {% if other_experience %}disabled{% endif %}/>
</div>

<br>

<div class="form-group">
<label class="form-label" for="totalWeeks"><strong>Weeks Worked</strong></label>
<label class="required form-label" for="totalWeeks"><strong>Weeks Worked</strong></label>
<input class="form-control" id="totalWeeks" placeholder="Enter total number of weeks worked" required type="number" name="totalWeeks" value="{{ other_experience.weeks if other_experience else '' }}" {% if other_experience %}disabled{% endif %}/>
</div>

<br>

<div class="form-group">
<label class="form-label" for="experienceDescription"><strong>Experience Description</strong></label>
<label class="required form-label" for="experienceDescription"><strong>Experience Description</strong></label>
<textarea class="form-control" rows="5" cols="72" id="experienceDescription" placeholder="Please describe your experience" name="experienceDescription" {% if other_experience %}disabled{% endif %}>{{ other_experience.service if other_experience else '' }}</textarea>
</div>

Expand Down
16 changes: 8 additions & 8 deletions app/templates/minor/summerExperience.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ <h4>Proposal for Community-Engaged Summer Experience</h4>
</div>

<div class="form-group">
<label class="form-label" for="term"><strong>Summer Year</strong></label>
<label class="required form-label" for="term"><strong>Summer Term</strong></label>
<select class="form-select" id="term" name="term" required>
<option value="" disabled selected>Select Year</option>
{% for term in terms %}
{% for term in summerTerms %}
<option value="{{ term }}">{{ term.description }}</option>
{% endfor %}
</select>
Expand All @@ -52,14 +52,14 @@ <h4>Experience Information</h4>
</div>

<div class="form-group">
<label class="form-label" for="roleDescription"><strong>Briefly describe your role and scope of work with this organization during your community-engaged experience.
<label class="required form-label" for="roleDescription"><strong>Briefly describe your role and scope of work with this organization during your community-engaged experience.
Your experience should focus on applied work with a public-facing institution (non-profit, community-based, governmental, or private sector)
that is responsive to community-identified initiatives or needs:</strong></label>
<textarea class="form-control" rows="4" cols="72" id="roleDescription" name="roleDescription" placeholder="Enter your role description" required></textarea><br>
</div>

<div class="form-group col">
<label class="form-label"><strong>Which of the following existing community-based experiences will you take part in during the summer? Please select one.</strong></label><br>
<label class="required form-label"><strong>Which of the following existing community-based experiences will you take part in during the summer? Please select one.</strong></label><br>
<input type="radio" id="internship" name="experienceType" value="Internship" required>
<label for="internship">Internship</label><br>
<input type="radio" id="cbr" name="experienceType" value="Community-based research" required>
Expand All @@ -75,7 +75,7 @@ <h4>Experience Information</h4>
<input type="text" class="form-control" id="otherExperienceDescription" name="otherExperienceDescription" placeholder="Enter your summer experience description."></input><br>
</div>
<div class="form-group">
<label class="form-label"><strong>Which of the four key content areas of the Community and Civic Engagement Minor will your Community-Engaged Summer Experience address? Please select all that apply.</strong></label><br>
<label class="required form-label"><strong>Which of the four key content areas of the Community and Civic Engagement Minor will your Community-Engaged Summer Experience address? Please select all that apply.</strong></label><br>
<input type="checkbox" id="powerInequality" required name="contentArea" value="Power and inequality">
<label for="powerInequality">Power and inequality</label><br>
<input type="checkbox" id="communityIdentity" required name="contentArea" value="Community and identity">
Expand All @@ -87,19 +87,19 @@ <h4>Experience Information</h4>
</div>

<div class="form-group">
<label class="form-label" for="experienceHoursOver300"><strong>Will your experience include at least 300 hours of work over the span of at least 8 weeks?</strong></label><br>
<label class="required form-label" for="experienceHoursOver300"><strong>Will your experience include at least 300 hours of work over the span of at least 8 weeks?</strong></label><br>
<input type="radio" id="yes300hours" name="experienceHoursOver300" required value="Yes">
<label for="yes300hours">Yes</label><br>
<input type="radio" id="no300hours" name="experienceHoursOver300" value="No">
<label for="no300hours">No</label>

<div id="hoursBelow300Container" class="row mt-2">
<div class="form-group col-6">
<label for="totalHours"><b>Hours</b></label><br>
<label class="required" for="totalHours"><b>Hours</b></label><br>
<input class="form-control" type="text" id="totalHours" name="totalHours" placeholder="Enter the total hours."></input>
</div>
<div class="form-group col-6">
<label for="totalWeeks"><b>Weeks</b></label><br>
<label class="required" for="totalWeeks"><b>Weeks</b></label><br>
<input class="form-control" type="text" id="totalWeeks" name="totalWeeks" placeholder="Enter the number of weeks."></input>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/templates/minor/supervisorInformation.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h4> Supervisor Information </h4>
</div>
<div class="row">
<div class="form-group col-12">
<label class="form-label" for="supervisorName"> <strong>Direct Supervisor Name (or "Yet to be determined")</strong> </label>
<label class="required form-label" for="supervisorName"> <strong>Direct Supervisor Name (or "Yet to be determined")</strong> </label>
<input class="form-control" id="supervisorName" placeholder="Name of direct supervisor" name="supervisorName" required>
</div>
</div>
Expand All @@ -14,11 +14,11 @@ <h4> Supervisor Information </h4>

<div class="row">
<div class="form-group col-6">
<label class="form-label" for="supervisorPhone"><strong>Phone Number</strong></label>
<label class="required form-label" for="supervisorPhone"><strong>Phone Number</strong></label>
<input class="form-control phone-input" id="supervisorPhone" name="supervisorPhone" placeholder="Supervisor's phone number" required/>
</div>
<div class="form-group col-6">
<label class="form-label" for="supervisorEmail"><strong>Email</strong></label>
<label class="required form-label" for="supervisorEmail"><strong>Email</strong></label>
<input class="form-control email-input" id="supervisorEmail" name="supervisorEmail" placeholder="Supervisor's email" required/>
<br>
</div>
Expand Down
Loading