Староверов Данила Андреевич 1 жил өмнө
parent
commit
bd3c0363cc

+ 15 - 1
SharixAdmin/views/__init__.py

@@ -1,2 +1,16 @@
 from .index import index
-from .transactions import transactions
+from .transactions import transactions
+from .context import get_context
+from .service import *
+from .service_type import *
+from .service_tariff import *
+from .service_info import *
+from .resource import *
+from .partners import *
+from .partner_info import *
+from .provider import *
+from .login import *
+from .test import testPage
+from .balance import balance
+from .trans_id import trans_id
+from .schema import schema_v3

+ 25 - 0
SharixAdmin/views/balance.py

@@ -0,0 +1,25 @@
+from django.shortcuts import render
+from django.contrib.auth.decorators import login_required
+from SharixAdmin.views.context import get_context
+
+@login_required
+def balance(request):
+    context = get_context(request, {
+        'title':'Пополнить баланс'
+        })
+    if request.method == 'POST':
+        if float(request.POST['price']) > 0:
+            context = get_context(request, {
+                'title':'Пополнить баланс',
+                'msg':'Оплата прошла успешно ;)'
+                })
+            return render(request, "SharixAdmin/balance_success.html", context)
+        else:
+            context = get_context(request, {
+                'title':'Пополнить баланс',
+                'msg':'Оплата не прошла ;('
+                })
+            return render(request, "SharixAdmin/balance_success.html", context)
+
+    
+    return render(request, "SharixAdmin/balance.html", context)

+ 19 - 0
SharixAdmin/views/login.py

@@ -0,0 +1,19 @@
+from django.http import HttpResponseRedirect
+from SharixAdmin.forms import LoginUserForm
+from django.contrib.auth.views import LoginView
+from django.urls import reverse_lazy, reverse
+from django.contrib.auth import logout
+
+def logout_view(request):
+    logout(request)
+    return HttpResponseRedirect(reverse('authweb'))
+
+class LoginSharix(LoginView):
+    form_class = LoginUserForm
+    template_name = 'SharixAdmin/auth.html'
+
+    
+    def get_success_url(self):
+        print(self.request.GET['next'])
+        
+        return reverse_lazy('home')

+ 45 - 0
SharixAdmin/views/partner_info.py

@@ -0,0 +1,45 @@
+from django.shortcuts import render
+from SharixAdmin.forms import PartnerInformationCreateForm, PartnerInformationUpdateForm
+from metaservicesynced.models import Company
+from django.views.generic.edit import UpdateView, CreateView
+from SharixAdmin.views.context import get_context
+from django.urls import reverse
+
+class PartnerInformationCreate(CreateView):
+    model = Company
+    form_class = PartnerInformationCreateForm
+    template_name = "SharixAdmin/partner_information_form.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Информация о партнере',
+            'object': self.object,
+        }))
+        return context
+    
+    def get_success_url(self):
+        return reverse('test-page')
+    
+class PartnerInformationUpdateView(UpdateView):
+    model = Company
+    form_class = PartnerInformationUpdateForm
+    template_name = "SharixAdmin/partner_information_form.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Информация о партнере',
+            'object': self.object,
+        }))
+        return context
+    
+    def get_success_url(self):
+        return reverse('test-page')
+    
+def partner_information(request):
+    context = get_context(request, {
+        'title':'Информация о партнере',
+        })
+    
+    return render(request, 'SharixAdmin/partner_information.html', context)

+ 31 - 0
SharixAdmin/views/partners.py

@@ -0,0 +1,31 @@
+from django_tables2 import SingleTableView
+from SharixAdmin.tables import PartnersTable
+from django.contrib.auth.decorators import login_required
+from metaservicesynced.models import Company
+from SharixAdmin.views.context import get_context
+from django.http import JsonResponse
+
+class PartnersListView(SingleTableView):
+    table_class = PartnersTable
+    queryset = Company.objects.all()
+    template_name = 'SharixAdmin/partners.html'
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Партнеры',
+            'object_list': context['object_list'],
+        }))
+        return context
+    
+@login_required
+def change_partners_status(request):
+    if request.method == 'POST':
+        partners_id = request.POST.get('partners_id')
+        new_status = request.POST.get('new_status')
+        partners = Company.objects.get(pk=partners_id)
+        partners.status = new_status
+        partners.save()
+        return JsonResponse({'status': 'success'})
+    else:
+        return JsonResponse({'status': 'error'})

