Nastya 11 miesięcy temu
rodzic
commit
098d1a49bc

+ 17 - 3
SharixAdmin/forms.py

@@ -61,7 +61,7 @@ class ServiceTariffCreateForm(forms.ModelForm):
             'servicetype_id': forms.Select(attrs={'class': 'form-select'}),
             'id_provider': forms.Select(attrs={'class': 'form-select'}),
             'resource_id': forms.Select(attrs={'class': 'form-select'}),
-            'ticket_status': forms.Select(attrs={'class': 'form-select'}),
+            'ticket_status': forms.TextInput(attrs={'readonly': True}),
         }
 
 class ServiceTypeUpdateForm(forms.ModelForm):
@@ -76,16 +76,30 @@ class ServiceTypeUpdateForm(forms.ModelForm):
             'status': forms.TextInput(attrs={'readonly': True}),
             'ticket_status': forms.TextInput(attrs={'readonly': True}),
         }
+        
 
+PRICE_CHOICES = [
+    ('one', 'text #1'),
+    ('two', 'text #2'),
+    ('three', 'text #3'),
+]
 class ServiceTypeCreateForm(forms.ModelForm):
+    codename = forms.CharField(label="Название услуги")
+    requirements = forms.CharField(label="Требования")
+    price_type = forms.ChoiceField(choices=PRICE_CHOICES, label="Ценообразование")
+    description = forms.CharField(label="Описание")
+    is_global = forms.BooleanField(label="Доступно во всех сервисах")
+    is_visible = forms.BooleanField(label="Доступно для планирования цепочек во всех сервисах")
     def __init__(self, *args, **kwargs):
         super(ServiceTypeCreateForm, self).__init__(*args, **kwargs)
     class Meta:
         model = ServiceType
-        fields = '__all__'
+        fields = ['codename','requirements', 'price_type',
+                  'description',
+                  'is_global','is_visible','id_metaservice']
 
         widgets = {
-            'ticket_status': forms.Select(attrs={'class': 'form-select'}),
+
         }
 
 class ServiceInformationUpdateForm(forms.ModelForm):

+ 2 - 0
SharixAdmin/models.py

@@ -22,5 +22,7 @@ class SharixUser(AbstractUser):
         
     class Meta:
         db_table = "auth_user"
+        
+
 
 # Create your models here.

+ 31 - 0
SharixAdmin/static/drf-yasg/service_type.css

@@ -0,0 +1,31 @@
+h1.mainHeader {
+    font-weight: 700;
+    font-size: 28px
+}
+p.description_service {
+    text-align: start;
+    font-size: 14px;
+    line-height: 24px;
+    font-weight: 400;
+    color: #7E7E7E;
+    letter-spacing: 0.14px;
+    margin-left: 10px;
+}
+
+#overlay {
+    position: fixed;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background-color: rgba(0, 0, 0, 0.5);
+    display: none;
+  }
+  
+  
+  #overlay.show {
+    display: block;
+    width: 400px;
+    height: 700px;
+    background-color: white;
+  }

+ 6 - 4
SharixAdmin/tables.py

@@ -114,8 +114,10 @@ class ServiceTariffTable(tables.Table):
 
 class ServiceTypeTable(tables.Table):
 
