<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HomeController;
use App\Models\PrimaryAccessories;
use App\Http\Controllers\CategoryController;
use App\Http\Controllers\SubCategoryController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\testCategoryController;
use App\Http\Controllers\TestController;
use App\Http\Controllers\InvoiceController;
use App\Http\Controllers\ClintController;
use App\Http\Controllers\CashController;
use App\Http\Controllers\CostController;
use App\Http\Controllers\Controller;
use App\Http\Controllers\DashboardController;

Route::get('/',[HomeController::class, 'index']) ->name('home');
//Route::get('/dashboard',[HomeController::class, 'dashboard']) ->name('dashboard');
Route::get('/product',[HomeController::class, 'product']) ->name('product');
Route::get('/all-product/{id}',[HomeController::class, 'categoryProduct']) ->name('category.product');
Route::get('/category-product/{id}',[HomeController::class, 'productByCategory']) ->name('product.category');
Route::get('/subCategory/product/{id}',[HomeController::class, 'subCategoryProduct']) ->name('subCategory.product');
Route::get('/contact',[HomeController::class, 'contact']) ->name('contact');
Route::post('/contact-submit',[HomeController::class, 'contactSubmit']) ->name('contact.submit');





Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified',])->group(function () {
//    Route::get('/dashboard', function () {return view('dashboard');})->name('dashboard');
    Route::get('/dashboard',[HomeController::class, "dashboard"]) ->name('dashboard');
    Route::get('/detail/message/{id}',[HomeController::class, 'detailMessage']) ->name('detail.message');


    Route::post('/save-data', [HomeController::class, 'saveAccessories']) ->name('save.accessories');
    Route::post('/save-leather', [HomeController::class, 'saveLeather']) ->name('save.leather');


    Route::get('/category/manage', [CategoryController::class, 'index'])->name('category.manage');
    Route::get('/category/add', [CategoryController::class, 'create'])->name('category.add');
    Route::post('/category/store', [CategoryController::class, 'store'])->name('category.store');
    Route::get('/category/edit/{id}', [CategoryController::class, 'edit'])->name('category.edit');
    Route::post('/category/update/{id}', [CategoryController::class, 'update'])->name('category.update');
    Route::get('/category/delete/{id}', [CategoryController::class, 'delete'])->name('category.delete');

    Route::get('/subCategory/manage', [SubCategoryController::class, 'index'])->name('subCategory.manage');
    Route::get('/subCategory/add', [SubCategoryController::class, 'create'])->name('subCategory.add');
    Route::post('/subCategory/store', [SubCategoryController::class, 'store'])->name('subCategory.store');
    Route::get('/subCategory/edit/{id}', [SubCategoryController::class, 'edit'])->name('subCategory.edit');
    Route::post('/subCategory/update/{id}', [SubCategoryController::class, 'update'])->name('subCategory.update');
    Route::get('/subCategory/delete/{id}', [SubCategoryController::class, 'delete'])->name('subCategory.delete');


    Route::get('/product/manage', [ProductController::class, 'index'])->name('product.manage');
    Route::get('/product/add', [ProductController::class, 'create'])->name('product.add');
    Route::get('/get-sub-category-by-category-id', [ProductController::class, 'getSubCategoryByCategory'])->name('get-sub-category-by-category-id');
    Route::post('/product/store', [ProductController::class, 'store'])->name('product.store');
    Route::get('/product/edit/{id}', [ProductController::class, 'edit'])->name('product.edit');
    Route::get('/product/detail/{id}', [ProductController::class, 'detail'])->name('product.detail');
    Route::post('/product/update/{id}', [ProductController::class, 'update'])->name('product.update');
    Route::get('/product/delete/{id}', [ProductController::class, 'delete'])->name('product.delete');

    Route::get('/testCategory/manage', [testCategoryController::class, 'index'])->name('testCategory.manage');
    Route::get('/testCategory/add', [testCategoryController::class, 'create'])->name('testCategory.add');
    Route::post('/testCategory/store', [testCategoryController::class, 'store'])->name('testCategory.store');
    Route::get('/testCategory/edit/{id}', [testCategoryController::class, 'edit'])->name('testCategory.edit');
    Route::post('/testCategory/update/{id}', [testCategoryController::class, 'update'])->name('testCategory.update');
    Route::get('/testCategory/delete/{id}', [testCategoryController::class, 'delete'])->name('testCategory.delete');

    Route::get('/test/manage', [TestController::class, 'index'])->name('test.manage');
    Route::get('/test/add', [TestController::class, 'create'])->name('test.add');
    Route::post('/test/store', [TestController::class, 'store'])->name('test.store');
    Route::get('/test/edit/{id}', [TestController::class, 'edit'])->name('test.edit');
    Route::post('/test/update/{id}', [TestController::class, 'update'])->name('test.update');
    Route::get('/test/delete/{id}', [TestController::class, 'delete'])->name('test.delete');

    Route::get('/invoice/create', [InvoiceController::class, 'index'])->name('invoice.create');
    Route::get('/invoice', [InvoiceController::class, 'list'])->name('invoice.list');
    Route::get('/invoice/details/{id}', [InvoiceController::class, 'details'])->name('invoice.detail');
    Route::post('/add/clint', [InvoiceController::class, 'addClint'])->name('add.clint');
    Route::post('/invoice/store', [InvoiceController::class, 'invoiceStore'])->name('invoices.store');
    Route::get('/money/receipt/{id}', [InvoiceController::class, 'receipt'])->name('money.receipt');
    Route::post('/invoices/find', [InvoiceController::class, 'find'])->name('find.invoice');
    Route::get('/invoices/edit', [InvoiceController::class, 'edit'])->name('invoice.edit');
    Route::post('/invoices/update', [InvoiceController::class, 'update'])->name('invoice.update');
    Route::get('/invoices/due', [InvoiceController::class, 'due'])->name('invoice.due');


    // routes/web.php
    Route::get('/client/search', [ClintController::class, 'search'])->name('client.search');
    Route::get('/client', [ClintController::class, 'list'])->name('client.list');

    Route::get('/cash-book', [CashController::class, 'index'])->name('cashBook');
    Route::post('/cash-book/month', [CashController::class, 'cashBookMonth'])->name('cashBook.month');
    Route::post('/cash-book/report/baseOnMonth', [CashController::class, 'cashBookReportBasedOnDate'])->name('cashBook.report.baseOnDate');

    Route::get('/cost', [CostController::class, 'cost'])->name('cost');
    Route::post('/cost/store', [CostController::class, 'store'])->name('store');
    Route::get('/cost/report', [CostController::class, 'index'])->name('report');
    Route::post('/cost/report/date', [CostController::class, 'CostReportBasedOnDate'])->name('cashBook.report.baseOnDate');

    Route::get('/report/daly', [Controller::class, 'getMonthlyReport'])->name('report.daily');
    Route::post('/report/month', [Controller::class, 'getMonthlyReports'])->name('report.month');
    Route::get('/report/monthly', [Controller::class, 'getMonthWiseReports'])->name('report.monthly');

    Route::get('/dashboard1', [DashboardController::class, 'index'])->name('dashboard1');



});
