瀏覽代碼

landing adaptation

Evgenii Polivanov 1 周之前
父節點
當前提交
5e1747c4c7
共有 7 個文件被更改,包括 188 次插入32 次删除
  1. 66 0
      tables.py
  2. 15 12
      templates/landing/footer.html
  3. 2 0
      templates/landing/header.html
  4. 0 7
      templates/landing/menu.html
  5. 37 0
      templates/landing/pages/service_category.html
  6. 10 9
      urls.py
  7. 58 4
      views.py

+ 66 - 0
tables.py

@@ -0,0 +1,66 @@
+import django_tables2 as tables
+from dbsynce.models import *
+from dbsynce.models import *
+from django.contrib.auth import get_user_model
+from django.utils.html import format_html
+from django.utils.translation import gettext_lazy as _
+
+from dbsynce.lib.dicts import *
+
+class ProvidersLandingTable(tables.Table):
+    id = tables.Column(
+        verbose_name=_('ID'),
+        attrs={
+            "td": {"width": "5%"}
+        }
+    )   
+    gap = tables.Column(
+        #verbose_name=_('Status'),
+        attrs={
+            'th': {'scope': 'col'},
+            "td": {"width": "20%"}
+        }
+    )   
+    service_status = tables.Column(
+        attrs={
+            'th': {'scope': 'col'},
+            "td": {"width": "20%"}
+        }
+    )
+
+    default_location = tables.Column(
+        attrs={
+            'th': {'scope': 'col'},
+            "td": {"width": "20%"}
+        }
+    )
+
+    resource = tables.LinkColumn(
+        'sharix_admin:resource_detail',
+        args=[tables.A('resource.pk')],
+        accessor='resource.resource_type',
+        verbose_name=_('Resource'),
+        attrs={
+            'th': {'scope': 'col'},
+            "td": {"width": "20%"}
+        }
+    )
+
+
+    class Meta:
+        model = Provider
+        attrs = {
+            "class": "table table-layout-fixed"
+        }
+        exclude = (
+            'id_metaservice',
+            'requirements',
+            'status',
+            'location_type',
+            'default_location',
+            'is_global',
+            'is_visible',
+            'ticket_status',
+        )
+
+

+ 15 - 12
templates/landing/footer.html

@@ -4,33 +4,36 @@
     <div  class="flex-row content-between content-around wrap-footer footer-size adaptive-content-768">
         <div  class="flex-column services-footer">
             <h4>О компании</h4>
-            <ul class="list-none footer-text cursor-pointer">
-                <li><a href="{% url 'faq' %}">Партнерам</a></li>
+            <ul class="list-none footer-text cursor-pointer decoration-none">
+		    {% comment %}
+		<li><a href="{% url 'faq' %}">Партнерам</a></li>
                 <li><a href="{% url 'price' %}">Тарифы</a></li>
+		{% endcomment %}
                 <li><a href="{% url 'contact' %}">Контакты</a></li>
             </ul>
         </div>
         <div class="flex-column services-footer">
             <h4>О сервисе</h4>
             <ul class="list-none footer-text cursor-pointer decoration-none">
-                <li>Преимущества</li>
-                    <li>Правовая информация</li>
-                <li>Правила оказания услуг</li>
+<li><a href="https://wiki.sharix-app.org/doku.php/sharix/legal/politika_konfidencialnosti_platformy_sharix">Политика конфиденциальности</a></li>
+            <li><a href="https://wiki.sharix-app.org/doku.php/sharix/legal/pravila_okazanija_uslug">Правила оказания услуг</a></li>
+            <li><a href="https://wiki.sharix-app.org/doku.php/sharix/legal/porjadok_okazanija_uslug">Пользовательское соглашение с пользователями</a></li>
+
             </ul>
         </div>
-        <div class="flex-column services-footer">
+        <div class="flex-column services-footer decoration-none">
             <h4><a href="{% url 'price' %}">Услуги</a></h4>
             <ul class="list-none footer-text cursor-pointer">