+ 32 - 0
SharixAdmin/views/provider.py

@@ -0,0 +1,32 @@
+from django_tables2 import SingleTableView
+from SharixAdmin.tables import ProviderTable
+from metaservicesynced.models import Provider
+from django.contrib.auth.decorators import login_required
+from SharixAdmin.views.context import get_context
+from django.http import JsonResponse
+
+class ProviderListView(SingleTableView):
+    table_class = ProviderTable
+    queryset = Provider.objects.all()
+    template_name = 'SharixAdmin/provider.html'
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Исполнители',
+            'object_list': context['object_list'],
+        }))
+        return context
+    
+@login_required
+def change_provider_status(request):
+    if request.method == 'POST':
+        provider_id = request.POST.get('provider_id')
+        new_status = request.POST.get('new_status')
+        
+        provider = Provider.objects.get(pk=provider_id)
+        provider.status = new_status
+        provider.save()
+        return JsonResponse({'status': 'success'})
+    else:
+        return JsonResponse({'status': 'error'})

+ 33 - 0
SharixAdmin/views/resource.py

@@ -0,0 +1,33 @@
+from django_tables2 import SingleTableView
+from SharixAdmin.tables import ResourceTable
+from django.contrib.auth.decorators import login_required
+from metaservicesynced.models import Resource
+from SharixAdmin.views.context import get_context
+from django.http import JsonResponse
+
+class ResourceListView(SingleTableView):
+    table_class = ResourceTable
+    queryset = Resource.objects.all()
+    template_name = 'SharixAdmin/resource.html'
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Ресурсы',
+            'object_list': context['object_list'],
+        }))
+        return context
+    
+
+@login_required
+def change_resource_status(request):
+    if request.method == 'POST':
+        resource_id = request.POST.get('resource_id')
+        new_status = request.POST.get('new_status')
+        
+        resource = Resource.objects.get(pk=resource_id)
+        resource.status = new_status
+        resource.save()
+        return JsonResponse({'status': 'success'})
+    else:
+        return JsonResponse({'status': 'error'})

+ 7 - 0
SharixAdmin/views/schema.py

@@ -0,0 +1,7 @@
+from django.shortcuts import render
+from django.contrib.auth.decorators import login_required
+
+#Shema views
+@login_required
+def schema_v3(request):
+    return render(request, "SharixAdmin/schema.html")

+ 28 - 0
SharixAdmin/views/service.py

@@ -0,0 +1,28 @@
+from django_tables2 import SingleTableView
+from SharixAdmin.tables import ServiceTable
+from metaservicesynced.models import Service
+from django.contrib.auth.decorators import login_required
+from SharixAdmin.views.context import get_context
+
+class ServiceListView(SingleTableView):
+    table_class = ServiceTable
+    queryset = Service.objects.all()
+    template_name = 'SharixAdmin/service.html'
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Тарифы',
+            'object_list': context['object_list'],
+        }))
+        return context
+    
+@login_required
+def change_service_status(request):
+    if request.method == 'POST':
+        service_id = request.POST.get('service_id')
+        new_status = request.POST.get('new_status')
+        
+        service = Service.objects.get(pk=service_id)
+        service.status = new_status
+        service.save()

+ 38 - 0
SharixAdmin/views/service_info.py

@@ -0,0 +1,38 @@
+from SharixAdmin.forms import ServiceInformationCreateForm, ServiceInformationUpdateForm
+from django.views.generic.edit import CreateView, UpdateView
+from metaservicesynced.models import Service
+from SharixAdmin.views.context import get_context
+from django.urls import reverse
+
+class ServiceInformationCreate(CreateView):
+    model = Service
+    form_class = ServiceInformationCreateForm
+    template_name = "SharixAdmin/service_information_form.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Информация о сервисе',
+            'object': self.object,
+            
+        }))
+        return context
+    
+    def get_success_url(self):
+        return reverse('test-page')
+    
+class ServiceInformationUpdateView(UpdateView):
+    model = Service
+    form_class = ServiceInformationUpdateForm
+    template_name = "SharixAdmin/service_information_form.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Информация о сервисе',
+            'object': self.object,
+        }))
+        return context
+    
+    def get_success_url(self):
+        return reverse('test-page')

