diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index 0a2f21e4..00de74b9 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -16,6 +16,8 @@ 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 +from app.models.positionHistory import PositionHistory @main_bp.route('/logout', methods=['GET']) def triggerLogout(): @@ -51,21 +53,78 @@ def supervisorPortal(): @main_bp.route('/department/', methods=['GET']) @main_bp.route('/department//', methods=['GET']) def departmentPortal(org=None,account=None): - try: - dept = Department.get(Department.ORG == org, Department.ACCOUNT == account) - except (NameError, DoesNotExist): + if org and account: + try: + dept = Department.get(Department.ORG == org, Department.ACCOUNT == account) + except (NameError, DoesNotExist): + dept = None + else: 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 = [] + pos_his = [] + if pos == []: + positions = ["No Positions for this Department"] + else: + for i in pos: + positions.append(i.POSN_TITLE + ": " + "(WLS " + i.WLS + ")") + try: + pos_his_obj = PositionHistory.get(PositionHistory.positioncode == i.POSN_CODE) + pos_his.append(str(pos_his_obj.positioncode) + str(pos_his_obj.revisiondate)) + except: + pos_his.append("#") + + staff = Tracy().getSupervisors() + supervisors = [] + + for i in staff: + if i.ORG == org: + supervisors.append(i.FIRST_NAME + " " + i.LAST_NAME + " (" + i.EMAIL + ")") + + + pos = Tracy().getPositionsFromDepartment(org, account) + positions = [] + pos_his = [] + if pos == []: + positions = ["No Positions for this Department"] + else: + for i in pos: + positions.append(i.POSN_TITLE + ": " + "(WLS " + i.WLS + ")") + try: + pos_his_obj = PositionHistory.get(PositionHistory.positioncode == i.POSN_CODE) + pos_his.append(str(pos_his_obj.positioncode) + str(pos_his_obj.revisiondate)) + except: + pos_his.append("#") return render_template('main/departmentPortal.html', departments = departments, - department = dept) + department = dept, + positions = positions, + supervisors = supervisors, + pos_his = pos_his + ) + +@main_bp.route('/department///managepositions', methods=['GET']) +def managePositions(org, account): + try: + 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) + return render_template('main/managepositions.html', + department = dept, + department_name = dept.DEPT_NAME, + positions = positions + ) @main_bp.route('/supervisorPortal/addUserToDept', methods=['GET', 'POST']) def addUserToDept(): diff --git a/app/models/allocation.py b/app/models/allocation.py new file mode 100644 index 00000000..86e905c0 --- /dev/null +++ b/app/models/allocation.py @@ -0,0 +1,19 @@ +from app.models import * +from app.models.department import Department +from app.models.supervisor import Supervisor +from app.models.term import Term + +class Allocation(baseModel): + termCode = ForeignKeyField(Term) + department = ForeignKeyField(Department) + isApproved = BooleanField(default=False) + approvedOn = DateField() + approvedBy = ForeignKeyField(Supervisor, null=True) + justification = TextField() + primary_10 = IntegerField() + primary_12 = IntegerField() + primary_15 = IntegerField() + primary_20 = IntegerField() + secondary_5 = IntegerField() + secondary_10 = IntegerField() + breakHours = IntegerField() diff --git a/app/models/positionHistory.py b/app/models/positionHistory.py new file mode 100644 index 00000000..95fb3d28 --- /dev/null +++ b/app/models/positionHistory.py @@ -0,0 +1,13 @@ +from app.models import * +from app.models.department import Department + +class PositionHistory(baseModel): + positioncode = CharField() + status = CharField() + WLS = IntegerField() + revisiondate = DateField() + Description = TextField(default=None) + Department = ForeignKeyField(Department) + + class Meta: + primary_key = CompositeKey('positioncode', 'revisiondate', 'status') \ No newline at end of file diff --git a/app/models/supervisorDepartment.py b/app/models/supervisorDepartment.py index 3585e1eb..72a80ea6 100644 --- a/app/models/supervisorDepartment.py +++ b/app/models/supervisorDepartment.py @@ -5,3 +5,12 @@ class SupervisorDepartment(baseModel): supervisor = ForeignKeyField(Supervisor, null=True) department = ForeignKeyField(Department) + banStatus = BooleanField(default=False) + isActive = BooleanField(default=False) + isCoordinator = BooleanField(default=False) + + @property + def isBanned(self): + return self.banStatus + + diff --git a/app/static/css/base.css b/app/static/css/base.css index 940f8d6e..c1be451d 100755 --- a/app/static/css/base.css +++ b/app/static/css/base.css @@ -207,6 +207,7 @@ a { background-clip: border-box; border: 1px solid rgba(0, 0, 0, 0.125); border-radius: 0.25rem; + overflow: hidden; } .card-body { @@ -250,6 +251,9 @@ a { padding: 0.5rem 1rem; background-color: rgba(0, 0, 0, 0.03); border-top: 1px solid rgba(0, 0, 0, 0.125); + border-bottom-left-radius: 1rem; + border-bottom-right-radius: 1rem; + } .card-footer:last-child { diff --git a/app/static/css/managepositions.css b/app/static/css/managepositions.css new file mode 100644 index 00000000..9c40bbe3 --- /dev/null +++ b/app/static/css/managepositions.css @@ -0,0 +1,15 @@ +.width-12{ + width:12%; +} + +*{ + /* outline:solid 1px lime; */ + margin:0; + padding:0; + box-sizing:border-box; +} + +.department-header{ + padding:1%; + margin-top:-20px; +} \ No newline at end of file diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index 8ee01838..770ce3a3 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -3,13 +3,14 @@ {% block scripts %} {{super()}} + {% if department %} {{department.DEPT_NAME}} Portal {% else %} Choose a Department: {% endif %} + -
+
+ +{% if department %} +
+ +
+
+
+
+ +
+
+
+
+

AY 26/27

15/20 Positions

+
+
    +
  • 10 HR : 2
  • +
  • 12 HR : 3
  • +
  • 15 HR : 5
  • +
  • 20 HR : 5
  • +
+
+
+

Break Hours

0 of 200 Hrs.

+
+
+ +
+ +
+
+
+
+ +
+ +
+

+ Members +

+
+
+

Labor Coordinator(s)

+

Dr. Jones

+ +

Supervisors

+ {% for s in supervisors %} + {% if 3 > loop.index0 %} +

{{ s }}

+ {% elif 4 > loop.index0 %} +

and {{ supervisors | length}} more...

+ {% endif %} + {% endfor %} +
+ + +
+ +
+
+
+
+ +
+
+

Positions

+
+ +
+
    + {% for p in positions %} + {% if 7 > loop.index0 %} + {% if not pos_his[loop.index0] == "#" %} +
  • + {{ p }}
  • + {% else %} +
  • {{ p }}
  • + {% endif %} + {% elif 8 == loop.index0 %} +

and {{ positions | length}} more...

+ {% endif %} + {% endfor %} + + +
+ +
+
+ +{% endif %} + {% endblock %} diff --git a/app/templates/main/managepositions.html b/app/templates/main/managepositions.html new file mode 100644 index 00000000..f61558a3 --- /dev/null +++ b/app/templates/main/managepositions.html @@ -0,0 +1,90 @@ +{% extends "base.html" %} + +{% block styles %} +{{super()}} + +{% endblock %} + +{% block scripts %} +{{super()}} + +{% endblock %} + +{% block app_content %} +
+

{{ department_name }}

+
+ +
+ + + +
+ + + + + + + + + + + + + + + {% for position in positions %} + + + + + + + + + {% endfor %} + +
Position (WSL)Position CodeStatusLast Revision DateView Position DescriptionEdit Position Description
{{position.POSN_TITLE}} ({{position.WLS}}){{position.POSN_CODE}} +

+ Active +

+
01/01/2024 + + + +
+
+

+ Total Positions: + {{ positions|length }} +

+
+ +{% endblock %} diff --git a/app/templates/main/supervisorPortal.html b/app/templates/main/supervisorPortal.html index 78383566..3ab521a5 100644 --- a/app/templates/main/supervisorPortal.html +++ b/app/templates/main/supervisorPortal.html @@ -227,7 +227,7 @@

Form Search


-
+