1
from fastapi import APIRouter, Depends
2
from fastapi import Request
3
from fastapi.responses import HTMLResponse
5
from app.front.template_spec import templates
6
from app.front.utills import BasePermit
7
from core.frontend.constructor import ClassView
12
class OrderView(ClassView):
13
"""Переопределяем модель"""
16
class OrderPermit(BasePermit):
17
permits = ['order_list']
19
@inventory.get("/dashboard", response_class=HTMLResponse, dependencies=[Depends(OrderPermit)])
20
async def order(request: Request):
21
"""Список складских ордеров"""
22
template = f'widgets/list{"" if request.scope["htmx"].hx_request else "-full"}.html'
23
cls = OrderView(request)
24
return templates.TemplateResponse(request, template, context={'cls': cls})
27
@inventory.get("/store_monitor", response_class=HTMLResponse)
28
async def mystore(request: Request):
29
"""Интерфейс работы со своим складом"""
30
template = f'widgets/list{"" if request.scope["htmx"].hx_request else "-full"}.html'
31
store_cls = await StoreView(request)
32
store_dash = store_cls.get_store_dashboard()
33
return templates.TemplateResponse(request, template, context={'cls': cls})