+ 55 - 0
SharixAdmin/views/service_tariff.py

@@ -0,0 +1,55 @@
+from django_tables2 import SingleTableView
+from django.views.generic.edit import UpdateView, CreateView
+from SharixAdmin.tables import ServiceTariffTable
+from SharixAdmin.forms import ServiceTariffCreateForm, ServiceTariffUpdateForm
+from metaservicesynced.models import Service
+from django.urls import reverse
+from SharixAdmin.views.context import get_context
+
+class ServiceTariffCreate(CreateView):
+    model = Service
+    form_class = ServiceTariffCreateForm
+    template_name = "SharixAdmin/service_tariff_form.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Тарифы услуг',
+            'object': self.object,
+        }))
+        return context
+    
+    def get_success_url(self):
+        return reverse('service_tariff')
+
+
+class ServiceTariffListView(SingleTableView):
+    table_class = ServiceTariffTable
+    queryset = Service.objects.all()
+    template_name = 'SharixAdmin/service_tariff.html'
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Исполнители',
+            'object_list': context['object_list'],
+        }))
+        return context
+
+
+class ServiceTariffUpdateView(UpdateView):
+    model = Service
+    form_class = ServiceTariffUpdateForm
+    template_name = "SharixAdmin/service_tariff_form.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Тарифы услуг',
+            'object': self.object,
+        }))
+        return context
+    
+    def get_success_url(self):
+        return reverse('service_tariff')
+

+ 67 - 0
SharixAdmin/views/service_type.py

@@ -0,0 +1,67 @@
+from django_tables2 import SingleTableView
+from django.views.generic.edit import UpdateView, CreateView, DeleteView
+from SharixAdmin.tables import ServiceTypeTable
+from SharixAdmin.forms import ServiceTypeCreateForm, ServiceTypeUpdateForm
+from metaservicesynced.models import ServiceType
+from django.urls import reverse
+from SharixAdmin.views.context import get_context
+
+class ServiceTypeCreate(CreateView):
+    model = ServiceType
+    form_class = ServiceTypeCreateForm
+    template_name = "SharixAdmin/service_type_form.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Услуги сервиса',
+            'object': self.object,
+        }))
+        return context
+    
+    def get_success_url(self):
+        return reverse('service_type')
+    
+
+class ServiceTypeListView(SingleTableView):
+    table_class = ServiceTypeTable
+    queryset = ServiceType.objects.all()
+    template_name = 'SharixAdmin/service_type.html'
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Услуги сервиса',
+            'object_list': context['object_list'],
+        }))
+        return context
+
+
+class ServiceTypeUpdateView(UpdateView):
+    model = ServiceType
+    form_class = ServiceTypeUpdateForm
+    template_name = "SharixAdmin/service_type_form.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Тарифы услуг',
+            'object_list': context['object_list'],
+        }))
+        return context
+    
+
+class ServiceTypeDelete(DeleteView):
+    model = ServiceType
+    template_name = "SharixAdmin/service_type_delete.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context.update(get_context(self.request, {
+            'title': 'Услуги сервиса',
+            'object': self.object,
+        }))
+        return context
+    
+    def get_success_url(self):
+        return reverse('service_type')

+ 8 - 0
SharixAdmin/views/test.py

@@ -0,0 +1,8 @@
+from SharixAdmin.views.context import get_context
+from django.shortcuts import render
+
+def testPage(request):
+    context = get_context(request, {
+        'title':'Страница в разработке'
+        })
+    return render(request, "SharixAdmin/test.html", context)

+ 10 - 0
SharixAdmin/views/trans_id.py

