Previously, we were encoding the portfolio_role.user_id as part of the form data for the portfolio admin page. This was convenient because it allowed us to easily determine certain display attributes in the template. Instead, we should rely on the PortfolioRole as the source of truth for member information. This commit adds: - Portfolio.owner_role to return the PortfolioRole of the owner - explicitly passes the PortfolioRole IDs for the PPoC and current user to the template - PortfolioRole.full_name for deriving the member name
37 lines
1.4 KiB
HTML
37 lines
1.4 KiB
HTML
{% from "components/options_input.html" import OptionsInput %}
|
|
|
|
{% for subform in member_perms_form.members_permissions %}
|
|
{% set modal_id = "portfolio_id_{}_user_id_{}".format(portfolio.id, subform.member_id.data) %}
|
|
{% set ppoc = subform.member_id.data == ppoc_id %}
|
|
{% set archive_button_class = 'button-danger-outline' %}
|
|
|
|
<tr {% if ppoc %}class="members-table-ppoc"{% endif %}>
|
|
<td class='name'>{{ subform.member_name.data }}
|
|
<div>
|
|
{% if ppoc %}
|
|
{% set archive_button_class = 'usa-button-disabled' %}
|
|
<span class='you'>PPoC</span>
|
|
{% endif %}
|
|
{% if subform.member_id.data == current_member_id %}
|
|
{% set archive_button_class = 'usa-button-disabled' %}
|
|
<span class='you'>(<span class='green'>you</span>)</span>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
|
|
<td>{{ OptionsInput(subform.perms_app_mgmt, label=False, disabled=ppoc) }}</td>
|
|
<td>{{ OptionsInput(subform.perms_funding, label=False, disabled=ppoc) }}</td>
|
|
<td>{{ OptionsInput(subform.perms_reporting, label=False, disabled=ppoc) }}</td>
|
|
<td>{{ OptionsInput(subform.perms_portfolio_mgmt, label=False, disabled=ppoc) }}</td>
|
|
|
|
<td>
|
|
<a v-on:click="openModal('{{ modal_id }}')" class='usa-button {{ archive_button_class }}'>
|
|
{{ "portfolios.members.archive_button" | translate }}
|
|
</a>
|
|
</td>
|
|
{% if not ppoc %}
|
|
{{ subform.member_id() }}
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|