浏览代码

Improving the user experience on the "About Partner" page

- Now bootstrap is located locally
- Messages can now be displayed on pages
- Added message after confirmation of partner data change
- Added modal window for confirming changes to partner data
- A list of documents required for uploading has appeared
TonyKurts 6 月之前
父节点
当前提交
0ca8b40f7e

文件差异内容过多而无法显示
+ 4 - 0
SharixAdmin/static/SharixAdmin/css/bootstrap.min.css


文件差异内容过多而无法显示
+ 0 - 0
SharixAdmin/static/SharixAdmin/css/bootstrap.min.css.map


+ 6 - 0
SharixAdmin/static/SharixAdmin/css/style.css

@@ -79,6 +79,12 @@
 
 .list-style-none {
     list-style-type: none;
+    margin: 0;
+    padding: 0;
+}
+
+.list-style-none li:not(:last-child) {
+    margin-bottom: 1em;
 }
 
 .nav-link {

+ 3 - 0
SharixAdmin/static/SharixAdmin/img/file.svg

@@ -0,0 +1,3 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M20 8.94C19.9896 8.84813 19.9695 8.75763 19.94 8.67V8.58C19.8919 8.47718 19.8278 8.38267 19.75 8.3L13.75 2.3C13.6673 2.22222 13.5728 2.15808 13.47 2.11H13.38C13.2784 2.05174 13.1662 2.01434 13.05 2H7C6.20435 2 5.44129 2.31607 4.87868 2.87868C4.31607 3.44129 4 4.20435 4 5V19C4 19.7956 4.31607 20.5587 4.87868 21.1213C5.44129 21.6839 6.20435 22 7 22H17C17.7956 22 18.5587 21.6839 19.1213 21.1213C19.6839 20.5587 20 19.7956 20 19V9C20 9 20 9 20 8.94ZM14 5.41L16.59 8H15C14.7348 8 14.4804 7.89464 14.2929 7.70711C14.1054 7.51957 14 7.26522 14 7V5.41ZM18 19C18 19.2652 17.8946 19.5196 17.7071 19.7071C17.5196 19.8946 17.2652 20 17 20H7C6.73478 20 6.48043 19.8946 6.29289 19.7071C6.10536 19.5196 6 19.2652 6 19V5C6 4.73478 6.10536 4.48043 6.29289 4.29289C6.48043 4.10536 6.73478 4 7 4H12V7C12 7.79565 12.3161 8.55871 12.8787 9.12132C13.4413 9.68393 14.2044 10 15 10H18V19Z" fill="#479FF8"/>
+</svg>

文件差异内容过多而无法显示
+ 5 - 0
SharixAdmin/static/SharixAdmin/js/bootstrap.bundle.min.js


文件差异内容过多而无法显示
+ 0 - 0
SharixAdmin/static/SharixAdmin/js/bootstrap.bundle.min.js.map


+ 6 - 1
SharixAdmin/static/drf-yasg/colors2.css

@@ -15,12 +15,17 @@
   --btn-danger-hover: #821e27;
 }
 