@@ -0,0 +1,10 @@
+from django.shortcuts import render
+from SharixAdmin.views.context import get_context
+from django.contrib.auth.decorators import login_required
+
+@login_required
+def trans_id(request, trans_id):
+    context = get_context(request, {
+        'title':'Услуга'
+        })
+    return render(request, 'SharixAdmin/trans_carried.html', context)

+ 342 - 351
SharixAdmin/views_old.py

@@ -46,385 +46,376 @@ from django.views.generic.edit import UpdateView, CreateView, DeleteView
         
 #     return render(request, 'SharixAdmin/transactions.html', context)
 
-@login_required
-def servicetype(request):
-    service_types = ServiceType.objects.all()
-    context = get_context(request, {
-        'title':'Услуги сервиса',
-        'service_types':service_types,
-        })
-        
-    return render(request, 'SharixAdmin/servicetype.html', context)
-
-@login_required
-def trans_id(request, trans_id):
-    context = get_context(request, {
-        'title':'Услуга'
-        })
-    return render(request, 'SharixAdmin/trans_carried.html', context)
-
-@login_required
-def balance(request):
-    context = get_context(request, {
-        'title':'Пополнить баланс'
-        })
-    if request.method == 'POST':
-        if float(request.POST['price']) > 0:
-            context = get_context(request, {
-                'title':'Пополнить баланс',
-                'msg':'Оплата прошла успешно ;)'
-                })
-            return render(request, "SharixAdmin/balance_success.html", context)
-        else:
-            context = get_context(request, {
-                'title':'Пополнить баланс',
-                'msg':'Оплата не прошла ;('
-                })
-            return render(request, "SharixAdmin/balance_success.html", context)
+
+# @login_required
+# def trans_id(request, trans_id):
+#     context = get_context(request, {
+#         'title':'Услуга'
+#         })
+#     return render(request, 'SharixAdmin/trans_carried.html', context)
+
+# @login_required
+# def balance(request):
+#     context = get_context(request, {
+#         'title':'Пополнить баланс'
+#         })
+#     if request.method == 'POST':
+#         if float(request.POST['price']) > 0:
+#             context = get_context(request, {
+#                 'title':'Пополнить баланс',
+#                 'msg':'Оплата прошла успешно ;)'
+#                 })
+#             return render(request, "SharixAdmin/balance_success.html", context)
+#         else:
+#             context = get_context(request, {
+#                 'title':'Пополнить баланс',
+#                 'msg':'Оплата не прошла ;('
+#                 })
+#             return render(request, "SharixAdmin/balance_success.html", context)
 
     
-    return render(request, "SharixAdmin/balance.html", context)
+#     return render(request, "SharixAdmin/balance.html", context)
 
 
-def logout_view(request):
-    logout(request)
-    return HttpResponseRedirect(reverse('authweb'))
+# def logout_view(request):
+#     logout(request)
+#     return HttpResponseRedirect(reverse('authweb'))
 
-class LoginSharix(LoginView):
-    form_class = LoginUserForm
-    template_name = 'SharixAdmin/auth.html'
+# class LoginSharix(LoginView):
+#     form_class = LoginUserForm
+#     template_name = 'SharixAdmin/auth.html'
 
     
-    def get_success_url(self):
-        print(self.request.GET['next'])
+#     def get_success_url(self):
+#         print(self.request.GET['next'])
         
