[FIX] ASSET: Asset report disabled button and made the asset id field in the asset report form disabled and fixed pagination inside the asset category view

This commit is contained in:
Horilla
2024-03-26 14:12:35 +05:30
parent 52546af1a0
commit 5e14e85dab
3 changed files with 17 additions and 15 deletions

View File

@@ -162,17 +162,9 @@ class AssetReportForm(ModelForm):
]
exclude = ["is_active"]
# def __init__(self, *args, **kwargs):
# super(AssetReportForm, self).__init__(*args, **kwargs)
# self.fields['documents'].queryset = AssetDocuments.objects.all()
# def as_p(self, *args, **kwargs):
# """
# Render the form fields as HTML table rows with Bootstrap styling.
# """
# context = {"form": self}
# table_html = render_to_string("attendance_form.html", context)
# return table_html
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['asset_id'].widget.attrs['disabled'] = 'disabled'
class AssetCategoryForm(ModelForm):

View File

@@ -15,6 +15,7 @@
{% endif %}
<!-- end of messages -->
{% include 'filter_tags.html' %}
<div class="oh-sticky-table oh-sticky-table--no-overflow mb-5" id="assetList{{asset_category.id}}">
<div class="oh-sticky-table__table" data-count="{{total_count}}">
<div class="oh-sticky-table__thead">
<div class="oh-sticky-table__tr">
@@ -120,8 +121,16 @@
title='{% trans "Asset Report" %}'>
<ion-icon name="document-attach-outline"></ion-icon>
</a>
{% else %}
<a
class="oh-btn oh-btn--light-bkg w-100 oh-btn--disabled"
onclick="event.stopPropagation()"
id="oh-btn-asset-update-modal"
title='{% trans "Asset Report" %}'>
<ion-icon name="document-attach-outline"></ion-icon>
</a>
{% endif %}
{% if perms.asset.delete_asset %}
<form action="{% url 'asset-delete' asset_id=asset.id %}?{{pg}}"
onclick="event.stopPropagation()"
@@ -140,6 +149,7 @@
{% endfor %}
</div>
</div>
</div>
<!-- pagination start -->
<div class="oh-pagination">

View File

@@ -25,7 +25,7 @@
class="oh-accordion-meta__header oh-accordion-meta__header--custom"
data-target="#assetCategory{{asset_category.id}}"
hx-get="{%url 'asset-list' cat_id=asset_category.id %}"
hx-target="#assetList{{asset_category.id}}">
hx-target="#assetCategory{{asset_category.id}}">
<div class="d-flex">
<span
class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2"
@@ -81,8 +81,8 @@
</div>
<div class="oh-accordion-meta__body d-none" id="assetCategory{{asset_category.id}}">
<!-- htmx asset list loading here -->
<div class="oh-sticky-table oh-sticky-table--no-overflow mb-5" id="assetList{{asset_category.id}}">
</div>
{% comment %} <div class="oh-sticky-table oh-sticky-table--no-overflow mb-5" id="assetList{{asset_category.id}}">
</div> {% endcomment %}
</div>
{% endfor %}