-.btn-primary, .btn-outline-primary{
+.btn-primary {
   background-color: var(--btn-bg-color);
   color: var(--btn-txt-color);
   border-color: var(--btn-bg-color);
 }
 
+.btn-outline-primary {
+  border-color: var(--btn-bg-color);
+  color: var(--btn-bg-color);
+}
+
 .btn-primary:hover, .btn-outline-primary:hover{
   background-color: var(--btn-hover-color);
   border-color: var(--btn-hover-color);

+ 3 - 4
SharixAdmin/templates/SharixAdmin/base.html

@@ -7,10 +7,9 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <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 'SharixAdmin/css/bootstrap.min.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 href="{% static 'drf-yasg/colors2.css' %}" rel="stylesheet">
-    
+    <link rel="stylesheet" href="{% static 'drf-yasg/colors2.css' %}">
     <link rel="stylesheet" href="{% static 'SharixAdmin/css/style.css' %}">
 
     <title>{{ title }}</title>
@@ -19,6 +18,6 @@
 <body>
     {% block content %}{% endblock %}
     
-    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
+    <script src="{% static 'SharixAdmin/js/bootstrap.bundle.min.js' %}"></script>
 </body>
 </html>

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

@@ -188,6 +188,11 @@
 
   <div id="user-workspace" class="p-5 border rounded box-shadow">
       <h1 class="mainHeader mb-3">{{ title }}</h1>
+      {% if messages %}
+        {% for message in messages %}
+          <div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">{{ message }}</div>
+        {% endfor %}
+      {% endif %}
       {% block contenthome %}{% endblock contenthome%}
   </div>
 

+ 21 - 10
SharixAdmin/templates/SharixAdmin/partner.html

@@ -12,18 +12,18 @@
     <div class="card-body position-relative">
         <h5 class="card-title fw-bold mb-4">{{ company.legal_name }}</h5>
 
-        <ul class="list-style-none p-0 gap-2 m-0">
-            <li class="mb-3"><b>Представитель</b> {{ company.repr_id.get_full_name }}</li>
-            <li class="mb-3"><b>Юр. адрес</b> {{ company.address }}</li>
+        <ul class="list-style-none">
+            <li><b>Представитель</b> {{ company.repr_id.get_full_name }}</li>
+            <li><b>Юр. адрес</b> {{ company.address }}</li>
             
             <!-- FIXME: Не настроено -->
-            <li class="mb-3"><b>НДС</b> Не платит</li>
+            <li><b>НДС</b> Не платит</li>
             
-            <li class="mb-3"><b>ИНН</b> {{ company.inn }}</li>
-            <li class="mb-3"><b>ОГРН</b> {{ company.ogrn }}</li>
-            <li class="mb-3"><b>Р/c</b> {{ company.rs }}</li>
-            <li class="mb-3"><b>К/c</b> {{ company.ks }}</li>
-            <li class="mb-3"><b>БИК</b> {{ company.bik }}</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>
         </ul>
     </div>
@@ -32,5 +32,16 @@
     </a>
 </div>
 
-<h6>Документы</h6>
+<h6 class="mb-4">Документы</h6>
+    <ul class="list-style-none">
+        {% for document in company_documents %}
+            <li class="d-flex justify-content-between">
+                <div class="d-flex align-items-center">
+                    <img class="me-2" style="height: 32px;" src="{% static "SharixAdmin/img/file.svg" %}">
+                    {{ document }}
+                </div>
+                <button class="btn btn-sm btn-outline-primary">Загрузить</button>
+            </li>
+        {% endfor %}
+    </ul>
 {% endblock contenthome %}

+ 20 - 1
SharixAdmin/templates/SharixAdmin/partner_edit.html

@@ -14,6 +14,25 @@
 <form method="post" class="d-flex flex-column align-items-end">
     {% csrf_token %}
     {% include 'SharixAdmin/include/form.html' %}
-    <button class="btn btn-primary" type="submit">Отправить</button>
+    <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#partner-edit-modal">Отправить</button>
+
+    <!-- Окно подтверждения -->
+    <div id="partner-edit-modal" class="modal fade" tabindex="-1">
+        <div class="modal-dialog modal-dialog-centered">
+          <div class="modal-content">
+            <div class="modal-header">
+              <h5 class="modal-title">Подтверждение действия</h5>
+              <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
+            </div>
+            <div class="modal-body">
+              <p>Внесение изменений в данные партнера приведет к его деактивации до момента проверки новой информации!</p>
+            </div>
+            <div class="modal-footer">
+              <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Отменить</button>
+              <button type="sumbit" class="btn btn-outline-primary">Подтвердить</button>
+            </div>
+          </div>
+        </div>
+    </div>
 </form>
 {% endblock contenthome %}

+ 19 - 2
SharixAdmin/views/partner.py

@@ -4,8 +4,9 @@ from django.urls import reverse_lazy
 from django.shortcuts import get_object_or_404
 from django.utils.translation import gettext as _
 from django.contrib.auth.mixins import UserPassesTestMixin
+from django.contrib import messages
 
-from dbsynce.models import Company
+from dbsynce.models import Company, Documents
 from SharixAdmin.forms import CompanyForm
 
 from .base import BaseView
@@ -26,6 +27,14 @@ class PartnerDetailView(UserPassesTestMixin, BaseView, DetailView):
     def get_object(self, queryset=None):
         return get_object_or_404(Company, repr_id=self.request.user)
 
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update({
+            "company_documents": Documents.parse_requirements(self.object.requirements)
+        }) 
+        return context
+    
+
 
 class PartnerEditView(UserPassesTestMixin, BaseView, FormView):
     template_name = 'SharixAdmin/partner_edit.html'
@@ -45,5 +54,13 @@ class PartnerEditView(UserPassesTestMixin, BaseView, FormView):
         return kwargs
 
     def form_valid(self, form):
-        form.save()  # Сохраняем изменения
+        # Сохраняем изменения
+        form.save()
+
+        # Получаем текущий объект компании и деактивируем ее
+        current_company = form.instance
+        current_company.deactivate()
+
+        # Отправляем пользователю уведомление на страницу о успехе операции
+        messages.success(self.request, 'Данные успешно изменены и теперь проходят проверку!')
         return super().form_valid(form)

部分文件因为文件数量过多而无法显示