[UPDT] ASSET: Updated asset app with latest horilla design
This commit is contained in:
@@ -22,6 +22,7 @@ class AssetListView(HorillaListView):
|
||||
show_filter_tags = False
|
||||
bulk_select_option = False
|
||||
action_method = "action_column"
|
||||
header_attrs = {"asset_name": "style='width:200px !important;'"}
|
||||
|
||||
def get_queryset(self, queryset=None, filtered=False, *args, **kwargs):
|
||||
return (
|
||||
|
||||
@@ -1,36 +1,60 @@
|
||||
{% load static i18n %}
|
||||
{% if perms.asset.change_asset %}
|
||||
<button class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle" data-target="#genericModal"
|
||||
hx-get="{{ instance.get_update_url }}?{% if asset_under == 'asset_filter' %}asset_under=asset_filter&{% endif %}{{ pg }}"
|
||||
hx-target="#genericModalBody" title="{% trans 'Edit' %}">
|
||||
<ion-icon name="create-outline" role="img" class="md hydrated" aria-label="create outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.asset.add_asset %}
|
||||
<button class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle" data-target="#genericModal"
|
||||
hx-get="{% url 'duplicate-asset' instance.id %}?{{pg}}" hx-target="#genericModalBody"
|
||||
title="{% trans 'Duplicate' %}">
|
||||
<ion-icon name="copy-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if asset.assetassignment_set.all %}
|
||||
<button class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle" data-target="#dynamicCreateModal"
|
||||
hx-get="{% url 'add-asset-report' asset.id %}?asset_list=true" hx-target="#dynamicCreateModalTarget"
|
||||
id="oh-btn-asset-update-modal" title="{% trans 'Report' %}">
|
||||
<ion-icon name="document-attach-outline"></ion-icon>
|
||||
</button>
|
||||
{% else %}
|
||||
<button disabled class="oh-btn oh-btn--light-bkg w-100" id="oh-btn-asset-update-modal" title="{% trans 'Report' %}">
|
||||
<ion-icon name="document-attach-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.asset.delete_asset %}
|
||||
<form hx-confirm="{% trans 'Do you want to delete this asset?' %}"
|
||||
hx-post="{{instance.get_delete_url}}?{% if asset_under == 'asset_filter' %}asset_under=asset_filter&{% endif %}{{ request.GET.urlencode }}"
|
||||
hx-target="#assetCategory{{ instance.asset_category_id.id }}" onclick="event.stopPropagation()" style="width:100%">
|
||||
{% csrf_token %}
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Delete' %}">
|
||||
<ion-icon name="trash-outline" role="img" class="md hydrated" aria-label="trash outline"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
<div class="oh-btn-group">
|
||||
{% if perms.asset.change_asset %}
|
||||
{% if asset_under == 'asset_filter' %}
|
||||
<a class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle" data-target="#objectUpdateModal"
|
||||
hx-get="{{ instance.get_update_url }}?{% if asset_under == 'asset_filter' %}asset_under=asset_filter&{% endif %}{{ pg }}"
|
||||
title="{% trans 'Update' %}" hx-target="#objectUpdateModalTarget" onclick="event.stopPropagation()"
|
||||
id="oh-btn-asset-update-modal">
|
||||
<ion-icon name="create-outline" role="img" class="md hydrated" aria-label="create outline"></ion-icon>
|
||||
</a>
|
||||
{% else %}
|
||||
<a class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle" data-target="#objectUpdateModal"
|
||||
hx-get="{{ instance.get_update_url }}?{% if asset_under == 'asset_filter' %}asset_under=asset_filter&{% endif %}{{ pg }}" title="{% trans 'Update' %}"
|
||||
hx-target="#objectUpdateModalTarget" onclick="event.stopPropagation()" id="oh-btn-asset-update-modal">
|
||||
<ion-icon name="create-outline" role="img" class="md hydrated" aria-label="create outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if perms.asset.add_asset %}
|
||||
<a class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle" data-target="#objectCreateModal"
|
||||
hx-get="{% url 'duplicate-asset' instance.id %}?{{pg}}" hx-target="#objectCreateModalTarget"
|
||||
title="{% trans 'Duplicate' %}" onclick="event.stopPropagation()" style="cursor: pointer">
|
||||
<ion-icon name="copy-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if asset.assetassignment_set.all %}
|
||||
<a class="oh-btn oh-btn--light-bkg w-100" onclick="event.preventDefault();event.stopPropagation()"
|
||||
data-toggle="oh-modal-toggle" data-target="#dynamicCreateModal"
|
||||
hx-get="{% url 'add-asset-report' instance.id %}?asset_list=true" hx-target="#dynamicCreateModalTarget"
|
||||
id="oh-btn-asset-update-modal" 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 %}
|
||||
{% if asset_under == 'asset_filter' %}
|
||||
<form action="{% url 'asset-delete' instance.id %}?asset_list=asset_filter&{{request.GET.urlencode}}"
|
||||
onsubmit="return confirm('{% trans "Do you want to delete this asset?" %}')" method="post" style="width:100%">
|
||||
{% csrf_token %}
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" onclick="event.stopPropagation()"
|
||||
title="{% trans 'Delete' %}">
|
||||
<ion-icon name="trash-outline" role="img" class="md hydrated" aria-label="trash outline"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form hx-confirm="{% trans 'Do you want to delete this asset?' %}"
|
||||
hx-post="{{instance.get_delete_url}}?{% if asset_under == 'asset_filter' %}asset_under=asset_filter&{% endif %}{{ request.GET.urlencode }}"
|
||||
hx-target="#assetCategory{{asset.asset_category_id.id}}" onclick="event.stopPropagation()" style="width:100%">
|
||||
{% csrf_token %}
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Delete' %}">
|
||||
<ion-icon name="trash-outline" role="img" class="md hydrated" aria-label="trash outline"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
{% load static i18n %}
|
||||
{% if perms.asset.change_assetlot %}
|
||||
<!-- Start of Edit Button -->
|
||||
<button data-toggle="oh-modal-toggle" data-target="#genericModal"
|
||||
hx-get="{{ instance.get_update_url }}?instance_ids={{ instance.ordered_ids }}" hx-target="#genericModalBody"
|
||||
class="w-24 px-4 py-2 bg-primary-600 text-white rounded-md text-xs flex items-center justify-center gap-2 hover:bg-primary-800 transition duration-300">
|
||||
<img src="{% static 'horilla_theme/assets/img/icons/edit.svg' %}" alt="{% trans 'Edit' %}" width="13"
|
||||
class="filter brightness-0 invert">
|
||||
{% trans 'Edit' %}
|
||||
</button>
|
||||
<!-- End of Edit Button -->
|
||||
{% endif %}
|
||||
|
||||
{% if perms.asset.delete_assetlot %}
|
||||
<!-- Start of Delete Form -->
|
||||
<form hx-confirm="{% trans 'Do you want to delete this asset ?' %}"
|
||||
hx-post="{{ instance.get_delete_url }}?instance_ids={{ instance.ordered_ids }}" hx-target="#AssetBatchList">
|
||||
{% csrf_token %}
|
||||
<button data-action="delete" type="submit"
|
||||
class="w-24 px-4 py-2 bg-white rounded-md text-xs flex items-center justify-center gap-2 border border-primary-500 hover:border-primary-600 transition duration-300">
|
||||
<img src="{% static 'horilla_theme/assets/img/icons/trash.svg' %}" alt="{% trans 'Delete' %}" width="16"
|
||||
class="mt-[-1px]">
|
||||
{% trans 'Delete' %}
|
||||
</button>
|
||||
</form>
|
||||
<!-- End of Delete Form -->
|
||||
{% load i18n %}
|
||||
{% if perms.asset.change_asset or perms.asset.delete_asset %}
|
||||
<div class="oh-modal__button-container text-center mt-3">
|
||||
<div class="oh-btn-group">
|
||||
{% if perms.asset.change_asset %}
|
||||
<a hx-get="{{ instance.get_update_url }}?instance_ids={{ instance.ordered_ids }}"
|
||||
data-toggle="oh-modal-toggle" data-target="#genericModal" hx-target="#genericModalBody"
|
||||
class="oh-btn oh-btn--info w-100">
|
||||
<ion-icon name="create-outline" role="img" class="md hydrated" aria-label="create outline"></ion-icon>
|
||||
{% trans "Edit" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.asset.delete_asset %}
|
||||
<form hx-confirm="{% trans 'Do you want to delete this asset?' %}"
|
||||
hx-post="{{ instance.get_delete_url }}?instance_ids={{ instance.ordered_ids }}"
|
||||
hx-target="#objectDetailsModalTarget" onclick="event.stopPropagation()" class="w-100">
|
||||
{% csrf_token %}
|
||||
<button type='submit' class="oh-btn oh-btn--danger w-100" data-action="delete">
|
||||
<ion-icon name="trash-outline" role="img" class="md hydrated" aria-label="create outline"></ion-icon>
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user