[UPDT] EMPLOYEE: Updated employee asset tab by adding option to view the assigned details in modal

This commit is contained in:
Horilla
2024-03-05 10:11:00 +05:30
parent 7ee91eab27
commit 8c9bdfeebc
2 changed files with 27 additions and 2 deletions

View File

@@ -26,8 +26,8 @@
<div class="oh-sticky-table__tbody">
{% for asset in assets %} {% if asset.asset_id.asset_status == "In use" %}
<!-- asset request looping -->
<div class="oh-sticky-table__tr">
<div class="oh-sticky-table__sd">
<div class="oh-sticky-table__tr" draggable="true" data-toggle="oh-modal-toggle" data-target="#objectDetailsModal" hx-get="{% url 'own-asset-individual-view' asset.id %}?assets_ids={{assets_ids}}" hx-target="#objectDetailsModalTarget">
<div class="oh-sticky-table__td">
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img
@@ -58,6 +58,27 @@
</div>
</div>
</div>
<div
class="oh-modal"
id="asset-return-allocation-modal"
role="dialog"
aria-labelledby="AssetRequestModal"
aria-hidden="true"
>
<div class="oh-modal__dialog" style="max-width: 550px">
<div class="oh-modal__dialog-header">
<button type="button" class="oh-modal__close--custom" aria-label="Close" onclick="$('#asset-return-allocation-modal').toggleClass('oh-modal--show')">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<!-- htmx form -->
<div
class="oh-modal__dialog-body"
id="asset-return-allocation-modal-target"
></div>
</div>
</div>
{% else %}
<div
class="d-flex justify-content-center align-items-center"

View File

@@ -294,9 +294,13 @@ def asset_tab(request, emp_id):
requested_employee_id=emp_id, asset_request_status="Requested"
)
assets = AssetAssignment.objects.filter(assigned_to_employee_id=emp_id)
assets_ids = json.dumps(
[instance.id for instance in assets]
)
context = {
"assets": assets,
"requests": assets_requests,
"assets_ids":assets_ids,
"employee": emp_id,
}
return render(request, "tabs/asset-tab.html", context=context)