-                <li>Услуга 1</li>
-                <li>Услуга 2</li>
-                <li>Услуга 3</li>
-            </ul>
+                {% for item in menu %}
+		<li><a href="{% url 'service_category' item.pk %}">{{ item.caption }}</a></li>
+		{% endfor %}
+	    </ul>
         </div>
         <div class="flex-column services-footer">
             <h4>О приложении</h4>
-            <ul class="list-none footer-text cursor-pointer">
+            <ul class="list-none footer-text cursor-pointer decoration-none">
                 <li>Скачать приложение</li>
-                <li>Подключиться</li>
+		<li><a href="/my/auth/signup">Подключиться</a></li>
                 <li><a href="/my/">Войти</a></li>
             </ul>
         </div>

+ 2 - 0
templates/landing/header.html

@@ -18,12 +18,14 @@
                 <a class="cursor-pointer clicked-reference " href="{% url 'main' %}">
                     <li class="blue-text">О нас</li>
                 </a>
+		{% comment %}
                 <a class="cursor-pointer clicked-reference" href="{% url 'price' %}">
                     <li>Услуги</li>
                 </a>
                 <a class="cursor-pointer clicked-reference" href="{% url 'faq' %}">
                     <li>Партнерам</li>
                 </a>
+		{% endcomment %}
                 <a class="cursor-pointer clicked-reference" href="{% url 'contact' %}">
                     <li>Контакты</li>
                 </a>

文件差異過大導致無法顯示
+ 0 - 7
templates/landing/menu.html


+ 37 - 0
templates/landing/pages/service_category.html

@@ -0,0 +1,37 @@
+{% extends 'landing/index.html' %}
+{% load static %}
+{% block container %}
+{% load render_table from django_tables2 %}
+
+{% include 'landing/menu.html' %}
+
+<div class="aboutCompany">
+
+{% for sitem, pitem in tables %}
+<h2>{{ sitem.caption }}</h2>
+<p>
+{{ sitem.description }}
+</p>
+{% comment %}{% render_table table %}{% endcomment %}
+<table>
+	<tr>
+		<th>ID</th>
+                <th>Интервал перед заказом</th>
+                <th>Местоположение</th>
+	</tr>
+	{% for r in pitem %}
+	<tr>
+		<td>{{ r.id }}</td>
+		<td>{{ r.gap }}</td>
+		<td>{{ r.default_location }}</td>
+	</tr>
+	{% endfor %}
+</table>
+{% comment %}
+	    {% render_table pitem %}
+	    {% endcomment %}
+	    {% endfor %}
+
+	    </div>
+	    {% endblock %}
+

+ 10 - 9
urls.py

