Skip to content

Commit

Permalink
Update My Equipment tab (allegro#3799)
Browse files Browse the repository at this point in the history
  • Loading branch information
awieckowski authored Mar 7, 2024
1 parent 39fcab7 commit dcd2137
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
10 changes: 4 additions & 6 deletions src/ralph/accounts/templates/ralphuser/my_equipment.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ <h1>{{ request.user.first_name }} {{ request.user.last_name }}</h1>
{% include 'ralphuser/partials/accept_assets.html' with title="Assets to accept" action="accept" transition_id=acceptance_transition_id transition_exists=acceptance_transition_exists assets=assets_to_accept %}
{% include 'ralphuser/partials/accept_assets.html' with title="Assets to loan" action="loan" transition_id=loan_transition_id transition_exists=loan_transition_exists assets=assets_to_loan %}

{% if managing_devices_moved_info %}
{{ managing_devices_moved_info|safe }}
{% endif %}

<h5>{% trans 'Assigned assets' %}:</h5>
{% table asset_list.get_table_content %}

<h5>{% trans 'Assigned SIM cards' %}:</h5>
{% table simcard_list.get_table_content %}

<h5>{% trans 'Assigned licences' %}:</h5>
{% table licence_list.get_table_content %}

{% for link in my_equipment_links %}
<a href="{{ link.url }}">{{ link.name }}</a><br />
{% endfor %}
</div>
{% endblock %}
19 changes: 3 additions & 16 deletions src/ralph/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,6 @@ def get_context_data(self, **kwargs):
if settings.MY_EQUIPMENT_SHOW_BUYOUT_DATE:
asset_fields += ['buyout_date']

if settings.MY_EQUIPMENT_REPORT_FAILURE_URL:
asset_fields += ['report_failure']

if settings.MY_EQUIPMENT_BUYOUT_URL and settings.MY_EQUIPMENT_SHOW_BUYOUT_DATE: # noqa
asset_fields += ['buyout_ticket']

warehouse_stocktaking_enabled = BackOfficeAsset.objects.filter(
user=self.request.user, warehouse__stocktaking_enabled=True
).exists()
region_stocktaking_enabled = BackOfficeAsset.objects.filter(
user=self.request.user, region__stocktaking_enabled=True
).exists()

if warehouse_stocktaking_enabled or region_stocktaking_enabled:
asset_fields += ['confirm_ownership']

context['asset_list'] = MyEquipmentAssetList(
self.get_asset_queryset(),
asset_fields,
Expand All @@ -223,6 +207,9 @@ def get_context_data(self, **kwargs):
],
request=self.request,
)
context['managing_devices_moved_info'] = (
settings.MANAGING_DEVICES_MOVED_INFO
)

context['simcard_list'] = AssignedSimcardsList(
self.get_simcard_queryset(),
Expand Down
1 change: 1 addition & 0 deletions src/ralph/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ def get_sentinels(sentinels_string):
# {'url': 'http://....', 'name': 'Link name'},
# ]
MY_EQUIPMENT_LINKS = json.loads(os.environ.get('MY_EQUIPMENT_LINKS', '[]'))
MANAGING_DEVICES_MOVED_INFO = os.environ.get('MANAGING_DEVICES_MOVED_INFO', '') # noqa
MY_EQUIPMENT_REPORT_FAILURE_URL = os.environ.get('MY_EQUIPMENT_REPORT_FAILURE_URL', '') # noqa
MY_EQUIPMENT_SHOW_BUYOUT_DATE = bool_from_env('MY_EQUIPMENT_SHOW_BUYOUT_DATE')
MY_EQUIPMENT_BUYOUT_URL = os.environ.get('MY_EQUIPMENT_BUYOUT_URL', '')
Expand Down

0 comments on commit dcd2137

Please sign in to comment.