-        return reverse_lazy('home')
-
-def testPage(request):
-    context = get_context(request, {
-        'title':'Страница в разработке'
-        })
-    return render(request, "SharixAdmin/test.html", context)
-
-
-
-
-menu = [
-    {'title':'Главная/баланс',          'link':'home', 'sel':'house'},
-    {'title':'Платежная информация',    'link':'test-page', 'sel':'credit-card'},
-    {'title':'История платежей',        'link':'trans','sel':'clock-history'},
-    {'title':'Курсы',                   'link':'course', 'sel':'education'},
-    {'title':'Личная информация',       'link':'test-page', 'sel':'person'},
-    {'title':'Управление сервисами',    'link':'test-page', 'sel':'hdd-network'},
-    {'title':'Мои связи',               'link':'test-page', 'sel':'people'},
-    {'title':'Сотрудничество',          'link':'test-page', 'sel':'sotrud'},
-    {'title':'Техподдержка',            'link':'test-page', 'sel':'gear'},
-    {'title':'Мои заявки',              'link':'tickets', 'sel':'tikets'},
-    {'title':'Исполнители',             'link':'provider', 'sel':'people'},
-    {'title':'Тарифы услуг',            'link':'service_tariff', 'sel':'person'},
-    {'title':'Партнеры',                'link':'partners', 'sel':'people'},
-    {'title':'Ресурсы',                 'link':'resource', 'sel':'sotrud'},
-    {'title':'Услуги сервиса',          'link':'service_type', 'sel':'hdd-network'},
-    {'title':'Информация о сервисе',    'link':'partner_information/add/', 'sel':'hdd-network'},
-    {'title':'Информация о партнере',   'link':'partner_information/add/', 'sel':'person'},
-    {'title':'Тарифы',                  'link':'service', 'sel':'tikets'},
-]
-
-def partner_information(request):
-    context = get_context(request, {
-        'title':'Информация о партнере',
-        })
+#         return reverse_lazy('home')
+
+# def testPage(request):
+#     context = get_context(request, {
+#         'title':'Страница в разработке'
+#         })
+#     return render(request, "SharixAdmin/test.html", context)
+
+
+
+
+# menu = [
+#     {'title':'Главная/баланс',          'link':'home', 'sel':'house'},
+#     {'title':'Платежная информация',    'link':'test-page', 'sel':'credit-card'},
+#     {'title':'История платежей',        'link':'trans','sel':'clock-history'},
+#     {'title':'Курсы',                   'link':'course', 'sel':'education'},
+#     {'title':'Личная информация',       'link':'test-page', 'sel':'person'},
+#     {'title':'Управление сервисами',    'link':'test-page', 'sel':'hdd-network'},
+#     {'title':'Мои связи',               'link':'test-page', 'sel':'people'},
+#     {'title':'Сотрудничество',          'link':'test-page', 'sel':'sotrud'},
+#     {'title':'Техподдержка',            'link':'test-page', 'sel':'gear'},
+#     {'title':'Мои заявки',              'link':'tickets', 'sel':'tikets'},
+#     {'title':'Исполнители',             'link':'provider', 'sel':'people'},
+#     {'title':'Тарифы услуг',            'link':'service_tariff', 'sel':'person'},
+#     {'title':'Партнеры',                'link':'partners', 'sel':'people'},
+#     {'title':'Ресурсы',                 'link':'resource', 'sel':'sotrud'},
+#     {'title':'Услуги сервиса',          'link':'service_type', 'sel':'hdd-network'},
+#     {'title':'Информация о сервисе',    'link':'partner_information/add/', 'sel':'hdd-network'},
+#     {'title':'Информация о партнере',   'link':'partner_information/add/', 'sel':'person'},
+#     {'title':'Тарифы',                  'link':'service', 'sel':'tikets'},
+# ]
+
+# def partner_information(request):
+#     context = get_context(request, {
+#         'title':'Информация о партнере',
+#         })
     
-    return render(request, 'SharixAdmin/partner_information.html', context)
-
-def get_context(request, page_context) -> dict:
-    base_context = {
-        "title":page_context['title'],
-        'url_path':resolve(request.path_info).url_name,
-        'menu':menu
-    }
-    context = dict(list(base_context.items()) + list(page_context.items()))
-    return context
-
-
-class PartnersListView(SingleTableView):
-    table_class = PartnersTable
-    queryset = Company.objects.all()
-    template_name = 'SharixAdmin/partners.html'
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Партнеры',
-            'object_list': context['object_list'],
-        }))
-        return context
+#     return render(request, 'SharixAdmin/partner_information.html', context)
+
+# def get_context(request, page_context) -> dict:
+#     base_context = {
+#         "title":page_context['title'],
+#         'url_path':resolve(request.path_info).url_name,
+#         'menu':menu
+#     }
+#     context = dict(list(base_context.items()) + list(page_context.items()))
+#     return context
+
+
+# class PartnersListView(SingleTableView):
+#     table_class = PartnersTable
+#     queryset = Company.objects.all()
+#     template_name = 'SharixAdmin/partners.html'
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Партнеры',
+#             'object_list': context['object_list'],
+#         }))
+#         return context
     
