瀏覽代碼

service category detail pages filled with content

ShariX Developer 1 天之前
父節點
當前提交
d882d6e30a

+ 12 - 8
sharix_admin/tables.py

@@ -459,10 +459,14 @@ class ServiceTariffsTable(tables.Table):
 
 
 class ServiceCategoriesTable(tables.Table):
-    id = tables.Column(attrs={"td": {"width": "50px"}})
+    id = tables.LinkColumn(
+        'sharix_admin:service_category_detail',
+        args=[tables.A('pk')],
+        attrs={"td": {"width": "50px"}}
+        )
 
     caption = tables.LinkColumn(
-        'sharix_admin:service_category/edit/',
+        'sharix_admin:service_category_detail',
         verbose_name='Услуга',
         orderable=False,
         text=lambda record: record.caption,
@@ -486,11 +490,11 @@ class ServiceCategoriesTable(tables.Table):
     #        "td": {"class": "name_col"}
     #    }
     #)
-    description = tables.LinkColumn(
-        'sharix_admin:service_category/edit/',
-        orderable=False, verbose_name='Описание',
-        text=lambda record: record.description,
-        args=[tables.A('pk')],
+    description = tables.Column(
+        orderable=False,
+        #verbose_name='Описание',
+        #text=lambda record: record.description,
+        #args=[tables.A('pk')],
         attrs={
             "a": {"style": "pointer-events: none;"},
             'th': {'scope': 'col'},
@@ -499,7 +503,7 @@ class ServiceCategoriesTable(tables.Table):
     )
 
     metaservice_comission = tables.Column(
-        verbose_name=_('Комиссия Сервиса'),
+        #verbose_name=_('Комиссия Сервиса'),
         attrs={
             'th': {'scope': 'col'},
             "td": {"width": "15%"}}

+ 6 - 12
sharix_admin/templates/sharix_admin/service_category_detail.html

@@ -8,20 +8,14 @@
 
 <div class="card w-100 mb-4">
     <div class="card-body position-relative">
-        <h5 class="card-title fw-bold mb-4">{{ service_category.caprion }}</h5>
+        <h5 class="card-title fw-bold mb-4">{{ service_category.caption }}</h5>
 
         <ul class="list-style-none">
-            <li><b>Кодовое название</b> {{ service_category.codename }}</li>
-	    {% comment %}
-	    <li><b>Юр. адрес</b> {{ company.address }}</li>
-            
-            <li><b>ИНН</b> {{ company.inn }}</li>
-            <li><b>ОГРН</b> {{ company.ogrn }}</li>
-            <li><b>Р/c</b> {{ company.rs }}</li>
-            <li><b>К/c</b> {{ company.ks }}</li>
-            <li><b>БИК</b> {{ company.bik }}</li>
-            <li><b>Банк</b> {{ company.bank_name }}</li>
-	    {% endcomment %}
+		<li><b>{{ captions.status }}</b> {{ service_category.status }}</li>
+		<li><b>{{ captions.description }}</b> {{ service_category.description }}</li>
+		<li><b>{{ captions.link_agreement }}</b> {{ service_category.link_agreement }}</li>
+		<li><b>{{ captions.price_type }}</b> {{ service_category.price_type }}</li>
+		<li><b>{{ captions.metaservice_comission }}</b> {{ service_category.metaservice_comission }}</li>
         </ul>
     </div>
     {% comment %}    <a class="btn btn-primary btn-edit" href="{% url "sharix_admin:partner/edit" %}">

+ 1 - 1
sharix_admin/urls.py

@@ -79,7 +79,7 @@ urlpatterns = [
     path('service_tariff/change_status/', change_service_status, name='service_tariff/change_status'),
 
     path('service_categories/', login_required(ServiceCategoriesListView.as_view()), name='service_categories'),
-    path('service_category/<int:pk>', login_required(ServiceCategoryDetailView.as_view()), name='service_category'),
+    path('service_category/<int:pk>', login_required(ServiceCategoryDetailView.as_view()), name='service_category_detail'),
     path('service_category/edit/<int:pk>', login_required(ServiceCategoryUpdateView.as_view()), name='service_category/edit/'),
     path('service_category/add/', login_required(ServiceCategoryCreate.as_view()), name='service_category/add/'),
     path('service_category/change_status/', change_service_category_status, name='service_category/change_status'),

+ 12 - 1
sharix_admin/views/service_category.py

@@ -19,6 +19,9 @@ from django.contrib import messages
 from django.db.models import Q
 from django.contrib.auth.mixins import UserPassesTestMixin
 
+from dbsynce.docs.database.service_category import ServiceCategory as ServiceCategoryHelpTexts
+from dbsynce.docs.verbose_names.service_category import ServiceCategory as ServiceCategoryVerboseNames
+
 class ServiceCategoryCreate(BaseView, FormView):
     form_class = ServiceCategoryCreateForm
     template_name = "sharix_admin/service_category_form.html"
@@ -260,6 +263,14 @@ class ServiceCategoryDetailView(BaseView, DetailView):
         except ServiceCategory.DoesNotExist:
             raise Http404('ServiceCategory does not exist')
 
-        return render(request, template_name, context={'service_category': service_category})
+        return render(request, template_name, context={
+            'help_texts': ServiceCategoryHelpTexts,
+            'captions': ServiceCategoryVerboseNames,
+            })
 
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context['help_texts'] = ServiceCategoryHelpTexts
+        context['captions'] = ServiceCategoryVerboseNames
+        return context