diff --git a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss index 77cf62f9a..b8017d3f8 100644 --- a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss +++ b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss @@ -1171,3 +1171,22 @@ nav.nav { } } } + +.is-highlighted { + td { + background-color: color('blue-cool-5v'); + animation: fadeHighlight 3s ease-out forwards; + } +} + +@keyframes fadeHighlight { + 0% { + background-color: color('blue-cool-10v'); + } + 50% { + background-color: color('blue-cool-5v'); + } + 100% { + background-color: transparent; + } +} diff --git a/app/main/views/organizations.py b/app/main/views/organizations.py index cf8503a44..ce0b58597 100644 --- a/app/main/views/organizations.py +++ b/app/main/views/organizations.py @@ -2,7 +2,15 @@ from collections import OrderedDict from datetime import datetime from functools import partial -from flask import current_app, flash, redirect, render_template, request, url_for +from flask import ( + current_app, + flash, + redirect, + render_template, + request, + session, + url_for, +) from flask_login import current_user from app import current_organization, org_invite_api_client, organizations_client @@ -131,28 +139,41 @@ def organization_dashboard(org_id): ) if request.method == "POST" and create_service_form.validate_on_submit(): + service_name = create_service_form.name.data service_id, error = _create_service( - create_service_form.name.data, + service_name, create_service_form.organization_type.data, - email_safe(create_service_form.name.data), + email_safe(service_name), create_service_form, ) if not error: - return redirect(url_for(".service_dashboard", service_id=service_id)) + current_organization.associate_service(service_id) + current_app.logger.info(f"Service {service_id} created and associated with org {org_id}") + flash(f"Service '{service_name}' has been created", "default_with_tick") + session['new_service_id'] = service_id + return redirect(url_for(".organization_dashboard", org_id=org_id)) + else: + current_app.logger.error(f"Error creating service: {error}") + flash("Error creating service", "error") if action == "invite-user" or request.form.get("form_name") == "invite_user": invite_user_form = InviteOrgUserForm(inviter_email_address=current_user.email_address) if request.method == "POST" and invite_user_form.validate_on_submit(): - invited_org_user = InvitedOrgUser.create( - current_user.id, org_id, invite_user_form.email_address.data - ) - flash(f"Invite sent to {invited_org_user.email_address}", "default_with_tick") - return redirect(url_for(".organization_dashboard", org_id=org_id)) + try: + invited_org_user = InvitedOrgUser.create( + current_user.id, org_id, invite_user_form.email_address.data + ) + flash(f"Invite sent to {invited_org_user.email_address}", "default_with_tick") + return redirect(url_for(".organization_dashboard", org_id=org_id)) + except Exception as e: + current_app.logger.error(f"Error inviting user: {e}") + flash("Error sending invitation", "error") message_allowance = get_organization_message_allowance(org_id) services_with_usage = get_services_dashboard_data(current_organization, year) + new_service_id = session.pop('new_service_id', None) return render_template( "views/organizations/organization/index.html", @@ -166,6 +187,7 @@ def organization_dashboard(org_id): invite_user_form=invite_user_form, show_create_service=create_service_form is not None, show_invite_user=invite_user_form is not None, + new_service_id=new_service_id, **message_allowance, ) diff --git a/app/templates/components/banner.html b/app/templates/components/banner.html index ccbc24225..e49c8b069 100644 --- a/app/templates/components/banner.html +++ b/app/templates/components/banner.html @@ -3,31 +3,35 @@ {% macro banner(body, type=None, with_tick=False, delete_button=None, subhead=None, context=None, action=None, id=None, thing=None) %}
- {% if subhead -%} -

{{ subhead }}

- {%- endif -%} - {{ body }} - {% if context %} -

- {{ context }} -

- {% endif %} - {% if delete_button %} - {% call form_wrapper(action=action) %} - - {{ usaButton({ - "text": "" if thing else delete_button, - "html": delete_button + " ‘" + thing + "’" if thing else "", - "name": "delete", - "classes": "margin-top-2 usa-button--secondary", - }) }} - {% endcall %} - {% endif %} +
+ {% if subhead -%} +

{{ subhead }}

+ {%- endif -%} +

+ {{ body }} +

+ {% if context %} +

+ {{ context }} +

+ {% endif %} + {% if delete_button %} + {% call form_wrapper(action=action) %} + + {{ usaButton({ + "text": "" if thing else delete_button, + "html": delete_button + " '" + thing + "'" if thing else "", + "name": "delete", + "classes": "margin-top-2 usa-button--secondary", + }) }} + {% endcall %} + {% endif %} +
{% endmacro %} diff --git a/app/templates/views/organizations/organization/index.html b/app/templates/views/organizations/organization/index.html index 49b0845c7..279c4cf14 100644 --- a/app/templates/views/organizations/organization/index.html +++ b/app/templates/views/organizations/organization/index.html @@ -68,7 +68,7 @@ {% if show_create_service and create_service_form %} -
+
+ {% endif %} -
- What is a service? -
-

- When you join Notify, you're added to a service. This is your organization's workspace for sending text messages and emails. Within your service, you can: -

-
    -
  1. Create and edit message templates
  2. -
  3. Send messages to recipients
  4. -
  5. View message status and history
  6. -
  7. Manage team members and permissions
  8. -
  9. Track usage and delivery statistics
  10. -
  11. If you work for multiple organizations, you may belong to multiple services and can switch between them.
  12. -
-
-
- +
+

+ +

+ +
{% endblock %} + +{% block extra_javascripts %} + + {{ super() }} +{% endblock %}