Denis 1 rok pred
rodič
commit
3bb296751d

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

@@ -0,0 +1,11 @@
+{% extends 'SharixAdmin/index.html' %}
+
+{% block contenthome %}
+  <h1 >{{ title }}</h1>
+
+  <div class="container text-center mt-3 d-flex justify-content-between">
+    <a class="btn btn-primary" href="{% url 'add_ticket' ticketlist=1 %}">Стать управляющим сервиса</a>
+    <a class="btn btn-primary" href="{% url 'add_ticket' ticketlist=2 %}">Стать клиентской поддержкой сервиса</a>
+    <a class="btn btn-primary" href="{% url 'add_ticket' ticketlist=3 %}">Стать технической поддержкой сервиса</a>
+  </div>
+{% endblock contenthome %}

+ 4 - 0
SharixAdmin/urls.py

@@ -9,6 +9,7 @@ from core.config import DEBUG
 
 router = routers.SimpleRouter()
 router.register(r'sharix-users', SharixUserMVS)
+router.register(r'sharix-users_by_id', SharixUser)
 router.register(r'group', GroupMVS)
 
 urlpatterns = [
@@ -20,6 +21,9 @@ urlpatterns = [
     path('logout/', logout_view, name='logoutweb'),
     path('balance/', balance, name='balance'),
     path('test/', testPage, name='test-page'),
+
+    path('partnership/', partnership, name='partnership'),
+    re_path(r'^partnership/add/(?P<ticketlist>[0-9])/$', createTicket, name='add_ticket'),
    
     path('partners/', login_required(PartnersListView.as_view()), name='partners'),
     path('partners/change_status/', change_partners_status, name='partners/change_status'),

+ 1 - 0
SharixAdmin/views/__init__.py

@@ -6,6 +6,7 @@ from .service_type import *
 from .service_tariff import *
 from .service_info import *
 from .resource import *
+from .partnership import *
 from .partners import *
 from .partner_info import *
 from .provider import *

+ 1 - 1
SharixAdmin/views/context.py

@@ -9,7 +9,7 @@ menu = [
     {'title':_('Personal information'),       'link':'test-page', 'sel':'person'},
     {'title':_('Service management'),    'link':'test-page', 'sel':'hdd-network'},
     {'title':_('My connections'),               'link':'test-page', 'sel':'people'},
-    {'title':_('Partnership'),          'link':'test-page', 'sel':'sotrud'},
+    {'title':_('Partnership'),          'link':'partnership', 'sel':'sotrud'},
     {'title':_('Techsupport'),            'link':'test-page', 'sel':'gear'},
     {'title':_('My tickets'),              'link':'tickets', 'sel':'tikets'},
     {'title':_('Performers'),             'link':'provider', 'sel':'people', 

+ 37 - 0
SharixAdmin/views/partnership.py

@@ -0,0 +1,37 @@
+from django.http import HttpResponse
+from django.shortcuts import redirect, render
+from django.utils.translation import gettext as _
+from SharixAdmin.views.context import get_context
+from django.contrib import messages
+from core.utils.AuthAPI import AuthAPI
+from tickets.models import Task
+from core.config import API_URL
+api = AuthAPI("79999999999", "Pa$$w0rd1")
+import requests
+
+def createTicket(request, ticketlist):
+
+    if ticketlist == 1:
+      list = 2
+    elif ticketlist == 2:
+      list = 7
+    else:
+      list = 7
+      
+    new_ticket = {
+      "task_list": list,
+      "created_by": request.user.pk,
+      "type": 3,
+      "title": "Cooperation with service",
+      "note": "",
+    }
+    responce = requests.post(f"{API_URL}/tickets/api/tickets/", data=new_ticket, headers=api.headers)
+    return redirect('partnership')
+    
+
+def partnership (request):
+    context = get_context(request, {
+        'title':_('Сотрудничество с сервисом'),
+        })
+    
+    return render(request, 'SharixAdmin/partnership.html', context)