-@login_required
-def change_provider_status(request):
-    if request.method == 'POST':
-        provider_id = request.POST.get('provider_id')
-        new_status = request.POST.get('new_status')
+# @login_required
+# def change_provider_status(request):
+#     if request.method == 'POST':
+#         provider_id = request.POST.get('provider_id')
+#         new_status = request.POST.get('new_status')
         
-        provider = Provider.objects.get(pk=provider_id)
-        provider.status = new_status
-        provider.save()
-        return JsonResponse({'status': 'success'})
-    else:
-        return JsonResponse({'status': 'error'})
-
-class ServiceTariffUpdateView(UpdateView):
-    model = Service
-    form_class = ServiceTariffUpdateForm
-    template_name = "SharixAdmin/service_tariff_form.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Тарифы услуг',
-            'object': self.object,
-        }))
-        return context
+#         provider = Provider.objects.get(pk=provider_id)
+#         provider.status = new_status
+#         provider.save()
+#         return JsonResponse({'status': 'success'})
+#     else:
+#         return JsonResponse({'status': 'error'})
+
+# class ServiceTariffUpdateView(UpdateView):
+#     model = Service
+#     form_class = ServiceTariffUpdateForm
+#     template_name = "SharixAdmin/service_tariff_form.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Тарифы услуг',
+#             'object': self.object,
+#         }))
+#         return context
     
-    def get_success_url(self):
-        return reverse('service_tariff')
-
-class ServiceTariffCreate(CreateView):
-    model = Service
-    form_class = ServiceTariffCreateForm
-    template_name = "SharixAdmin/service_tariff_form.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Тарифы услуг',
-            'object': self.object,
-        }))
-        return context
+#     def get_success_url(self):
+#         return reverse('service_tariff')
+
+# class ServiceTariffCreate(CreateView):
+#     model = Service
+#     form_class = ServiceTariffCreateForm
+#     template_name = "SharixAdmin/service_tariff_form.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Тарифы услуг',
+#             'object': self.object,
+#         }))
+#         return context
     
-    def get_success_url(self):
-        return reverse('service_tariff')
-
-class ProviderListView(SingleTableView):
-    table_class = ProviderTable
-    queryset = Provider.objects.all()
-    template_name = 'SharixAdmin/provider.html'
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Исполнители',
-            'object_list': context['object_list'],
-        }))
-        return context
-
-class ServiceTariffListView(SingleTableView):
-    table_class = ServiceTariffTable
-    queryset = Service.objects.all()
-    template_name = 'SharixAdmin/service_tariff.html'
-    # paginate_by = 2
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Исполнители',
-            'object_list': context['object_list'],
-        }))
-        return context
-
-class ServiceTypeUpdateView(UpdateView):
-    model = ServiceType
-    form_class = ServiceTypeUpdateForm
-    template_name = "SharixAdmin/service_type_form.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Тарифы услуг',
-            'object_list': context['object_list'],
-        }))
-        return context
+#     def get_success_url(self):
+#         return reverse('service_tariff')
+
+# class ProviderListView(SingleTableView):
+#     table_class = ProviderTable
+#     queryset = Provider.objects.all()
+#     template_name = 'SharixAdmin/provider.html'
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Исполнители',
+#             'object_list': context['object_list'],
+#         }))
+#         return context
+
+# class ServiceTariffListView(SingleTableView):
+#     table_class = ServiceTariffTable
+#     queryset = Service.objects.all()
+#     template_name = 'SharixAdmin/service_tariff.html'
+#     
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Исполнители',
+#             'object_list': context['object_list'],
+#         }))
+#         return context
+
+# class ServiceTypeUpdateView(UpdateView):
+#     model = ServiceType
+#     form_class = ServiceTypeUpdateForm
+#     template_name = "SharixAdmin/service_type_form.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Тарифы услуг',
+#             'object_list': context['object_list'],
+#         }))
+#         return context
     
