<?php

use App\Http\Controllers\admin\AdminController;
use App\Http\Controllers\admin\PosController;

use Illuminate\Support\Facades\Route;

use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\admin\OtpController;

use App\Http\Controllers\admin\UserController;
use Illuminate\Http\Request;



Route::get('/otp',        [OtpController::class, 'show'])->name('otp.show');
Route::post('/otp/send',  [OtpController::class, 'send'])->name('otp.send');
Route::post('/otp/verify',[OtpController::class, 'verify'])->name('otp.verify');
 
    Route::get('/', [AdminController::class ,'login'])->name('admin.login');
    Route::post('login/store',  [AdminController::class ,'store'])->name('admin.login.store');

    // With Login
    Route::get('dashboard',  [AdminController::class ,'dashboard'])->name('admin.dashboard');
    Route::get('/logout',  [AdminController::class ,'logout'])->name('logout');
    Route::get('/edit',  [AdminController::class ,'edit'])->name('admin.edit');
    Route::put('/update/{admin}',  [AdminController::class ,'update'])->name('admin.update');
Route::delete('/transactions/{id}', [AdminController::class, 'destroyTransaction'])->name('transactions.destroy');
Route::delete('/transactions-bulk-delete', [AdminController::class, 'bulkDeleteTransactions'])->name('transactions.bulk-delete');
  Route::get('/users', [UserController::class, 'index'])->name('users.index');
    Route::get('/users/create', [UserController::class, 'create'])->name('users.create');
    Route::post('users/store', [UserController::class, 'store'])->name('users.store');
    Route::get('users/{id}/edit', [UserController::class, 'edit'])->name('users.edit');
    Route::put('users/{id}', [UserController::class, 'update'])->name('users.update');
Route::delete('/users/{id}', [UserController::class, 'destroy'])->name('users.destroy');
Route::get('/reports/export', [AdminController::class, 'exportExcel'])->name('reports.export');
 // صفحة رفع الاكسيل
    Route::get('/reports/upload', [AdminController::class, 'uploadPage'])
        ->name('reports.upload');

    // حفظ الاكسيل (POST)
    Route::post('/reports/upload', [AdminController::class, 'uploadStore'])
        ->name('reports.upload.store');

    // عرض كل البيانات
    Route::get('/reports', [AdminController::class, 'reportsIndex'])
        ->name('reports.index');
Route::put('/transactions/{id}', [AdminController::class, 'update_qr'])->name('admin.transactions.update');
    // التقارير المجمعة
    Route::get('/reports/summary', [AdminController::class, 'reportsSummary'])
        ->name('reports.summary');
Route::put('/pos/transactions/{id}', [PosController::class, 'update'])->name('postransactions.update');

  // صفحة رفع الاكسيل
    Route::get('/pos/reports/upload', [PosController::class, 'uploadPage'])
        ->name('posreports.upload');

    // حفظ الاكسيل (POST)
    Route::post('/pos/reports/upload', [PosController::class, 'uploadStore'])
        ->name('posreports.upload.store');

    // عرض كل البيانات
    Route::get('/pos/reports', [PosController::class, 'reportsIndex'])
        ->name('posreports.index');

Route::get('/posreports/export', [PosController::class, 'exportExcel'])->name('posreports.export');
Route::delete('/postransactions/{id}', [PosController::class, 'destroy'])->name('postransactions.destroy');
Route::delete('/postransactions-bulk-delete', [PosController::class, 'bulkDelete'])->name('postransactions.bulk-delete');
