Upload files to "asset/templates/asset"
Signed-off-by: nestict <developer@nestict.com>
This commit is contained in:
137
asset/templates/asset/asset_creation.html
Normal file
137
asset/templates/asset/asset_creation.html
Normal file
@@ -0,0 +1,137 @@
|
||||
{% load static i18n %} {% load i18n %} {% load widget_tweaks %}
|
||||
{% if asset_creation_form.asset_category_id.initial %}
|
||||
<!-- start of messages -->
|
||||
{% if messages %}
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<script>
|
||||
setTimeout(function () {
|
||||
$(".oh-modal__close").click();
|
||||
}, 1000);
|
||||
</script>
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- end of messages -->
|
||||
|
||||
<!-- checking if the category id is present -->
|
||||
<div class="oh-modal__dialog-header pb-0">
|
||||
<button type="button" class="oh-modal__close" data-dismiss="oh-modal" aria-label="Close"
|
||||
hx-get="{%url 'asset-list' cat_id=asset_creation_form.asset_category_id.initial %}?{{request.GET.urlencode}}&category={{asset_creation_form.asset_category_id.initial}}"
|
||||
hx-target="#assetCategory{{asset_creation_form.asset_category_id.initial}}">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
|
||||
<h5>{% trans "Create" %} {{asset_creation_form.verbose_name}}</h5>
|
||||
</span>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body">
|
||||
<form hx-post="{%url 'asset-creation' asset_category_id=asset_creation_form.asset_category_id.initial %}"
|
||||
hx-target="#objectCreateModalTarget" data-id="{{asset_creation_form.asset_category_id.initial}}">
|
||||
{% csrf_token %} {{asset_creation_form.asset_category_id.as_hidden }}
|
||||
<div class="oh-profile-section pt-0" id="AssetCreationFormContainer">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.asset_name.id_for_label}}">
|
||||
{{asset_creation_form.asset_name.label}}
|
||||
</label>
|
||||
{{asset_creation_form.asset_name}}
|
||||
{{asset_creation_form.asset_name.errors}}
|
||||
</div>
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.asset_description.id_for_label}}">
|
||||
{{asset_creation_form.asset_description.label}}</label>
|
||||
{{asset_creation_form.asset_description}}
|
||||
{{asset_creation_form.asset_description.errors}}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-4 col-lg-4">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.asset_tracking_id.id_for_label}}">
|
||||
{{asset_creation_form.asset_tracking_id.label}}
|
||||
</label>
|
||||
{{asset_creation_form.asset_tracking_id}}
|
||||
{{asset_creation_form.asset_tracking_id.errors}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-4 col-lg-4">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.asset_purchase_date.id_for_label}}">
|
||||
{{asset_creation_form.asset_purchase_date.label}}
|
||||
</label>
|
||||
{{asset_creation_form.asset_purchase_date |attr:"type:date" }}
|
||||
{{asset_creation_form.asset_purchase_date.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-4 col-lg-4">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.asset_purchase_cost.id_for_label}}">
|
||||
{{asset_creation_form.asset_purchase_cost.label}}
|
||||
</label>
|
||||
{{asset_creation_form.asset_purchase_cost}}
|
||||
{{asset_creation_form.asset_purchase_cost.errors}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.asset_status.id_for_label}}">
|
||||
{{asset_creation_form.asset_status.label}}
|
||||
</label>
|
||||
{{asset_creation_form.asset_status }}
|
||||
{{asset_creation_form.asset_status.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.asset_lot_number_id.id_for_label}}">
|
||||
{{asset_creation_form.asset_lot_number_id.label}}
|
||||
</label>
|
||||
{{asset_creation_form.asset_lot_number_id }}
|
||||
{{asset_creation_form.asset_lot_number_id.errors}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-4 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.expiry_date.id_for_label}}">
|
||||
{{asset_creation_form.expiry_date.label}}
|
||||
</label>
|
||||
{{asset_creation_form.expiry_date |attr:"type:date" }}
|
||||
{{asset_creation_form.expiry_date.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-4 col-lg-6 d-none notify">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_creation_form.notify_before.id_for_label}}">
|
||||
{{asset_creation_form.notify_before.label}}
|
||||
</label>
|
||||
{{asset_creation_form.notify_before}}
|
||||
{{asset_creation_form.notify_before.errors}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-footer p-0">
|
||||
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow mt-3">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#id_expiry_date").on('change', function () {
|
||||
$(".notify").removeClass('d-none');
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
31
asset/templates/asset/asset_import.html
Normal file
31
asset/templates/asset/asset_import.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{% load i18n %}
|
||||
<div class="oh-modal__dialog-header">
|
||||
<h2 class="oh-modal__dialog-title m-0" id="assetImportLavel">
|
||||
{% trans "Import Assets" %}
|
||||
</h2>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline" role="img" class="md hydrated" aria-label="close outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body" id="assetImportModalBody">
|
||||
<div id="AssetImportResponse"></div>
|
||||
<form action="{%url 'asset-import' %}" enctype="multipart/form-data" method="post" class="oh-profile-section">
|
||||
{% csrf_token %}
|
||||
<div class="oh-dropdown__import-form">
|
||||
<label class="oh-dropdown__import-label" for="uploadFile">
|
||||
<ion-icon name="cloud-upload" class="oh-dropdown__import-form-icon"></ion-icon>
|
||||
<span class="oh-dropdown__import-form-title">{% trans "Upload a File" %}</span>
|
||||
<span class="oh-dropdown__import-form-text">{% trans "Drag and drop files here" %}</span>
|
||||
</label>
|
||||
<input type="file" name="asset_import" id="uploadFile" />
|
||||
<div class="d-inline float-end">
|
||||
<a href="#" style="text-decoration:none; display: inline-block;"
|
||||
class="oh-dropdown__link asset-info-import" data-toggle="oh-modal-toggle" onclick="getAssetImportTemplate();">
|
||||
<ion-icon name="cloud-download-outline" style="font-size:20px; vertical-align: middle;"></ion-icon>
|
||||
<span>{% trans "Download Template" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="oh-btn oh-btn--small oh-btn--secondary w-100 mt-3">{% trans "Upload" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
157
asset/templates/asset/asset_information.html
Normal file
157
asset/templates/asset/asset_information.html
Normal file
@@ -0,0 +1,157 @@
|
||||
{% load i18n %}
|
||||
|
||||
<!-- start of messages -->
|
||||
{% if messages %}
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<span class="oh-span__class" hx-trigger="load"
|
||||
hx-get="{%url 'asset-list' cat_id=asset.asset_category_id.id %}?{{pd}}"
|
||||
hx-target="#assetCategory{{asset.asset_category_id.id}}"></span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- end of messages -->
|
||||
|
||||
<div class="oh-modal__dialog-header">
|
||||
<span class="oh-modal__dialog-title" id="assetModalLabel">{{asset.asset_name}}</span>
|
||||
<button class="oh-modal__close" aria-label="Close" style="top:17px">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body oh-modal__dialog-relative">
|
||||
{% if request.GET.requests_ids %}
|
||||
<div class="oh-modal__dialog oh-modal__dialog--navigation m-0 p-0">
|
||||
<button hx-get="{% url 'asset-information' previous %}?requests_ids={{requests_ids}}&asset_info=true"
|
||||
hx-target="#objectDetailsModalTarget" class="oh-modal__diaglog-nav oh-modal__nav-prev"
|
||||
data-action="previous">
|
||||
<ion-icon name="chevron-back-outline" class="md hydrated" role="img"
|
||||
aria-label="chevron back outline"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button hx-get="{% url 'asset-information' next %}?requests_ids={{requests_ids}}&asset_info=true"
|
||||
hx-target="#objectDetailsModalTarget" class="oh-modal__diaglog-nav oh-modal__nav-next" data-action="next">
|
||||
<ion-icon name="chevron-forward-outline" class="md hydrated" role="img"
|
||||
aria-label="chevron forward outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
{% comment %}
|
||||
<div class="col-12 col-md-12 col-lg-12">
|
||||
<div class="oh-modal__group mt-2">
|
||||
<label class="oh-timeoff-modal__stat-title">{% trans "Asset Name" %}</label>
|
||||
<label class="oh-timeoff-modal__stat-count">{{asset.asset_name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
{% endcomment %}
|
||||
{% if asset.asset_description %}
|
||||
<div class="col-12 col-md-12 col-lg-12 mt-3">
|
||||
<div class="oh-modal__group">
|
||||
<label class="oh-timeoff-modal__stat-title">{% trans "Description" %}</label>
|
||||
<div class="oh-modal__description">
|
||||
{{asset.asset_description}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="col-12 col-md-12 col-lg-6 mt-3">
|
||||
<div class="oh-modal__group">
|
||||
<label class="oh-timeoff-modal__stat-title">{% trans "Tracking Id" %}</label>
|
||||
<label class="oh-timeoff-modal__stat-count">{{asset.asset_tracking_id}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-12 col-lg-6 mt-3">
|
||||
<div class="oh-modal__group">
|
||||
<label class="oh-timeoff-modal__stat-title">{% trans "Purchase Date" %}</label>
|
||||
<label class="oh-timeoff-modal__stat-count dateformat_changer">{{asset.asset_purchase_date}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-12 col-lg-6 mt-3">
|
||||
<div class="oh-modal__group">
|
||||
<label class="oh-timeoff-modal__stat-title">{% trans "Cost" %}</label>
|
||||
<label class="oh-timeoff-modal__stat-count">{{asset.asset_purchase_cost}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-12 col-lg-6 mt-3">
|
||||
<div class="oh-modal__group">
|
||||
<label class="oh-timeoff-modal__stat-title">{% trans "Status" %}</label>
|
||||
<label class="oh-timeoff-modal__stat-count">{{asset.get_asset_status_display}}
|
||||
{% if asset.asset_status == "In use" %} {% trans "by " %}
|
||||
{% with assigned=asset.assetassignment_set.last %}
|
||||
{{assigned.assigned_to_employee_id.get_full_name}}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-12 col-lg-6 mt-3">
|
||||
<div class="oh-modal__group">
|
||||
<label class="oh-timeoff-modal__stat-title">{% trans "Batch No" %}</label>
|
||||
<label class="oh-timeoff-modal__stat-count">{{asset.asset_lot_number_id}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-12 col-lg-6 mt-3">
|
||||
<div class="oh-modal__group">
|
||||
<label class="oh-timeoff-modal__stat-title">{% trans "Category" %}</label>
|
||||
<label class="oh-timeoff-modal__stat-count">{{asset.asset_category_id}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if asset.asset_report.all %}
|
||||
<div class="oh-kanban__card-footer mt-3 bg-light" style="position:relative;padding-top:0">
|
||||
<span class="mb-2" style="font-weight:600;">{% trans "Reports" %}</span>
|
||||
<button
|
||||
onclick="event.stopPropagation();$(this).siblings('.oh-kanban__card-content').toggleClass('oh-kanban__card-content--hide')"
|
||||
class="oh-kanban__card-body-collapse oh-kanban__card-collapse--down" aria-label="Toggle Options"
|
||||
title="{% trans 'Reports' %}"></button>
|
||||
<div class="oh-kanban__card-content oh-kanban__card-content--hide mt-3">
|
||||
{% for report in asset.asset_report.all %}
|
||||
<li class="pt-2 ">
|
||||
{{report.title}}
|
||||
<div class="d-flex m-2">
|
||||
{% for doc in report.documents.all %}
|
||||
<a href="{{doc.file.url}}" rel="noopener noreferrer" target="_blank"><span
|
||||
class="oh-file-icon oh-file-icon--pdf" title="{{doc}}"></span></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% 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="{% url 'asset-update' asset_id=asset.id %}?{{pg}}&requests_ids={{requests_ids}}"
|
||||
data-toggle="oh-modal-toggle" data-target="#objectUpdateModal" hx-target="#objectUpdateModalTarget"
|
||||
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="{% url 'asset-delete' asset.id %}?{{pg}}&requests_ids={{requests_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 %}
|
||||
</div>
|
||||
</div>
|
||||
297
asset/templates/asset/asset_list.html
Normal file
297
asset/templates/asset/asset_list.html
Normal file
@@ -0,0 +1,297 @@
|
||||
{% load i18n %} {% load static %}
|
||||
<script>
|
||||
$("#asset-count{{asset_category_id}}").html("{{assets.paginator.count}}");
|
||||
$("#asset-count{{asset_category_id}}").attr("title","{{assets.paginator.count}} {% trans 'Assets' %}");
|
||||
</script>
|
||||
<!-- start of messages -->
|
||||
{% if messages %}
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- end of messages -->
|
||||
<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">
|
||||
<div class="oh-sticky-table__th">{% trans "Asset" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Tracking Id" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Batch No" %}</div>
|
||||
{% if perms.asset.change_asset or perms.asset.delete_asset %}
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody" id="assetPaginatorTarget">
|
||||
{% for asset in assets %}
|
||||
<div
|
||||
class="oh-sticky-table__tr"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectDetailsModal"
|
||||
hx-get="{% url 'asset-information' asset_id=asset.id %}?{{pd}}&requests_ids={{requests_ids}}"
|
||||
hx-target="#objectDetailsModalTarget"
|
||||
id="assetDelete{{asset.id}}"
|
||||
draggable="true"
|
||||
>
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img
|
||||
src="https://ui-avatars.com/api/?name={{asset.asset_name}}&background=random"
|
||||
class="oh-profile__image"
|
||||
alt="Mary Magdalene"
|
||||
/>
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark"
|
||||
>{{asset.asset_name}}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">{% trans asset.asset_status %}</div>
|
||||
<div class="oh-sticky-table__td">{{asset.asset_tracking_id}}</div>
|
||||
<div class="oh-sticky-table__td">{{asset.asset_lot_number_id}}</div>
|
||||
{% if perms.asset.change_asset or perms.asset.delete_asset %}
|
||||
<div class="oh-sticky-table__td oh-sticky-table__right">
|
||||
<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="{% url 'asset-update' asset_id=asset.id %}?asset_under=asset_filter&{{request.GET.urlencode}}"
|
||||
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="{% url 'asset-update' asset_id=asset.id %}?{{request.GET.urlencode}}"
|
||||
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' asset.id %}?{{request.GET.urlencode}}"
|
||||
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' asset.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' asset.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="{% url 'asset-delete' asset_id=asset.id %}?{{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>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- pagination start -->
|
||||
<div class="oh-pagination">
|
||||
<span
|
||||
class="oh-pagination__page"
|
||||
data-toggle="modal"
|
||||
data-target="#addEmployeeModal"
|
||||
></span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
|
||||
<input
|
||||
type="number"
|
||||
name="page"
|
||||
class="oh-pagination__input"
|
||||
value="{{assets.number }}"
|
||||
min="1"
|
||||
hx-get="{% url 'asset-list' cat_id=asset_category_id %}?{{request.GET.urlencode}}"
|
||||
hx-target="#assetCategory{{asset_category_id}}"
|
||||
/>
|
||||
<span class="oh-pagination__label"
|
||||
>{% trans "of" %} {{ assets.paginator.num_pages }}</span
|
||||
>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if assets.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'asset-list' cat_id=asset_category_id %}?{{request.GET.urlencode}}&page=1"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#assetCategory{{asset_category_id}}"
|
||||
>{% trans "First" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'asset-list' cat_id=asset_category_id %}?{{request.GET.urlencode}}&page={{ assets.previous_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
hx-target="#assetCategory{{asset_category_id}}"
|
||||
>{% trans "Previous" %}</a
|
||||
>
|
||||
</li>
|
||||
{%endif %} {% if assets.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'asset-list' cat_id=asset_category_id %}?{{request.GET.urlencode}}&page={{ assets.next_page_number }}"
|
||||
class="btn btn-outline-secondary"
|
||||
hx-target="#assetCategory{{asset_category_id}}"
|
||||
>{% trans "Next" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-get="{% url 'asset-list' cat_id=asset_category_id %}?{{request.GET.urlencode}}&page={{ assets.paginator.num_pages }}"
|
||||
hx-target="#assetCategory{{asset_category_id}}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Last" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- this tag is used to identify if asset is under category or filter -->
|
||||
<p style="display: none" id="asset_under">{{asset_under}}</p>
|
||||
<p style="display: none" id="asset-count-updated">{{ asset_count }}</p>
|
||||
<p style="display: none" id="asset-category">{{ asset_category_id }}</p>
|
||||
|
||||
<!-- end of pagination -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// asset delete
|
||||
$(".asset-delete").on("click", function () {
|
||||
var assetCategoryId = $(this).attr("data-category-id").trim();
|
||||
setTimeout(function () {
|
||||
updateAssetCount(assetCategoryId);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
// asset pagination target change
|
||||
var asset_under = $("#asset_under").text().trim();
|
||||
// if the asset is filter the hx-target will be changed
|
||||
if (asset_under === "asset_filter") {
|
||||
// the asset list is loaded in filter so the pagination target is
|
||||
$(".oh-pagination *[hx-target]").each(function () {
|
||||
$(this).attr("hx-target", "#assetCategoryList");
|
||||
});
|
||||
}
|
||||
|
||||
// asset count update
|
||||
function updateAssetCount(assetCategoryId) {
|
||||
var csrf_token = $('input[name="csrfmiddlewaretoken"]').attr("value");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/asset/asset-count-update",
|
||||
data: {
|
||||
asset_category_id: assetCategoryId,
|
||||
csrfmiddlewaretoken: csrf_token,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
$(`#asset-count${assetCategoryId}`).text(response);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
54
asset/templates/asset/asset_report_form.html
Normal file
54
asset/templates/asset/asset_report_form.html
Normal file
@@ -0,0 +1,54 @@
|
||||
{% load i18n %}
|
||||
{% if messages %}
|
||||
<script>
|
||||
setTimeout(function () {
|
||||
$('#dynamicCreateModalHeader').children(".oh-modal__close--custom").click();
|
||||
reloadMessage();
|
||||
}, 500);
|
||||
</script>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-header" id="dynamicCreateModalHeader">
|
||||
<h2 class="oh-modal__dialog-title" id="addAssetReportLabel">{% trans 'Add Asset Report' %}</h2>
|
||||
<button type="button" class="oh-modal__close--custom"
|
||||
onclick="$(this).closest('.oh-modal--show').removeClass('oh-modal--show');"><ion-icon name="close-outline"
|
||||
role="img" aria-label="close outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body">
|
||||
<form id="add-form" hx-post="{% url 'add-asset-report' %}" hx-target="#dynamicCreateModalTarget"
|
||||
hx-encoding="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<input type="text" hidden name="asset_id" value="{{ asset_id }}" />
|
||||
<div class="oh-profile-section pt-0">
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-4 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{ asset_report_form.title.id_for_label }}">
|
||||
{% trans 'Title' %}
|
||||
</label>
|
||||
{{ asset_report_form.title }}
|
||||
{{ asset_report_form.title.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-4 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{ asset_report_form.asset_id.id_for_label }}">
|
||||
{% trans 'Asset' %}
|
||||
</label>
|
||||
{{ asset_report_form.asset_id }}
|
||||
{{ asset_report_form.asset_id.errors }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="fileUpload">{% trans 'File' %}</label>
|
||||
<input name="file" multiple="True" type="file" id="fileUpload" />
|
||||
</div>
|
||||
<div class="oh-modal__dialog-footer p-0">
|
||||
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
60
asset/templates/asset/asset_return_form.html
Normal file
60
asset/templates/asset/asset_return_form.html
Normal file
@@ -0,0 +1,60 @@
|
||||
{% load i18n %} {% load horillafilters %}
|
||||
<div class="oh-modal__dialog-header pb-0">
|
||||
<button type="button" class="oh-modal_close--custom"
|
||||
onclick="$('#objectCreateModal').removeClass('oh-modal--show');">
|
||||
<ion-icon name="close-outline" role="img" aria-label="close outline" class="md hydrated"></ion-icon>
|
||||
</button>
|
||||
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
|
||||
<h5>{% trans "Asset Return Form" %}</h5>
|
||||
</span>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body">
|
||||
<form hx-post="{%url 'asset-allocate-return' asset_id=asset_id %}" hx-target="#objectCreateModalTarget"
|
||||
hx-encoding="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="oh-profile-section pt-0">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="objective">
|
||||
{{asset_return_form.return_status.label}}</label>
|
||||
{{asset_return_form.return_status}}
|
||||
</div>
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="objective">
|
||||
{{asset_return_form.return_date.label}}</label>
|
||||
{{asset_return_form.return_date}}
|
||||
{{asset_return_form.return_date.errors}}
|
||||
</div>
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="objective">
|
||||
{{asset_return_form.return_condition.label}}</label>
|
||||
{{asset_return_form.return_condition}}
|
||||
</div>
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="objective">
|
||||
{{asset_return_form.return_images.label}}
|
||||
</label>
|
||||
{{asset_return_form.return_images}}
|
||||
</div>
|
||||
<div class="oh-btn-group mt-4">
|
||||
<button class="oh-btn oh-btn--info oh-btn--shadow w-100" type="button" data-toggle="oh-modal-toggle"
|
||||
data-target="#dynamicCreateModal" hx-get="{% url 'add-asset-report' asset_id %}"
|
||||
hx-target="#dynamicCreateModalTarget">
|
||||
{% trans "Add Report" %}
|
||||
</button>
|
||||
{% if "payroll"|app_installed %}
|
||||
{% if perms.payroll.add_loanaccount %}
|
||||
<button class="oh-btn oh-btn--primary oh-btn--shadow w-100 ml-2" type="button"
|
||||
hx-get="{% url 'asset-fine' %}?employee_id={{asset_alocation.assigned_to_employee_id.id}}&asset_id={{asset_id}}"
|
||||
hx-target="#dynamicCreateModalTarget" data-toggle="oh-modal-toggle"
|
||||
data-target="#dynamicCreateModal">
|
||||
{% trans "Add Fine" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow w-100 ml-2">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
236
asset/templates/asset/asset_update.html
Normal file
236
asset/templates/asset/asset_update.html
Normal file
@@ -0,0 +1,236 @@
|
||||
{% load static i18n %}
|
||||
{% if asset_form.instance.id %}
|
||||
<!-- start of messages -->
|
||||
{% if messages %}
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<script>
|
||||
{% if requests_ids %}
|
||||
setTimeout(function () {
|
||||
$('.oh-modal__close--custom').click()
|
||||
}, 1000);
|
||||
{% else %}
|
||||
setTimeout(function () {
|
||||
$('.oh-modal__close').click()
|
||||
}, 1000);
|
||||
{% endif %}
|
||||
</script>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="successMessage" style="display:none" class="oh-alert oh-alert--animated oh-alert--success">
|
||||
{% trans "Report added successfully." %}
|
||||
</div>
|
||||
|
||||
{% if asset_form.errors %}
|
||||
<div class="oh-wrapper">
|
||||
{% for error in asset_form.non_field_errors %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated oh-alert--danger">
|
||||
{{ error }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- end of messages -->
|
||||
|
||||
<div class="oh-modal__dialog-header">
|
||||
{% if messages %}
|
||||
{% if asset_under == 'asset_filter' %}
|
||||
<button class="oh-modal__close" aria-label="Close"
|
||||
hx-get="{%url 'asset-list' cat_id=0 %}?asset_list=asset_filter&{{pg}}" hx-target="#assetCategoryList">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
{% elif requests_ids %}
|
||||
<button class="oh-modal__close--custom" aria-label="Close"
|
||||
hx-get="{% url 'asset-information' asset_id=asset_form.instance.id %}?requests_ids={{requests_ids}}"
|
||||
hx-target="#objectDetailsModalTarget"
|
||||
onclick="$(this).parents().closest('.oh-modal--show').toggleClass('oh-modal--show')">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
{% else %}
|
||||
<button class="oh-modal__close" aria-label="Close" hx-get="{%url 'asset-list' cat_id=asset_cat_id %}?{{pg}}"
|
||||
hx-target="#assetCategory{{asset_cat_id}}">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<button type="button" class="oh-modal__close--custom" data-dismiss="oh-modal" aria-label="Close"
|
||||
onclick="$(this).parents().closest('.oh-modal--show').toggleClass('oh-modal--show')">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
<span class="oh-modal__dialog-title ml-5" id="addEmployeeObjectiveModalLabel">
|
||||
<h5>{% trans "Update" %} {{asset_form.verbose_name}}</h5>
|
||||
</span>
|
||||
</div>
|
||||
<div class="oh-modal__dialog-body">
|
||||
<form hx-post="{%url 'asset-update' asset_id=asset_form.instance.id %}?requests_ids={{requests_ids}}&{{pg}}"
|
||||
hx-target="#objectUpdateModalTarget">
|
||||
{% if asset_under == 'asset_filter' %}
|
||||
<input type="hidden" name="asset_under" value="asset_filter">
|
||||
{%endif %}
|
||||
{% csrf_token %}
|
||||
<div class="oh-profile-section pt-0">
|
||||
<section>
|
||||
<div id="ObjecitveContainer">
|
||||
<div class="my-3" id="keyResultCard">
|
||||
<div class=" " id="assetUpdateFormContainer">
|
||||
<div class="row">
|
||||
<div class="col-12 {% if instance.asset_status == "In use" and instance.assetassignment_set.last %}col-sm-12 col-md-6 col-lg-6 {% endif %}">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_form.asset_name.id_for_label}}">
|
||||
{{asset_form.asset_name.label}}
|
||||
</label>
|
||||
{{asset_form.asset_name}}
|
||||
{{asset_form.asset_name.errors}}
|
||||
</div>
|
||||
</div>
|
||||
{% if instance.asset_status == "In use" and instance.assetassignment_set.last %}
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_form.owner.id_for_label}}">
|
||||
{{asset_form.owner.label}}
|
||||
</label>
|
||||
{% with assigned=instance.assetassignment_set.last %}
|
||||
<input type="text" class="oh-input w-100"
|
||||
value="{{ assigned.assigned_to_employee_id }}" readonly>
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="oh-input__group ">
|
||||
<label class="oh-input__label" for="{{asset_form.asset_description.id_for_label}}">
|
||||
{{asset_form.asset_description.label}}
|
||||
</label>
|
||||
{{asset_form.asset_description}}
|
||||
{{asset_form.asset_description.errors}}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label"
|
||||
for="{{asset_form.asset_tracking_id.id_for_label}}">
|
||||
{{asset_form.asset_tracking_id.label}}
|
||||
</label>
|
||||
{{asset_form.asset_tracking_id}}
|
||||
{{asset_form.asset_tracking_id.errors}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label"
|
||||
for="{{asset_form.asset_category_id.id_for_label}}">
|
||||
{{asset_form.asset_category_id.label }}
|
||||
</label>
|
||||
{{asset_form.asset_category_id }}
|
||||
{{asset_form.asset_category_id.errors }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label"
|
||||
for="{{asset_form.asset_purchase_date.id_for_label}}">
|
||||
{{asset_form.asset_purchase_date.label}}
|
||||
</label>
|
||||
{{asset_form.asset_purchase_date }}
|
||||
{{asset_form.asset_purchase_date.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label"
|
||||
for="{{asset_form.asset_purchase_cost.id_for_label}}">
|
||||
{{asset_form.asset_purchase_cost.label}}
|
||||
</label>
|
||||
{{asset_form.asset_purchase_cost}}
|
||||
{{asset_form.asset_purchase_cost.errors}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_form.asset_status.id_for_label}}">
|
||||
{{asset_form.asset_status.label}}
|
||||
</label>
|
||||
{{asset_form.asset_status}}
|
||||
{{asset_form.asset_status.errors}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label"
|
||||
for="{{asset_form.asset_lot_number_id.id_for_label}}">
|
||||
{{asset_form.asset_lot_number_id.label}}
|
||||
</label>
|
||||
{{asset_form.asset_lot_number_id}}
|
||||
{{asset_form.asset_lot_number_id.errors}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label" for="{{asset_form.expiry_date.id_for_label}}">
|
||||
{{asset_form.expiry_date.label}}
|
||||
</label>
|
||||
{{asset_form.expiry_date}}
|
||||
{{asset_form.expiry_date.errors}}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="col-12 col-sm-12 col-md-6 col-lg-6 {% if not asset_form.expiry_date.value %} d-none {% endif %} notify">
|
||||
<div class="oh-input__group">
|
||||
<label class="oh-input__label"
|
||||
for="{{asset_form.notify_before.id_for_label}}">
|
||||
{{asset_form.notify_before.label}}
|
||||
</label>
|
||||
{{asset_form.notify_before}}
|
||||
{{asset_form.notify_before.errors}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="oh-btn-group flex-row-reverse mt-4" style="border:none;">
|
||||
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
<button class="oh-btn oh-btn--info oh-btn--shadow mr-2"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#dynamicCreateModal"
|
||||
onclick="event.preventDefault();event.stopPropagation()"
|
||||
hx-get="{% url 'add-asset-report' asset_form.instance.id %}?asset_list=true"
|
||||
hx-target="#dynamicCreateModalTarget"
|
||||
{% if not asset_form.instance.assetassignment_set.all %}
|
||||
disabled
|
||||
title="{% trans 'Assign asset before adding a report' %}"
|
||||
{% endif %}>
|
||||
{% trans "Add Report" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#id_expiry_date").on('change', function () {
|
||||
$(".notify").removeClass('d-none');
|
||||
})
|
||||
})
|
||||
$("#id_expiry_date").change()
|
||||
</script>
|
||||
129
asset/templates/asset/dashboard.html
Normal file
129
asset/templates/asset/dashboard.html
Normal file
@@ -0,0 +1,129 @@
|
||||
{% extends 'index.html' %}
|
||||
{% block content %}
|
||||
{% load static i18n %}
|
||||
{% load i18n %}
|
||||
<style>
|
||||
.oh-sticky-table{
|
||||
max-height:100% !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- End of Navigation -->
|
||||
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
|
||||
<div class="oh-wrapper">
|
||||
<div class="d-none mt-5" id="back_button" style="width:10%">
|
||||
<a href=""
|
||||
class="oh-btn oh-btn--secondary oh-btn--shadow ms-3">
|
||||
<ion-icon
|
||||
class="me-2 md hydrated"
|
||||
name="arrow-back-outline"
|
||||
role="img"
|
||||
aria-label="arrow-back-outline">
|
||||
</ion-icon>
|
||||
{% trans "Back" %}
|
||||
</a>
|
||||
</div>
|
||||
<div class="oh-dashboard row" id="dashboard">
|
||||
<div class="oh-dashboard__left col-12 col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="oh-dashboard__cards row">
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-4 filter">
|
||||
<div class="oh-card-dashboard oh-card-dashboard oh-card-dashboard--success" >
|
||||
<a href="#" class="text-decoration-none recruitment">
|
||||
<div class="oh-card-dashboard__header">
|
||||
<span class="oh-card-dashboard__title">{% trans "Assets" %}</span>
|
||||
</div>
|
||||
<div class="oh-card-dashboard__body">
|
||||
<span class="oh-card-dashboard__count">{{assets|length}}</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-4 filter">
|
||||
<div class="oh-card-dashboard oh-card-dashboard--warning"
|
||||
{% comment %} hx-get="{% url 'asset-request-allocation-view-search-filter' %}?asset_request_status=Requested"
|
||||
hx-target="#dashboard" {% endcomment %}
|
||||
onclick = 'localStorage.setItem("activeTabAsset", "#tab_1");
|
||||
window.location.href="/asset/asset-request-allocation-view/?asset_request_status=Requested";'
|
||||
id="asset_request_view"
|
||||
>
|
||||
<div class="oh-card-dashboard__header">
|
||||
<span class="oh-card-dashboard__title">{% trans "Asset request" %}</span>
|
||||
</div>
|
||||
<div class="oh-card-dashboard__body">
|
||||
<span class="oh-card-dashboard__count">{{asset_requests|length}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-4 filter">
|
||||
<div class="oh-card-dashboard oh-card-dashboard--success"
|
||||
onclick=" window.location.href = `{%url 'asset-category-view' %}?dashboard=true`"
|
||||
hx-target="#dashboard"
|
||||
id="hired_candidate"
|
||||
>
|
||||
<div style="text-decoration: none;" class="oh-card-dashboard__header">
|
||||
<span class="oh-card-dashboard__title">{% trans "Assets in use" %}</span>
|
||||
</div>
|
||||
<div class="oh-card-dashboard__body">
|
||||
<a style="text-decoration: none;" class="oh-card-dashboard__counts">
|
||||
<span class="oh-card-dashboard__count"> {{asset_in_use|length}} </span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-dashboard__movable-cards row mt-4 mb-4">
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-3 mt-2">
|
||||
<div class="oh-card-dashboard oh-card-dashboard--no-scale oh-card-dashboard--transparent">
|
||||
<div class="oh-card-dashboard__header oh-card-dashboard__header--divider">
|
||||
<span class="oh-card-dashboard__title" >{% trans "Asset Chart" %}</span>
|
||||
</div>
|
||||
<div class="oh-card-dashboard__body" id="assetAvailableChartContainer">
|
||||
<canvas id="assetAvailableChart" ></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-9">
|
||||
<div class="oh-card-dashboard oh-card-dashboard--no-scale oh-card-dashboard--transparent">
|
||||
<div class="oh-card-dashboard__header oh-card-dashboard__header--divider">
|
||||
<span class="oh-card-dashboard__title">{% trans "Asset Requests To Approve" %}</span>
|
||||
</div>
|
||||
<div class="oh-card-dashboard__body" id="dashboardAssetRequests" style="height:330px;overflow-y:auto"
|
||||
hx-get="{% url 'asset-dashboard-requests' %}" hx-trigger="load">
|
||||
<div class="animated-background"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-6 mt-3">
|
||||
<div class="oh-card-dashboard oh-card-dashboard--no-scale oh-card-dashboard--transparent">
|
||||
<div class="oh-card-dashboard__header oh-card-dashboard__header--divider">
|
||||
<span class="oh-card-dashboard__title" >{% trans "Assets In Use" %}</span>
|
||||
</div>
|
||||
<div class="oh-card-dashboard__body" id="assetCategoryChartContainer">
|
||||
<canvas id="assetCategoryChart" ></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-6 mt-3">
|
||||
<div class="oh-card-dashboard oh-card-dashboard--no-scale oh-card-dashboard--transparent">
|
||||
<div class="oh-card-dashboard__header oh-card-dashboard__header--divider">
|
||||
<span class="oh-card-dashboard__title">{% trans "Allocated Assets" %}</span>
|
||||
</div>
|
||||
<div class="oh-card-dashboard__body" id="dashboardAssetAllocates" style="height:350px;overflow-y:auto">
|
||||
<span hx-get="{% url 'asset-dashboard-allocates' %}" hx-trigger="load" hx-swap="outerHTML">
|
||||
<div class="animated-background"></div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script src="{% static 'src/asset/dashboard.js' %}"></script>
|
||||
{% endblock content %}
|
||||
41
asset/templates/asset/dashboard_allocated_assets.html
Normal file
41
asset/templates/asset/dashboard_allocated_assets.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% if asset_allocations %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Allocated User" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Asset" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Assigned Date" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for asset_allocation in asset_allocations %}
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img src="{{asset_allocation.assigned_to_employee_id.get_avatar}}" class="oh-profile__image" alt="" />
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark">{{asset_allocation.assigned_to_employee_id}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{{asset_allocation.asset_id}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{asset_allocation.assigned_date}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="oh-empty h-100">
|
||||
<img src="{% static 'images/ui/search.svg' %}" class="oh-404__image" alt="Page not found. 404." />
|
||||
<h1 class="oh-empty__title">{% trans "No Records found." %}</h1>
|
||||
<p class="oh-empty__subtitle">{% trans "There is no asset allocation at this moment." %}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
104
asset/templates/asset/dashboard_asset_requests.html
Normal file
104
asset/templates/asset/dashboard_asset_requests.html
Normal file
@@ -0,0 +1,104 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% if messages %}
|
||||
<script>reloadMessage();</script>
|
||||
{% endif %}
|
||||
{% if asset_requests %}
|
||||
<div class="oh-sticky-table h-100">
|
||||
<div class="oh-sticky-table__table">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Request User" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Asset Category" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Request Date" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Status" %}</div>
|
||||
{% if perms.asset.add_assetassignment %}
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
<div id="assetRequestAllocationTarget"></div>
|
||||
{% for asset_request in asset_requests %}
|
||||
<!-- asset request looping -->
|
||||
<div
|
||||
class="oh-sticky-table__tr"
|
||||
draggable="true"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectDetailsModalW25"
|
||||
hx-get="{% url 'asset-request-individual-view' asset_request.id %}?requests_ids={{requests_ids}}"
|
||||
hx-target="#objectDetailsModalW25Target"
|
||||
>
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img
|
||||
src="{{asset_request.requested_employee_id.get_avatar}}"
|
||||
class="oh-profile__image"
|
||||
alt="Mary Magdalene"
|
||||
/>
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark"
|
||||
>{{asset_request.requested_employee_id}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{{asset_request.asset_category_id}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{ asset_request.asset_request_date }}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="d-flex align-items-center">
|
||||
<span
|
||||
class="oh-dot oh-dot--small me-1 oh-dot--color {{asset_request.status_html_class.color}}"
|
||||
></span
|
||||
><span
|
||||
class="{{asset_request.status_html_class.link}}"
|
||||
>{% trans asset_request.asset_request_status %}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{% if perms.asset.add_assetassignment %}
|
||||
{% if asset_request.asset_request_status == 'Requested' %}
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
<a
|
||||
class="oh-btn oh-btn--success w-50"
|
||||
role="button"
|
||||
onclick="event.stopPropagation()"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
hx-get="{% url 'asset-request-approve' req_id=asset_request.id %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
title="Approve request"
|
||||
>
|
||||
<ion-icon name="checkmark-outline"></ion-icon>
|
||||
</a>
|
||||
<form hx-confirm="{% trans 'Do you want to reject this request?' %}"
|
||||
hx-post="{% url 'asset-request-reject' req_id=asset_request.id %}"
|
||||
hx-target="#dashboardAssetRequests"
|
||||
class="w-50"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button class="oh-btn oh-btn--danger w-100" onclick="event.stopPropagation()">
|
||||
<ion-icon name="close-circle-outline"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="oh-empty h-100">
|
||||
<img src="{% static 'images/ui/search.svg' %}" class="oh-404__image" alt="Page not found. 404." />
|
||||
<h1 class="oh-empty__title">{% trans "No Records found." %}</h1>
|
||||
<p class="oh-empty__subtitle">{% trans "No records available at the moment." %}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user