-class ResourceListView(SingleTableView):
-    table_class =  ResourceTable
-    queryset = Resource.objects.all()
-    template_name = 'SharixAdmin/resource.html'
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Ресурсы',
-            'object_list': context['object_list'],
-        }))
-        return context
-
-class ServiceTypeCreate(CreateView):
-    model = ServiceType
-    form_class = ServiceTypeCreateForm
-    template_name = "SharixAdmin/service_type_form.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Услуги сервиса',
-            'object': self.object,
-        }))
-        return context
+# class ResourceListView(SingleTableView):
+#     table_class =  ResourceTable
+#     queryset = Resource.objects.all()
+#     template_name = 'SharixAdmin/resource.html'
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Ресурсы',
+#             'object_list': context['object_list'],
+#         }))
+#         return context
+
+# class ServiceTypeCreate(CreateView):
+#     model = ServiceType
+#     form_class = ServiceTypeCreateForm
+#     template_name = "SharixAdmin/service_type_form.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Услуги сервиса',
+#             'object': self.object,
+#         }))
+#         return context
     
-    def get_success_url(self):
-        return reverse('service_type')
+#     def get_success_url(self):
+#         return reverse('service_type')
     
-@login_required
-def change_partners_status(request):
-    if request.method == 'POST':
-        partners_id = request.POST.get('partners_id')
-        new_status = request.POST.get('new_status')
+# @login_required
+# def change_partners_status(request):
+#     if request.method == 'POST':
+#         partners_id = request.POST.get('partners_id')
+#         new_status = request.POST.get('new_status')
         
-        partners = Company.objects.get(pk=partners_id)
-        partners.status = new_status
-        partners.save()
-        return JsonResponse({'status': 'success'})
-    else:
-        return JsonResponse({'status': 'error'})
-
-
-@login_required
-def change_resource_status(request):
-    if request.method == 'POST':
-        resource_id = request.POST.get('resource_id')
-        new_status = request.POST.get('new_status')
+#         partners = Company.objects.get(pk=partners_id)
+#         partners.status = new_status
+#         partners.save()
+#         return JsonResponse({'status': 'success'})
+#     else:
+#         return JsonResponse({'status': 'error'})
+
+
+# @login_required
+# def change_resource_status(request):
+#     if request.method == 'POST':
+#         resource_id = request.POST.get('resource_id')
+#         new_status = request.POST.get('new_status')
         
-        resource = Resource.objects.get(pk=resource_id)
-        resource.status = new_status
-        resource.save()
-        return JsonResponse({'status': 'success'})
-    else:
-        return JsonResponse({'status': 'error'})
+#         resource = Resource.objects.get(pk=resource_id)
+#         resource.status = new_status
+#         resource.save()
+#         return JsonResponse({'status': 'success'})
+#     else:
+#         return JsonResponse({'status': 'error'})
     
 
-class ServiceTypeDelete(DeleteView):
-    model = ServiceType
-    template_name = "SharixAdmin/service_type_delete.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Услуги сервиса',
-            'object': self.object,
-        }))
-        return context
+# class ServiceTypeDelete(DeleteView):
+#     model = ServiceType
+#     template_name = "SharixAdmin/service_type_delete.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Услуги сервиса',
+#             'object': self.object,
+#         }))
+#         return context
     
-    def get_success_url(self):
-        return reverse('service_type')
-
-
-class ServiceTypeListView(SingleTableView):
-    table_class = ServiceTypeTable
-    queryset = ServiceType.objects.all()
-    template_name = 'SharixAdmin/service_type.html'
-    # paginate_by = 2
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Услуги сервиса',
-            'object_list': context['object_list'],
-        }))
-        return context
-
-
-class ServiceInformationUpdateView(UpdateView):
-    model = Service
-    form_class = ServiceInformationUpdateForm
-    template_name = "SharixAdmin/service_information_form.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Информация о сервисе',
-            'object': self.object,
-        }))
-        return context
+#     def get_success_url(self):
+#         return reverse('service_type')
+
+
+# class ServiceTypeListView(SingleTableView):
+#     table_class = ServiceTypeTable
+#     queryset = ServiceType.objects.all()
+#     template_name = 'SharixAdmin/service_type.html'
+#     # paginate_by = 2
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Услуги сервиса',
+#             'object_list': context['object_list'],
+#         }))
+#         return context
+
+
+# class ServiceInformationUpdateView(UpdateView):
+#     model = Service
+#     form_class = ServiceInformationUpdateForm
+#     template_name = "SharixAdmin/service_information_form.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Информация о сервисе',
+#             'object': self.object,
+#         }))
+#         return context
     
