Skip to content
Open
12 changes: 8 additions & 4 deletions app/controllers/main_routes/main_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from app.models.allocation import Allocation
from app.models.department import Department
from app.models.supervisor import Supervisor
from app.models.supervisorDepartment import SupervisorDepartment
from app.models.supervisorDepartment import SupervisorDepartment
from app.models.student import Student
from app.models.laborStatusForm import LaborStatusForm
from app.models.formHistory import FormHistory
Expand Down Expand Up @@ -161,12 +161,16 @@ def count_workers(job_type, hours_bucket):
@main_bp.route('/department/<org>/<account>/positions', methods=['GET'])
def managePositions(org, account):
try:
currentUser = require_login()
if not currentUser or not currentUser.supervisor:
return render_template('errors/403.html'), 403
dept = Department.get(Department.ORG == org, Department.ACCOUNT == account)
except DoesNotExist:
return render_template('errors/404.html'), 404

positions = Tracy().getPositionsFromDepartment(org, account)
print(positions)
print("THIS IS Dept:", dept)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only leave in print statements when absolutely necessary. This one is not necessary.


positions = PositionHistory.select().where((PositionHistory.department == dept) & (PositionHistory.status == "Active")).order_by(PositionHistory.positionTitle.asc())

return render_template('main/managepositions.html',
department = dept,
department_name = dept.DEPT_NAME,
Expand Down
8 changes: 7 additions & 1 deletion app/static/css/managepositions.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.width-12{
width:12%;
}

.margin-top-10{
margin-top:-25px;
}
*{
/* outline:solid 1px lime; */
margin:0;
Expand All @@ -12,4 +14,8 @@
.department-header{
padding:1%;
margin-top:-20px;
}

td{
text-align:center !important;
}
9 changes: 9 additions & 0 deletions app/static/js/managePositions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$(document).ready(function () {

@BetterRocket BetterRocket Jul 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't bootstrap handle tables? If possible, that's the better way.

$('#positionTable').DataTable({
pageLength: 25,
columnDefs: [
{ className: 'dt-head-center', targets: '_all' },
{ orderable: false, targets: [4,4 ] }
]
});
});
136 changes: 135 additions & 1 deletion app/templates/main/departmentPortal.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
{% block scripts %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole file has old versions of stuff. Don't include.

{{super()}}
<script type="text/javascript" src="{{url_for('static', filename='js/departmentPortal.js') }}?u={{lastStaticUpdate}}"></script>
<<<<<<< HEAD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

departmentPortal.html still has unresolved merge conflict markers (<<<<<<< HEAD, =======, >>>>>>>). This will break the template, so those need to be resolved before merge.

<link rel="stylesheet" type="text/css"
href="{{url_for('static', filename ='css/departmentPortal.css')}}?u={{lastStaticUpdate}}">
=======
<link rel="stylesheet" type="text/css" href="/static/css/departmentPortal.css?u={{lastStaticUpdate}}"/>
>>>>>>> 60ada1ecec53be4b8241ba3c3213984376bc73b6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even this need to be removed

{% endblock %}
{% block app_content %}
<h2 class="text-center">{% if department %} {{department.DEPT_NAME}} Portal {% else %} Choose a Department: {% endif %} </h2>
Expand All @@ -25,8 +30,36 @@ <h2 class="text-center">{% if department %} {{department.DEPT_NAME}} Portal {% e
</select>
</div>

<<<<<<< HEAD
{% if department %}
<div class="row g-3">
<div class="card-group" style="display:inline-flex; gap: 2rem;" style="height: 1000px">

<div class="card" style="width:50rem; border-radius: 2rem;">
<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; border-radius: 2rem;" aria-labelledby="members-title">
<div class="card-body">
<div class="media">
<div class="media-left">
<span class="btn btn-default btn-lg img-circle disabled" aria-hidden="true">
<i class="fa fa-users"></i>
</span>
</div>
=======

{% if department %}
<div class="row g-3">
<div class="col-12 col-lg-4 ">
<section class="card" aria-labelledby="allocationTitle">
<div class="card-body">
Expand Down Expand Up @@ -75,12 +108,30 @@ <h3>Break Hours</h3> <h3>{{break_hours}}/{{allocation.breakHours or 0}} Hours</h
</span>
</div>

>>>>>>> 60ada1ecec53be4b8241ba3c3213984376bc73b6
<div class="media-body media-middle">
<h1>
Members
</h1>
</div>
</div>
<<<<<<< HEAD
<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
=======
<h4> <b>{% if laborCoordinators|length <= 1 %} Labor Coordinator {% else %} Labor Coordinators{% endif %}</b></h4>
{% if laborCoordinators %}
{% for coordinator in laborCoordinators %}
Expand Down Expand Up @@ -136,12 +187,94 @@ <h4> <b>{% if supervisors|length <= 1 %} Supervisor{% else %} Supervisors{% endi
</div>

<div class="card-footer text-center">
<a href="#" class="btn btn-primary">View Members
>>>>>>> 60ada1ecec53be4b8241ba3c3213984376bc73b6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this too

<a href="/department/{{ department.ORG }}/{{ department.ACCOUNT }}/members" class="btn btn-primary">View Members
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</section>

<<<<<<< HEAD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

<div class="card mb-3" style="width:50rem; border-radius: 2rem;">
<div class="card-body">
<div class="media">
<div class="media-body media-middle">
<h1>Positions</h1>
</div>
<div class="media-right">
<span class="btn btn-default btn-lg img-circle disabled" aria-hidden="true">
<i class="fa fa-suitcase"></i>
</span>
</div>

</div>
<ul style="line-height:2;">
{% for p in positions %}
{% if 7 > loop.index0 %}
<li class="card-text">{{ p }}</li>
{% elif 8 == loop.index0 %}
</ul><p class="card-text">and {{ positions | length}} more...</p>
{% endif %}
{% endfor %}
</ul>

</div>
<div class="card-footer text-center">
<a href="/department/{{ department.ORG }}/{{ department.ACCOUNT }}/positions" class="btn btn-primary">View Details <span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
</div>

{% endif %}


<!-- <div class="col-sm-4">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this part.

<section class="card members-card" aria-labelledby="members-title">
<div class="card-body">

<div class="media">
<div class="media-left">
<span class="members-card-icon" aria-hidden="true">
<i class="fa fa-users"></i>
</span>
</div>

<div class="media-body media-middle">
<h3 id="members-title" class="media-heading card-title">
<strong>Members</strong>
</h3>
</div>
</div>

<h4 class="text-primary"><strong>Labor Coordinator</strong></h4>
<p class="card-text">Dr. Jones</p>

<h4 class="text-primary"><strong>Supervisors</strong></h4>
<p class="card-text">
Dr. Heggen<br>
Dr. Nakazawa
</p>

<p class="text-center">
<span class="members-card-cta">
<a href="#" class="btn btn-primary btn-sm members-card-btn">
View Details <span class="glyphicon glyphicon-chevron-right"></span>
</a>

</span>
</p>

</div>
</section>
</div> -->

{% endblock %}\


Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch currently has a merge conflicts and needs to be merged into the department-portal-base and then the conflicts resolved



=======
</div>

<div class=" col-12 col-lg-4">
Expand Down Expand Up @@ -185,3 +318,4 @@ <h1>Positions</h1>
{% endif %}

{% endblock %}
>>>>>>> 60ada1ecec53be4b8241ba3c3213984376bc73b6
56 changes: 16 additions & 40 deletions app/templates/main/managepositions.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,65 @@

{% block styles %}
{{super()}}
<link href="https://cdn.datatables.net/v/dt/dt-2.1.6/datatables.min.css" rel="stylesheet">
<link href="/static/css/managepositions.css?u={{lastStaticUpdate}}" rel="stylesheet" type="text/css">
{% endblock %}

{% block scripts %}
{{super()}}
<script src="https://cdn.datatables.net/v/dt/dt-2.1.6/datatables.min.js"></script>
<script type="text/javascript" src="{{url_for('static', filename='js/managePositions.js') }}?u={{lastStaticUpdate}}"></script>
{% endblock %}

{% block app_content %}
<div class="text-white department-header">
<h2>{{ department_name }}</h2>
</div>

<div class="container-fluid position-management">

<div class="row page-header">
<div class="form-group col-xs-4 ">
<select class="selectpicker"
name='department'
id='selectedDepartment'
data-live-search='true'
title="Department"
>
<option value = "" disabled selected>Search a position</option>
{% for p in positions %}
<option data-account="{{p.POSN_TITLE}}" data-org="{{p.POSN_CODE}}" data-content=
"<span>{{p.DEPT_NAME}}</span><small class='text-muted'> {{p.POSN_TITLE}} </small>">{{p.POSN_TITLE}}</option>
{% endfor %}
</select>

</div>
<h1 class="col-xs-4 text-center">Manage Positions</h1>
<h1 class=" text-center margin-top-10">{{ department_name }} Positions </h1>
<div class="col-xs-4 text-right">
<button class="btn add-btn btn-primary" id="addPositionButton">
Add Position
</button>

</div>
</div>

<div class="table-responsive">
<table class="table table-striped table-bordered text-center" id="positionTable">
<thead>
<tr>
<th class="text-center">Position (WSL)</th>
<th class="text-center">Position Code</th>
<th class="text-center">Status</th>
<th class="text-center width-12">Position</th>
<th class="text-center width-12">WLS</th>
<th class="width-12 text-center">Last Revision Date</th>
<th class="width-12 text-center">View Position Description</th>
<th class="text-center">Edit Position Description</th>
<th class="text-center width-12">Edit Position Description</th>
</tr>
</thead>
<tbody>

<!-- Sample Row -->

{% for position in positions %}
<tr>
<td>{{position.POSN_TITLE}} ({{position.WLS}})</td>
<td>{{position.POSN_CODE}}</td>
<td>
<p class="bg-success p-5">
Active
</p>
</td>
<td>01/01/2024</td>
<td>{{position.positionTitle}} <span> <small class='text-muted'> {{position.positionCode}} </small> </span> </td>
<td>{{position.wls}}</td>
<td>{{position.revisionDate}}</td>
<td>
<button class="btn btn-success view-btn">
View
</button>
</td>
<td>
<button class="btn btn-primary request-btn">
Request an Update
<button class="btn btn-primary request-btn text">
Edit Position
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<h3 class="total">
<!-- <h3 class="total">
Total Positions:
<span id="positionCount">{{ positions|length }}</span>
</h2>
<span id="positionCount">{{ positions|length }} </span>
</h2> -->
</div>

{% endblock %}
Loading