Add rudimentary task order listing and viewing pages
This commit is contained in:
parent
793622b791
commit
8017b7f03f
@ -6,6 +6,7 @@ from . import index
|
||||
from . import projects
|
||||
from . import members
|
||||
from . import invitations
|
||||
from . import task_orders
|
||||
from atst.domain.exceptions import UnauthorizedError
|
||||
from atst.domain.workspaces import Workspaces
|
||||
from atst.domain.authz import Authorization
|
||||
|
20
atst/routes/workspaces/task_orders.py
Normal file
20
atst/routes/workspaces/task_orders.py
Normal file
@ -0,0 +1,20 @@
|
||||
from flask import g, render_template
|
||||
|
||||
from . import workspaces_bp
|
||||
from atst.domain.task_orders import TaskOrders
|
||||
from atst.domain.workspaces import Workspaces
|
||||
|
||||
|
||||
@workspaces_bp.route("/workspaces/<workspace_id>/task_orders")
|
||||
def workspace_task_orders(workspace_id):
|
||||
workspace = Workspaces.get(g.current_user, workspace_id)
|
||||
return render_template("workspaces/task_orders/index.html", workspace=workspace)
|
||||
|
||||
|
||||
@workspaces_bp.route("/workspaces/<workspace_id>/task_order/<task_order_id>")
|
||||
def view_task_order(workspace_id, task_order_id):
|
||||
workspace = Workspaces.get(g.current_user, workspace_id)
|
||||
task_order = TaskOrders.get(task_order_id)
|
||||
return render_template(
|
||||
"workspaces/task_orders/show.html", workspace=workspace, task_order=task_order
|
||||
)
|
30
templates/workspaces/task_orders/index.html
Normal file
30
templates/workspaces/task_orders/index.html
Normal file
@ -0,0 +1,30 @@
|
||||
{% from "components/empty_state.html" import EmptyState %}
|
||||
|
||||
{% extends "workspaces/base.html" %}
|
||||
|
||||
{% block workspace_content %}
|
||||
|
||||
{% if not workspace.task_orders %}
|
||||
|
||||
{{ EmptyState(
|
||||
'This workspace doesn’t have any task orders yet.',
|
||||
action_label='Add a New Task Order',
|
||||
action_href=url_for('task_orders.new', screen=1, workspace_id=workspace.id),
|
||||
icon='cloud',
|
||||
) }}
|
||||
|
||||
{% else %}
|
||||
|
||||
<ul>
|
||||
{% for task_order in workspace.task_orders %}
|
||||
<li class='block-list__item'>
|
||||
<a href='{{ url_for("workspaces.view_task_order", workspace_id=workspace.id, task_order_id=task_order.id)}}'>
|
||||
<span>{{ task_order.start_date }} - {{ task_order.end_date }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
7
templates/workspaces/task_orders/show.html
Normal file
7
templates/workspaces/task_orders/show.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends "workspaces/base.html" %}
|
||||
|
||||
{% block workspace_content %}
|
||||
|
||||
You're looking at TO {{ task_order.id }}
|
||||
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user