@@ -11,16 +11,17 @@ urlpatterns = [
     path('price/', price_html, name='price'),
     path('contact/', contact_html, name='contact'),
     # pages
+    path('service_category/<int:pk>', service_category_html, name='service_category'),
     path('clean-car/', page_html, name='clean-car'),
-    path('clean-fit/', page_html, name='clean-fit'),
-    path('clean-office/', page_html, name='clean-office'),
-    path('clean-tcj/', page_html, name='clean-tcj'),
-    path('clean-area/', page_html, name='clean-area'),
-    path('clean-facades/', page_html, name='clean-facades'),
-    path('clean-apartments/', page_html, name='clean-apartments'),
-    path('clean-cottages/', page_html, name='clean-cottages'),
-    path('clean-out/', page_html, name='clean-out'),
-    path('clean-renovation/', page_html, name='clean-renovation'),
+    #path('clean-fit/', page_html, name='clean-fit'),
+    #path('clean-office/', page_html, name='clean-office'),
+    #path('clean-tcj/', page_html, name='clean-tcj'),
+    #path('clean-area/', page_html, name='clean-area'),
+    #path('clean-facades/', page_html, name='clean-facades'),
+    #path('clean-apartments/', page_html, name='clean-apartments'),
+    #path('clean-cottages/', page_html, name='clean-cottages'),
+    #path('clean-out/', page_html, name='clean-out'),
+    #path('clean-renovation/', page_html, name='clean-renovation'),
 
     # path('services/<str:page>/', services_html, name="services"),
     # path('', views.flatpage, {'url': ''}, name='about'),

+ 58 - 4
views.py

@@ -7,6 +7,14 @@ import core.settings as settings
 from landing.forms import *
 from .models import *
 
+from django.http import HttpResponse, HttpResponseNotFound, Http404
+
+from dbsynce.models import ServiceCategory
+from dbsynce.models import Provider
+from dbsynce.models import Service
+from sharix_admin.tables import ProvidersTable
+from landing.tables import ProvidersLandingTable
+from sharix_admin.tables import ServiceTariffsTable
 
 def send_email_mess(body, sub):
     with get_connection(
@@ -37,8 +45,8 @@ def index_html(request):
             send_email_mess(body, "Пользователь оставил отзыв")
     else:
         form = MyForm()
-
-    menu = LandingPage.objects.filter(slug__startswith='clean')
+    menu = ServiceCategory.objects.filter(status='0')
+    #menu = LandingPage.objects.filter(slug__startswith='clean')
     context = {
         # "mainpage":LandingPage.objects.get(slug="main"),
         "menu": menu,
@@ -46,6 +54,43 @@ def index_html(request):
     }
     return render(request, 'landing/pages/main.html', context=context)
 
+def service_category_html(request, pk):
+    template_name = 'landing/pages/service_category.html'
+    context_object_name = 'service_category'
+    page_title = 'О категории услуг'
+    page_name = 'service_category_detail'
+    menu = ServiceCategory.objects.filter(status='0')
+    table_class = ProvidersLandingTable
+
+    try:
+        services = Service.objects.filter(service_category=pk)
+        provider=[]
+        for i in services:
+            try:
+                provider.append(Provider.objects.filter(service=i))
+            except Provider.DoesNotExist:
+                pass
+    except Service.DoesNotExist:
+        raise Http404('Service does not exist')
+
+    if not services:
+        menu = ServiceCategory.objects.filter(status='0')
+        context = {
+            "menu": menu
+        }
+        return render(request, 'landing/pages/in_work.html', context=context)
+    else:
+        menu = ServiceCategory.objects.filter(status='0')
+        zipped_list = zip(services,provider)
+        context = {
+            "menu": menu,
+            "services": services,
+            "provider": provider,
+            "tables": zipped_list,
+    
+        }
+        return render(request, template_name, context=context)
+
 
 def page_html(request):
     if request.POST:
@@ -89,14 +134,20 @@ def send_email(request):
 
 # simple page
 def contact_html(request):
-    return render(request, 'landing/pages/contact.html')
+    menu = ServiceCategory.objects.filter(status='0')
+    context = {
+        "menu": menu,
+    }
+    return render(request, 'landing/pages/contact.html', context)
 
 
 def price_html(request):
+    menu = ServiceCategory.objects.filter(status='0')
     return render(request, 'landing/pages/price.html')
 
 
 def order_html(request):
+    menu = ServiceCategory.objects.filter(status='0')
     if request.POST:
         form = OrderForm(request.POST)
         if form.is_valid():
@@ -115,12 +166,14 @@ def order_html(request):
     else:
         form = OrderForm()
     context = {
-        "form": form
+        "form": form,
+        "menu": menu
     }
     return render(request, 'landing/pages/order.html', context)
 
 
 def faq_html(request):
+    menu = ServiceCategory.objects.filter(status='0')
     if request.POST:
         form = MyForm(request.POST)
         if form.is_valid():
@@ -134,6 +187,7 @@ def faq_html(request):
         form = MyForm()
     context = {
         "form": form,
+        "menu": menu,
         "faq": FAQmodel.objects.all()
     }
     return render(request, 'landing/pages/faq.html', context)

部分文件因文件數量過多而無法顯示