Create SubmitConfirmation modal
- includes html component and js component - styling on modal is not ready
This commit is contained in:
parent
62c794e7b8
commit
f49b67d0dd
@ -1,11 +1,14 @@
|
||||
from flask import g, render_template
|
||||
from datetime import date
|
||||
|
||||
from flask import g, render_template, url_for, redirect
|
||||
|
||||
from . import task_orders_bp
|
||||
from atst.domain.authz.decorator import user_can_access_decorator as user_can
|
||||
from atst.domain.portfolios import Portfolios
|
||||
from atst.domain.task_orders import TaskOrders
|
||||
from atst.models.task_order import Status
|
||||
from atst.models import Permissions
|
||||
from atst.models.task_order import Status
|
||||
from atst.forms.task_order import TaskOrderForm, SignatureForm
|
||||
|
||||
|
||||
@task_orders_bp.route("/task_orders/<task_order_id>")
|
||||
@ -25,7 +28,24 @@ def view_task_order(task_order_id):
|
||||
@user_can(Permissions.VIEW_TASK_ORDER_DETAILS, message="review task order details")
|
||||
def review_task_order(task_order_id):
|
||||
task_order = TaskOrders.get(task_order_id)
|
||||
return render_template("portfolios/task_orders/review.html", task_order=task_order)
|
||||
to_form = TaskOrderForm(number=task_order.number)
|
||||
signature_form = SignatureForm()
|
||||
return render_template(
|
||||
"portfolios/task_orders/review.html",
|
||||
task_order=task_order,
|
||||
to_form=to_form,
|
||||
signature_form=signature_form,
|
||||
)
|
||||
|
||||
|
||||
# TODO write test, verify permission
|
||||
@task_orders_bp.route("/task_orders/<task_order_id>/submit", methods=["POST"])
|
||||
@user_can(Permissions.CREATE_TASK_ORDER, "submit task order")
|
||||
def submit_task_order(task_order_id):
|
||||
task_order = TaskOrders.get(task_order_id)
|
||||
return redirect(
|
||||
url_for("task_orders.portfolio_funding", portfolio_id=task_order.portfolio.id)
|
||||
)
|
||||
|
||||
|
||||
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders")
|
||||
|
21
js/components/submit_confirmation.js
Normal file
21
js/components/submit_confirmation.js
Normal file
@ -0,0 +1,21 @@
|
||||
import checkboxinput from './checkbox_input'
|
||||
|
||||
export default {
|
||||
name: 'submit-confirmation',
|
||||
|
||||
components: {
|
||||
checkboxinput,
|
||||
},
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
valid: false,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggleValid: function() {
|
||||
this.valid = !this.valid
|
||||
},
|
||||
},
|
||||
}
|
@ -37,6 +37,7 @@ import { isNotInVerticalViewport } from './lib/viewport'
|
||||
import DateSelector from './components/date_selector'
|
||||
import SidenavToggler from './components/sidenav_toggler'
|
||||
import BaseForm from './components/forms/base_form'
|
||||
import SubmitConfirmation from './components/submit_confirmation'
|
||||
import DeleteConfirmation from './components/delete_confirmation'
|
||||
import NewEnvironment from './components/forms/new_environment'
|
||||
import EnvironmentRole from './components/environment_role'
|
||||
@ -81,6 +82,7 @@ const app = new Vue({
|
||||
SidenavToggler,
|
||||
BaseForm,
|
||||
DeleteConfirmation,
|
||||
SubmitConfirmation,
|
||||
nestedcheckboxinput,
|
||||
NewEnvironment,
|
||||
EnvironmentRole,
|
||||
|
@ -8,7 +8,7 @@ body {
|
||||
|
||||
.modal {
|
||||
position: fixed;
|
||||
z-index: 6;
|
||||
z-index: 11;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
|
32
templates/components/submit_confirmation.html
Normal file
32
templates/components/submit_confirmation.html
Normal file
@ -0,0 +1,32 @@
|
||||
{% from "components/alert.html" import Alert %}
|
||||
{% from "components/checkbox_input.html" import CheckboxInput %}
|
||||
|
||||
{% macro SubmitConfirmation(modal_id, submit_text, submit_action, form, task_order) %}
|
||||
<submit-confirmation inline-template name="{{ modal_id }}" key="{{ modal_id }}">
|
||||
<div>
|
||||
<div class="usa-input">
|
||||
<label for="{{ modal_id }}-deleted-text">
|
||||
<span class="usa-input__help">
|
||||
Signature confirmation: Task Order #{{task_order.number}}
|
||||
</span>
|
||||
{{ Alert('',
|
||||
message="All task orders require a Contracting Officer signature."
|
||||
) }}
|
||||
</label>
|
||||
<span v-on:change="toggleValid">
|
||||
{{ CheckboxInput(field=form.signature) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="action-group">
|
||||
<form method="POST" action="{{ submit_action }}">
|
||||
{{ form.csrf_token }}
|
||||
<button class="usa-button usa-button-primary" v-bind:disabled="!valid">
|
||||
{{ submit_text }}
|
||||
</button>
|
||||
<button v-on:click="deleteText = ''; $root.closeModal('{{ modal_id }}')" class="usa-button usa-button-secondary">{{ "common.cancel" | translate }}</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</submit-confirmation>
|
||||
{% endmacro %}
|
@ -1,14 +1,29 @@
|
||||
{% from "components/icon.html" import Icon %}
|
||||
{% from "components/totals_box.html" import TotalsBox %}
|
||||
{% from "components/modal.html" import Modal %}
|
||||
{% from "components/semi_collapsible_text.html" import SemiCollapsibleText %}
|
||||
{% from "components/sticky_cta.html" import StickyCTA %}
|
||||
{% from "components/submit_confirmation.html" import SubmitConfirmation %}
|
||||
{% from "components/totals_box.html" import TotalsBox %}
|
||||
|
||||
{% extends 'portfolios/base.html' %}
|
||||
|
||||
{% block portfolio_content %}
|
||||
{% set submit_modal_id = "submit-to-1" %}
|
||||
{% call Modal(name=submit_modal_id) %}
|
||||
{{
|
||||
SubmitConfirmation(
|
||||
modal_id=submit_modal_id,
|
||||
submit_text="Confirm & Submit",
|
||||
submit_action=url_for('task_orders.submit_task_order', task_order_id=task_order.id),
|
||||
form=signature_form,
|
||||
task_order=task_order,
|
||||
)
|
||||
}}
|
||||
{% endcall %}
|
||||
|
||||
{% call StickyCTA(text="Review Funding") %}
|
||||
<a href="{{ url_for("task_orders.edit", portfolio_id=portfolio.id) }}" class="usa-button usa-button-secondary" type="submit">Edit</a>
|
||||
<a href="{{ url_for("task_orders.edit", portfolio_id=portfolio.id) }}" class="usa-button usa-button-primary" type="submit">Submit task order</a>
|
||||
<a v-on:click="openModal('submit-to-1')" class="usa-button usa-button-primary" type="submit">Submit task order</a>
|
||||
{% endcall %}
|
||||
|
||||
<div class="task-order-summary">
|
||||
|
Loading…
x
Reference in New Issue
Block a user