from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import path
from django.views.generic import RedirectView

from .views import DashboardPageView, OrderDetailView, OrderCreate, OrderUpdate, \
    CustomerCreate, ProductCreate, StoreCreate, OrderDelete, ProductDelete, StoreDelete, ProductPageView, StorePageView, \
    OrderProductsPageView, CustomerPageView, CustomerDelete, PrintView, ExportView

app_name = 'orders_app'


urlpatterns = [
    path('', RedirectView.as_view(url='https://www.tospititouglykou.gr/', permanent=False), name='redir'),
    path('dx/', DashboardPageView.as_view(), name='dx'),
    path('dx/order_data_export', ExportView.as_view(), name='order_data_export'),
    path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('images/favicon.ico'))),
    path('dx/order/<int:pk>/', OrderDetailView.as_view(), name='order_detail'),
    path('dx/order/create/', OrderCreate.as_view(), name='order_create'),
    path('dx/order/update/<int:pk>/', OrderUpdate.as_view(), name='order_update'),
    path('dx/order/delete/<int:pk>/', OrderDelete.as_view(), name='order_delete'),
    path('dx/order/print/<int:pk>/', PrintView.as_view(), name='order_print'),
    path('dx/customers/', CustomerPageView.as_view(), name='customers'),
    path('dx/customer/create/', CustomerCreate.as_view(), name='customer_create'),
    path('dx/customer/delete/<int:pk>/', CustomerDelete.as_view(), name='customer_delete'),
    path('dx/products/', ProductPageView.as_view(), name='products'),
    path('dx/product/create/', ProductCreate.as_view(), name='product_create'),
    path('dx/product/delete/<int:pk>/', ProductDelete.as_view(), name='product_delete'),
    path('dx/order_products/', OrderProductsPageView.as_view(), name='order_products'),
    path('dx/stores/', StorePageView.as_view(), name='stores'),
    path('dx/store/create/', StoreCreate.as_view(), name='store_create'),
    path('dx/store/delete/<int:pk>/', StoreDelete.as_view(), name='store_delete'),
]

