
from django.urls import path
from . import views


urlpatterns = [
    path('update-customer', views.update_customer),
    path('update-cat', views.update_cat),
    path('update-product', views.update_product),
    path('update-salerep', views.update_salerep),
    path('update-address', views.update_address),
    path('update-invoice', views.update_invoice),
    path('update-detail', views.update_detail),


    path('', views.index, name='index'),
    path('login', views.admin_login, name='login'),
    path('logout', views.admin_logout, name='logout'),
    path('change-password', views.change_password, name='change_password'),
    path('default-config', views.default_config, name='default_config'),

    path('customer', views.customer, name='customer'),
    path('customer/edit/<int:id>', views.edit_customer),
    path('customer/delete/<int:id>', views.delete_customer, name='delete_customer'),
        
    path('sale-rep', views.sale_rep, name='sale_rep'),
    path('sale-rep/edit/<int:id>', views.edit_sale_rep),
    path('sale-rep/delete/<int:id>', views.delete_sale_rep, name='delete_sale_rep'),

    path('work-sites', views.work_site, name='work_sites'),
    path('work-site/delete/<int:id>', views.delete_work_site),
    path('work-site/edit/<int:id>', views.edit_work_site, name='edit_work_site'),
    path('work-site/add/<int:cus_id>', views.add_work_site, name='add_work_site'),
    path('work-site/add', views.add_all_work_site, name='add_all_work_site'),

    path('product-category', views.product_category, name='product_category'),
    path('product-category/delete/<int:id>', views.delete_product_category),
    path('product-category/edit/<int:id>', views.edit_product_category, name='edit_product_category'),

    path('product', views.product, name='product'),    
    path('product/delete/<int:id>', views.delete_product),
    path('product/edit/<int:id>', views.edit_product, name='edit_product'),

    path('units', views.unit, name='unit'),
    path('unit/delete/<int:id>', views.delete_unit),
    path('unit/edit/<int:id>', views.edit_unit, name='edit_unit'),

    path('payment/invoice=<int:id>', views.invoice_payment, name='invoice_payment'), 
    path('onchange-work-site/<int:cus_id>', views.onchange_work_site),


    # invoices 
    path('invoices', views.invoice, name='invoice'), 
    path('invoice/add/customer=<int:id>', views.add_invoice, name='add_invoice'), 
    path('invoice/add/quotation=<int:id>', views.add_invoice_from_quotaion, name='add_invoice_from_quotaion'), 
    path('invoice/edit/<int:id>', views.edit_invoice, name='edit_invoice'), 
    path('invoice/detail/<int:id>', views.invoice_detail, name='detail_invoice'), 
    path('invoice/<str:token>', views.secure_invoice_detail, name='secure_invoice_detail'), 

    # quotation
    path('quotations', views.quotation, name='quotation'), 
    path('quotation/add/customer=<int:id>', views.add_quotation, name='add_quotation'), 
    path('quotation/edit/<int:id>', views.edit_quotation, name='edit_quotation'), 
    path('quotation/detail/<int:id>', views.quotation_detail, name='detail_quotation'), 
    path('quotation/<str:token>', views.secure_quotation_detail, name='secure_quotation_detail'), 

    # reports 
    path('balance-due-report', views.balance_due_report, name='balance_due_report'), 
    path('product-by-category', views.product_by_category, name='product_by_category'), 
    path('product-sale-report', views.product_sale_report, name='product_sale_report'), 
    path('active-customer', views.active_customers, name='active_customers'), 

    # apis 
    path('get/invoice/<int:id>', views.invoice_detail_api),
    path('get/quotation/<int:id>', views.quotation_detail_api),
    path('get/product', views.get_product),
    path('get/unit', views.get_unit),
    path('add/customer', views.add_customer_from_invoice),
    path('add/sale-rep', views.add_sale_rep_from_invoice),
    path('add/site', views.add_site_from_invoice),
    path('add/shipping-address', views.add_shipping_from_invoice),
    path('add/billing-address', views.add_billing_from_invoice),


    # datatables 
    path('quotation-datatable-search/<int:id>/<str:account>/<str:invoice>', views.quotation_datatable_search, name='quotation_datatable_search'),
    path('invoice-datatable-search/<int:id>/<str:account>/<str:invoice>', views.invoice_datatable_search, name='datatable_search'),
    path('customer-datatable-search', views.customer_datatable_search, name='customer_datatable_search'),
    path('work-site-datatable-search/<int:id>', views.work_site_datatable_search, name='work_site_datatable_search'),
    path('product-datatable-search', views.product_datatable_search, name='product_datatable_search'),

    path('send-invoice/<int:id>', views.send_invoice, name="send_invoice"),
    path('send-quotation/<int:id>', views.send_quotation, name="send_quotation"),

]