-    def get_success_url(self):
-        return reverse('test-page')
-
-class ServiceInformationCreate(CreateView):
-    model = Service
-    form_class = ServiceInformationCreateForm
-    template_name = "SharixAdmin/service_information_form.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Информация о сервисе',
-            'object': self.object,
+#     def get_success_url(self):
+#         return reverse('test-page')
+
+# class ServiceInformationCreate(CreateView):
+#     model = Service
+#     form_class = ServiceInformationCreateForm
+#     template_name = "SharixAdmin/service_information_form.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Информация о сервисе',
+#             'object': self.object,
             
-        }))
-        return context
+#         }))
+#         return context
     
-    def get_success_url(self):
-        return reverse('test-page')
-
-class ServiceListView(SingleTableView):
-    table_class = ServiceTable
-    queryset = Service.objects.all()
-    template_name = 'SharixAdmin/service.html'
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Тарифы',
-            'object_list': context['object_list'],
-        }))
-        return context
+#     def get_success_url(self):
+#         return reverse('test-page')
+
+# class ServiceListView(SingleTableView):
+#     table_class = ServiceTable
+#     queryset = Service.objects.all()
+#     template_name = 'SharixAdmin/service.html'
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Тарифы',
+#             'object_list': context['object_list'],
+#         }))
+#         return context
     
-@login_required
-def change_service_status(request):
-    if request.method == 'POST':
-        service_id = request.POST.get('service_id')
-        new_status = request.POST.get('new_status')
+# @login_required
+# def change_service_status(request):
+#     if request.method == 'POST':
+#         service_id = request.POST.get('service_id')
+#         new_status = request.POST.get('new_status')
         
-        service = Service.objects.get(pk=service_id)
-        service.status = new_status
-        service.save()
-
-#Shema views
-@login_required
-def schema_v3(request):
-    return render(request, "SharixAdmin/schema.html")
-
-
-class PartnerInformationUpdateView(UpdateView):
-    model = Company
-    form_class = PartnerInformationUpdateForm
-    template_name = "SharixAdmin/partner_information_form.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Информация о партнере',
-            'object': self.object,
-        }))
-        return context
+#         service = Service.objects.get(pk=service_id)
+#         service.status = new_status
+#         service.save()
+
+# #Shema views
+# @login_required
+# def schema_v3(request):
+#     return render(request, "SharixAdmin/schema.html")
+
+
+# class PartnerInformationUpdateView(UpdateView):
+#     model = Company
+#     form_class = PartnerInformationUpdateForm
+#     template_name = "SharixAdmin/partner_information_form.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Информация о партнере',
+#             'object': self.object,
+#         }))
+#         return context
     
-    def get_success_url(self):
-        return reverse('test-page')
-
-class PartnerInformationCreate(CreateView):
-    model = Company
-    form_class = PartnerInformationCreateForm
-    template_name = "SharixAdmin/partner_information_form.html"
-
-    def get_context_data(self, **kwargs):
-        context = super().get_context_data(**kwargs)
-        context.update(get_context(self.request, {
-            'title': 'Информация о партнере',
-            'object': self.object,
-        }))
-        return context
+#     def get_success_url(self):
+#         return reverse('test-page')
+
+# class PartnerInformationCreate(CreateView):
+#     model = Company
+#     form_class = PartnerInformationCreateForm
+#     template_name = "SharixAdmin/partner_information_form.html"
+
+#     def get_context_data(self, **kwargs):
+#         context = super().get_context_data(**kwargs)
+#         context.update(get_context(self.request, {
+#             'title': 'Информация о партнере',
+#             'object': self.object,
+#         }))
+#         return context
     
-    def get_success_url(self):
-        return reverse('test-page')
+#     def get_success_url(self):
+#         return reverse('test-page')