<?php

use App\Http\Middleware\Localization;
use Illuminate\Support\Facades\Route;
use Modules\Order\Http\Controllers\Controller;

Route::group(['prefix' => 'admin', 'as' => 'admin.'], function () {
    Route::group(['middleware' => [Localization::class, 'auth:admin']], function () {
        
        // Order Management
        Route::any('order_status', [Controller::class, 'changeStatus'])->name('orders.status');
        Route::get('order/print/{id}', [Controller::class, 'download_pdf'])->name('order.print');
        Route::resources(['orders' => Controller::class]);
        Route::any('datatable-orders', [Controller::class, 'datatable'])->name('datatable-orders');
        
        // POS Specific Routes
        Route::get('fetch-products', [Controller::class, 'fetchProducts'])->name('fetch-products');
        Route::get('all-orders/history', [Controller::class, 'orderHistory'])->name('orders.history');
        Route::post('all-orders/store-ajax', [Controller::class, 'store'])->name('orders.store-ajax');
        
        // Sales Report
        Route::any('sales-report', [Controller::class, 'salesReport'])->name('sales-report');
    });
});