-    id = tables.Column(verbose_name=_('ID'), attrs={"td":{"width":"5%"}})
-    caption = tables.LinkColumn('service_type/edit/', verbose_name='Название услуги', text = lambda record: record.caption,
+    id = tables.Column( attrs={"td":{"width":"50%"}})
+    codename = tables.LinkColumn('service_type/edit/', verbose_name='Услуга', text = lambda record: record.codename,
+        args=[tables.A('pk')], attrs={'th':{'scope':'col'}, "td":{"width":"100%"},})
+    description = tables.LinkColumn('service_type/edit/', verbose_name='Описание', text = lambda record: record.description,
         args=[tables.A('pk')], attrs={'th':{'scope':'col'}, "td":{"width":"100%"},})
     deletee = tables.LinkColumn('service_type/delete/', verbose_name='', text = "Удалить",
         args=[tables.A('pk')], attrs={'th':{'scope':'col'}, "td":{"width":"auto"},})
@@ -123,10 +125,10 @@ class ServiceTypeTable(tables.Table):
     class Meta:
         model = ServiceType
         attrs = {"class": "table table-layout-fixed text-start"}
-        exclude = ('codename','description','requirements',
+        exclude = ('requirements',
                    'price_type','status','ticket_status', 
                    'id_metaservice', 'link_agreement',
-                   'is_global', 'is_visible',)
+                   'is_global', 'is_visible', 'caption')
 
     def render_delete(self, value, record):
         return format_html('<a href="/service_type/delete" class="btn btn-outline-danger">_(Delete)</a>')

+ 1 - 0
SharixAdmin/templates/SharixAdmin/base.html

@@ -7,6 +7,7 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <link rel="shortcut icon" href="{% static 'SharixAdmin/img/logo.png' %}"/>
     <link rel="stylesheet" href="{% static 'drf-yasg/navbar-style.css' %}" >
+    <link rel="stylesheet" href="{% static 'drf-yasg/service_type.css' %}" >
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
     <link type="text/css" href="{% static 'drf-yasg/colors2.css' %}" rel="stylesheet" />
     <title>{{ title }}</title>

+ 6 - 0
SharixAdmin/templates/SharixAdmin/index.html

@@ -3,6 +3,8 @@
 {% load static %}
 
 {% block content %}
+
+
 <input type="checkbox" name="" style="display: none;" checked id="hideMenuCheckBox">
 <div class="container-fluid">
     <div class="row">
@@ -151,4 +153,8 @@ style="cursor: pointer; position: fixed; align-items: center;">
   
 </script>
 
+
+
+
+
 {% endblock %}

+ 11 - 0
SharixAdmin/templates/SharixAdmin/overlay.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    
+</body>
+</html>

+ 2 - 2
SharixAdmin/templates/SharixAdmin/service.html

@@ -1,9 +1,9 @@
 {% extends 'SharixAdmin/index.html' %}
 {% load render_table from django_tables2 %}
 
-{% block contenthome %}
-    <h1 >{{ title }}</h1>
 
+{% block contenthome %}
+    <p class="h1">{{ title }}</p>
     <div class="container text-center mt-2">
       {% render_table table %}
     </div>

+ 44 - 37
SharixAdmin/templates/SharixAdmin/service_type.html

@@ -3,47 +3,54 @@
 {% load i18n %}
 
 {% block contenthome %}
-    <h1 >{{ title }}</h1>
-    <div class="container text-center mt-2">
-          {% render_table table %}
+    <h1 class="mainHeader">{{ title }}</h1>
+    <div class="container">
+      <p class="description_service">Это система управления государством, источником власти в которой является сам народ. Именно народ решает, какие законы и нормы необходимы для гармоничного существования и развития государства. Таким образом, каждый человек в демократическом обществе 
+        Получает определенный набор свобод и обязательств сформированных с учетом интересов всего сообщества. Исходя из вышесказанного, можно заключить, что демократия – это возможность для каждого человека свободно участвовать в непосредственном управлении своим государством, обществом и личной судьбой в конечном счете.</p>
+      <div class="row justify-content-start">
+        {% render_table table %}
 
-          {% comment %} {% if table.page %}
-            <nav aria-label="...">
-              <ul class="pagination">
-                {% if table.page.has_previous %}
-                <li class="page-item">
-                  <a class="page-link" href="?page={{ table.page.previous_page_number }}" tabindex="-1">{% trans 'Previous' %}</a>
+        {% comment %} {% if table.page %}
+          <nav aria-label="...">
+            <ul class="pagination">
+              {% if table.page.has_previous %}
+              <li class="page-item">
+                <a class="page-link" style="width: 10px; text-decoration: none;" href="?page={{ table.page.previous_page_number }}" tabindex="-1">{% trans 'Previous' %}</a>
+              </li>
+              {% else %}
+              <li class="page-item disabled">
+                <span class="page-link">{% trans 'Previous' %}</span>
+              </li>
+              {% endif %}
+              {% for page in table.page_range %}
+                {% if page == table.page.number %}
+                <li class="page-item active">
+                  <span class="page-link" style="width: 30px;">{{ page }} <span class="sr-only">{% trans '(current)' %}</span></span>
                 </li>
                 {% else %}
-                <li class="page-item disabled">
-                  <span class="page-link">{% trans 'Previous' %}</span>
-                </li>
-                {% endif %}
-                {% for page in table.page_range %}
-                  {% if page == table.page.number %}
-                  <li class="page-item active">
-                    <span class="page-link">{{ page }} <span class="sr-only">{% trans '(current)' %}</span></span>
-                  </li>
-                  {% else %}
-                  <li class="page-item">
-                    <a class="page-link" href="?page={{page }}">{{ page }}</a>
-                  </li>
-                  {% endif %}
-                {% endfor %}
-                {% if table.page.has_next %}
                 <li class="page-item">
-                  <a class="page-link" href="?page={{ table.page.next_page_number }}">{% trans 'Next' %}</a>
-                </li>
-                {% else %}
-                <li class="page-item disabled">
-                  <span class="page-link">{% trans 'Next' %}</span>
+                  <a class="page-link" style="width: 30px;" href="?page={{page }}">{{ page }}</a>
                 </li>
                 {% endif %}
-              </ul>
-            </nav>
-          {% endif %} {% endcomment %}
-    </div>
-    <div class="container text-end mt-2">
-      <a class="btn btn-primary" href="/service_type/add">{% trans 'Add' %}</a>
-    </div>
+              {% endfor %}
+              {% if table.page.has_next %}
+              <li class="page-item">
+                <a class="page-link" style="width: 30px; text-decoration: none;" href="?page={{ table.page.next_page_number }}">{% trans 'Next' %}</a>
+              </li>
+              {% else %}
+              <li class="page-item disabled">
+                <span class="page-link" style="width: 30px;">{% trans 'Next' %}</span>
+              </li>
+              {% endif %}
+            </ul>
+          </nav>
+        {% endif %} {% endcomment %}
+  </div>
+  <div class="container text-end mt-2">
+    <a class="btn btn-primary" href="/service_type/add">{% trans 'Add' %}</a>
+  </div>
+      </div>
+
+
+
 {% endblock contenthome %}

+ 1 - 1
SharixAdmin/templates/SharixAdmin/service_type_form.html

@@ -16,7 +16,7 @@
         {% endfor %}
     </div>
     <div class="text-center mt-2 mb-5">
-        <input class="btn btn-primary center" type="submit" name="apply" value="{% trans 'Submit' %}"/>
+        <input class="btn btn-primary center" type="Submit" name="submit" value="{% trans 'Submit' %}"/>
     </div>
 </form>
 {% endblock %}

+ 4 - 4
SharixAdmin/views/service_type.py

@@ -16,7 +16,7 @@ class ServiceTypeCreate(UserPassesTestMixin, CreateView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         context.update(get_context(self.request, {
-            'title': _('Service services'),
+            'title': _('Услуги сервиса'),
             'object': self.object,
         }))
         return context
@@ -39,7 +39,7 @@ class ServiceTypeListView(UserPassesTestMixin, SingleTableView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         context.update(get_context(self.request, {
-            'title': 'Service services',
+            'title': 'Услуги сервиса',
             'object_list': context['object_list'],
         }))
         return context
@@ -58,7 +58,7 @@ class ServiceTypeUpdateView(UserPassesTestMixin, UpdateView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         context.update(get_context(self.request, {
-            'title': 'Service services',
+            'title': 'Услуги сервиса',
             'object_list': context['object_list'],
         }))
         return context
@@ -77,7 +77,7 @@ class ServiceTypeDelete(UserPassesTestMixin, DeleteView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         context.update(get_context(self.request, {
-            'title': 'Service services',
+            'title': 'Услуги сервиса',
             'object': self.object,
         }))
         return context