diff --git a/asset/cbv/asset.py b/asset/cbv/asset.py deleted file mode 100644 index 40da77832..000000000 --- a/asset/cbv/asset.py +++ /dev/null @@ -1,67 +0,0 @@ -from typing import Any - -from django.utils.decorators import method_decorator -from django.utils.translation import gettext_lazy as _ - -from asset.filters import AssetFilter -from asset.models import Asset -from horilla_views.cbv_methods import login_required, permission_required -from horilla_views.generic.cbv.views import HorillaDetailedView, HorillaListView - - -@method_decorator(login_required, name="dispatch") -@method_decorator(permission_required("asset.view_assetlot"), name="dispatch") -class AssetListView(HorillaListView): - """ - list view for batch number - """ - - model = Asset - filter_class = AssetFilter - columns = ["asset_name", "asset_status", "asset_tracking_id", "asset_lot_number_id"] - 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 ( - super() - .get_queryset(queryset, filtered, *args, **kwargs) - .filter(asset_category_id=self.kwargs["cat_id"]) - ) - - row_attrs = """ - hx-get='{asset_detail}?instance_ids={ordered_ids}' - hx-target="#genericModalBody" - data-target="#genericModal" - data-toggle="oh-modal-toggle" - """ - - -class AssetInformationView(HorillaDetailedView): - """ - Detail view of the page - """ - - def get_context_data(self, **kwargs: Any): - """ - Return context data with the title set to the contract's name. - """ - - context = super().get_context_data(**kwargs) - asset_name = context["asset"].asset_name - context["title"] = asset_name - return context - - model = Asset - header = False - action_method = "detail_view_action" - body = [ - "asset_tracking_id", - "asset_purchase_date", - "asset_purchase_cost", - "asset_status", - "asset_lot_number_id", - "asset_category_id", - ] diff --git a/asset/cbv/request_and_allocation.py b/asset/cbv/request_and_allocation.py index 65e9a7510..aa1048c59 100644 --- a/asset/cbv/request_and_allocation.py +++ b/asset/cbv/request_and_allocation.py @@ -56,7 +56,7 @@ class AllocationList(HorillaListView): self.search_url = reverse("list-asset") columns = [ - (_("Asset"), "asset_id__asset_name", "get_avatar"), + (_("Asset"), "asset_id", "get_avatar"), (_("Category"), "asset_id__asset_category_id"), (_("Expiry Date"), "asset_id__expiry_date"), ] diff --git a/asset/static/src/asset/dashboard.js b/asset/static/src/asset/dashboard.js index ed9e860e4..dc14f98e7 100644 --- a/asset/static/src/asset/dashboard.js +++ b/asset/static/src/asset/dashboard.js @@ -88,7 +88,7 @@ function emptyAssetAvialabeChart(assetAvailableChartChart, args, options) { message = assetAvailableChartChart.data.message ? assetAvailableChartChart.data.message - : emptyMessages[languageCode]; + : i18nMessages.emptyMessages; noDataImage.onload = () => { // Draw image first at center diff --git a/asset/static/src/asset_category/assetCategoryView.js b/asset/static/src/asset_category/assetCategoryView.js index 067484df4..d218e3dd1 100644 --- a/asset/static/src/asset_category/assetCategoryView.js +++ b/asset/static/src/asset_category/assetCategoryView.js @@ -17,13 +17,13 @@ function getCookie(name) { function getAssetImportTemplate() { // Use SweetAlert for the confirmation dialog Swal.fire({ - text: gettext("Do you want to download the template?"), + text: i18nMessages.downloadTemplate, icon: "question", showCancelButton: true, confirmButtonColor: "#008000", cancelButtonColor: "#d33", - confirmButtonText: gettext("Confirm"), - cancelButtonText: gettext("Cancel"), + confirmButtonText: i18nMessages.confirm, + cancelButtonText: i18nMessages.cancel, }).then(function (result) { if (result.isConfirmed) { $.ajax({ diff --git a/asset/templates/asset/action_column.html b/asset/templates/asset/action_column.html deleted file mode 100644 index 9cb2851b2..000000000 --- a/asset/templates/asset/action_column.html +++ /dev/null @@ -1,60 +0,0 @@ -{% load static i18n %} -