-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3339 from mikhailprivalov/new-constructor-laboratory
Новый конструктор лаборатории
- Loading branch information
Showing
12 changed files
with
1,122 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.urls import path | ||
|
||
from . import views | ||
|
||
urlpatterns = [ | ||
path('laboratory/get-departments', views.get_departments), | ||
path('laboratory/get-tubes', views.get_tubes), | ||
path('laboratory/update-order-research', views.update_order_research), | ||
path('laboratory/update-order-fraction', views.update_order_fraction), | ||
path('laboratory/change-visibility-research', views.change_visibility_research), | ||
path('laboratory/get-research', views.get_research), | ||
path('laboratory/update-research', views.update_research), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from django.contrib.auth.decorators import login_required | ||
from django.http import JsonResponse | ||
import simplejson as json | ||
from directory.models import Researches, Fractions | ||
from laboratory.decorators import group_required | ||
from podrazdeleniya.models import Podrazdeleniya | ||
from utils.response import status_response | ||
|
||
|
||
@login_required | ||
@group_required("Конструктор: Лабораторные исследования") | ||
def get_departments(request): | ||
result = Podrazdeleniya.get_podrazdeleniya(Podrazdeleniya.LABORATORY) | ||
return JsonResponse({"result": result}) | ||
|
||
|
||
@login_required | ||
@group_required("Конструктор: Лабораторные исследования") | ||
def get_tubes(request): | ||
request_data = json.loads(request.body) | ||
result = Researches.get_tubes(request_data["department_id"]) | ||
return JsonResponse({"result": result}) | ||
|
||
|
||
@login_required | ||
@group_required("Конструктор: Лабораторные исследования") | ||
def update_order_research(request): | ||
request_data = json.loads(request.body) | ||
result = Researches.update_order(request_data["researchPk"], request_data["researchNearbyPk"], request_data["action"]) | ||
return status_response(result) | ||
|
||
|
||
@login_required | ||
@group_required("Конструктор: Лабораторные исследования") | ||
def update_order_fraction(request): | ||
request_data = json.loads(request.body) | ||
result = Fractions.update_order(request_data["fractionPk"], request_data["fractionNearbyPk"], request_data["action"]) | ||
return status_response(result) | ||
|
||
|
||
@login_required | ||
@group_required("Конструктор: Лабораторные исследования") | ||
def change_visibility_research(request): | ||
request_data = json.loads(request.body) | ||
result = Researches.change_visibility(request_data["researchPk"]) | ||
return status_response(result) | ||
|
||
|
||
@login_required | ||
@group_required("Конструктор: Лабораторные исследования") | ||
def get_research(request): | ||
request_data = json.loads(request.body) | ||
result = Researches.get_research(request_data["researchPk"]) | ||
return JsonResponse({"result": result}) | ||
|
||
|
||
@login_required | ||
@group_required("Конструктор: Лабораторные исследования") | ||
def update_research(request): | ||
request_data = json.loads(request.body) | ||
result = Researches.update_lab_research(request_data["research"]) | ||
return status_response(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.