[UPDT] ASSET: Updated asset action for v2
This commit is contained in:
@@ -2,57 +2,102 @@
|
||||
<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"
|
||||
<a
|
||||
class="oh-btn oh-btn--light-bkg w-100 flex-1"
|
||||
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 }}"
|
||||
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>
|
||||
title="{% trans 'Update' %}"
|
||||
hx-target="#genericModalBody"
|
||||
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
|
||||
class="oh-btn oh-btn--light-bkg w-100 flex-1"
|
||||
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 }}"
|
||||
title="{% trans 'Update' %}"
|
||||
hx-target="#genericModalBody"
|
||||
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">
|
||||
<a
|
||||
class="oh-btn oh-btn--light-bkg w-100 flex-1"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#genericModal"
|
||||
hx-get="{% url 'duplicate-asset' instance.id %}?{{pg}}"
|
||||
hx-target="#genericModalBody"
|
||||
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%">
|
||||
<form
|
||||
action="{% url 'asset-delete' instance.id %}?asset_list=asset_filter&{{request.GET.urlencode}}"
|
||||
class="flex-1"
|
||||
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
|
||||
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?' %}"
|
||||
<form
|
||||
hx-confirm="{% trans 'Do you want to delete this asset?' %}"
|
||||
class="flex-1"
|
||||
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%">
|
||||
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
|
||||
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 %}
|
||||
|
||||
Reference in New Issue
Block a user