Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 17 additions & 4 deletions app/controllers/main_routes/main_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from app.login_manager import require_login, logout
from app.logic.getTableData import getDatatableData
from app.logic.banner import Banner
from app.logic.tracy import Tracy

@main_bp.route('/logout', methods=['GET'])
def triggerLogout():
Expand Down Expand Up @@ -55,17 +56,29 @@ def departmentPortal(org=None,account=None):
dept = Department.get(Department.ORG == org, Department.ACCOUNT == account)
except (NameError, DoesNotExist):
dept = None




if g.currentUser.isLaborAdmin:
departments = list(Department.select().order_by(Department.isActive.desc(), Department.DEPT_NAME.asc()))
else:
departments = list(getDepartmentsForSupervisor(g.currentUser).order_by(Department.isActive.desc(), Department.DEPT_NAME.asc()))

pos = Tracy().getPositionsFromDepartment(org, account)
positions = []
for i in pos:
positions.append(i.POSN_TITLE + "" + "(" + i.WLS + ")")

staff = Tracy().getSupervisors()
supervisors = []

for i in staff:
if i.ORG == org:
supervisors.append(i.FIRST_NAME + " " + i.LAST_NAME + " (" + i.EMAIL + ")")

return render_template('main/departmentPortal.html',
departments = departments,
department = dept)
department = dept,
positions = positions,
supervisors = supervisors)

@main_bp.route('/supervisorPortal/addUserToDept', methods=['GET', 'POST'])
def addUserToDept():
Expand Down
5 changes: 4 additions & 1 deletion app/static/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,11 @@ a {
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border: 1px solid rgba(0, 0, 0, 0.125);
border: 1px solid black;
border-radius: 0.25rem;
margin-right: 20px;
border-radius: 20px;
overflow: hidden;
}

.card-body {
Expand Down
77 changes: 75 additions & 2 deletions app/templates/main/departmentPortal.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
{% block scripts %}
{{super()}}
<script type="text/javascript" src="{{url_for('static', filename='js/departmentPortal.js') }}?u={{lastStaticUpdate}}"></script>
<link rel="stylesheet" type="text/css"
href="{{url_for('static', filename ='css/departmentPortal.css')}}?u={{lastStaticUpdate}}">
{% endblock %}

{% block app_content %}
<h2 class="text-center">{% if department %} {{department.DEPT_NAME}} Portal {% else %} Choose a Department: {% endif %} </h2>


<!--selectpicker for department-->
<div class="form-group">
<select class="selectpicker"
Expand All @@ -24,4 +26,75 @@ <h2 class="text-center">{% if department %} {{department.DEPT_NAME}} Portal {% e
</select>

</div>
{% endblock %}

{% if department %}
<div class="card-group" style="display:flex" style="height: 1000px">

<div class="card" style="width:50rem;">
<div class="card-body">
<h5 class="card-title">
<svg xmlns="http://www.w3.org/2000/svg" width="16"height="16"fill="currentColor" class="bi bi-clock" viewBox="0 0 16 16">
<path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71z"/>
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0"/>
</svg>
Current Allocation
</h5>
<p class="card-text"><br> AY 26/27 15/20 POSITIONS <br><br> Break Hours 0 of 200 hrs</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>

<section class="card "style="width:50rem" aria-labelledby="members-title">
<div class="card-body">
<div class="media">
<div class="media-left media-middle">
<span aria-hidden="true" style="color: #000; font-size: 32px;">
<i class="bi bi-people-fill"></i>
</span>
</div>

<div class="media-body media-middle">
<h3 class="media-heading">Members</h3>
</div>
</div>
<h4>Labor Coordinator(s)</h4>
<p>Dr. Jones</p>

<h2>Supervisors</h2>
{% for s in supervisors %}
{% if 3 > loop.index0 %}
<p>{{ s }}</p>
{% elif 4 > loop.index0 %}
<p>and {{ supervisors | length}} more...</p>
{% endif %}
{% endfor %}
</div>

<div class="card-footer text-center">
<a href="#" class="btn btn-primary">View Details
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</section>

<div class="card mb-3" style="width:50rem">
<div class="card-body">
<h1>Positions</h1>
{% for p in positions %}
{% if 10 > loop.index0 %}
<p class="card-text">{{ p }}</p>
{% endif %}
{% endfor %}
</div>
<div class="card-footer text-center">
<a href="#" class="btn btn-primary">View Details <span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
</div>

{% endif %}
{% endblock %}\




2 changes: 1 addition & 1 deletion app/templates/main/supervisorPortal.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ <h1 class="fs-1" data-toggle="collapse">Form Search</h1>
</div>
<br>
<div style="position: relative; z-index: 1;" id="sortOptions">
<div class="container-fluid" style="margin-bottom: -40px; float: right;">
<div class="container-fluid" style="margin-bottom: 15px; float: right;">
<label for="columnPicker">Sorting Options:</label>
<select id="columnPicker" name="columnPicker" class="selectpicker" title="Column">
<option value="term">Term</option>
Expand Down
14 changes: 7 additions & 7 deletions database/reset_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ "$1" != "test" ] && [ "$1" != "from-backup" ]; then
fi

cd database;

PRODUCTION=0
if [ "`hostname`" == 'lsf.berea.edu' ]; then
echo "DO NOT RUN THIS SCRIPT ON PRODUCTION UNLESS YOU REALLY REALLY KNOW WHAT YOU ARE DOING"
Expand All @@ -22,12 +22,12 @@ if [ "$1" == "from-backup" ]; then
fi

echo "Dropping databases"
mysql -u root -proot --execute="DROP DATABASE \`lsf\`; DROP USER 'lsf_user';"
mysql -u root -proot --execute="DROP DATABASE \`UTE\`; DROP USER 'tracy_user';"
mysql -u root -proot --skip-ssl --execute="DROP DATABASE \`lsf\`; DROP USER 'lsf_user';"
mysql -u root -proot --skip-ssl --execute="DROP DATABASE \`UTE\`; DROP USER 'tracy_user';"

echo "Recreating databases and users"
mysql -u root -proot --execute="CREATE DATABASE IF NOT EXISTS \`lsf\`; CREATE USER IF NOT EXISTS 'lsf_user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'lsf_user'@'%';"
mysql -u root -proot --execute="CREATE DATABASE IF NOT EXISTS \`UTE\`; CREATE USER IF NOT EXISTS 'tracy_user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'tracy_user'@'%';"
mysql -u root -proot --skip-ssl --execute="CREATE DATABASE IF NOT EXISTS \`lsf\`; CREATE USER IF NOT EXISTS 'lsf_user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'lsf_user'@'%';"
mysql -u root -proot --skip-ssl --execute="CREATE DATABASE IF NOT EXISTS \`UTE\`; CREATE USER IF NOT EXISTS 'tracy_user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'tracy_user'@'%';"

cd database

Expand All @@ -38,14 +38,14 @@ rm -rf migrations.json
echo "Creating database objects"
if [ $BACKUP -eq 1 ]; then
echo " from backup"
mysql -u root -proot lsf < prod-backup.sql
mysql -u root -proot --skip-ssl lsf < prod-backup.sql
else
echo " empty"
./migrate_db.sh
fi

if [ $PRODUCTION -ne 1 ]; then
./migrate_db_tracy.sh
./migrate_db_tracy.sh
fi

rm -rf lsf_migrations
Expand Down