<?php

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('dashboard');
});
use App\Http\Controllers\MenuController;
use App\Http\Controllers\WinController;

//Route::get('/dashboard', [MenuController::class, 'index']);

Route::get('/dashboard', [MenuController::class, 'index'])->middleware('auth');

Route::get('/ventas/win', function () {
    return view('winventas.winventas_view_reg_ventaw');
});

Route::get('/ventas/perufibra', function () {
    return view('winventas.perufibraventas_view_reg_ventaw');
});

Route::get('/tarifa/win', function () {
    return view('view_tarifario.tarifariowin');
});


Route::get('/ventas/wins', function () {
    return response()->json([
        'tipo'   => 'vista',
        'html'   => view('winventas.winventas_view_reg_ventaw')->render(),
    ]);
});



////////////////////////////////////////////////////////////////////////////////////////////////////////////



Route::get('repo/venta', [WinController::class, 'selectwinventa']);


Route::get('/ventas/taridario', function () {
    return redirect()->away('https://intranet.kantum.pe/public/ventas');

  
});

Route::get('/dashboard', [MenuController::class, 'index'])->middleware('auth');

use App\Http\Controllers\AuthController;

// login
//Route::get('/login', [AuthController::class, 'loginForm'])->middleware('guest');


// login
Route::get('/login', [AuthController::class, 'loginForm'])
    ->name('login')
    ->middleware('guest');

Route::post('/login', [AuthController::class, 'login']);

// logout
Route::post('/logout', [AuthController::class, 'logout'])->name('logout');



use Illuminate\Support\Facades\Hash;

Route::get('/hash', function () {
    return Hash::make('123456');
});







////////////////

use App\Http\Controllers\AgendaController;



Route::get('agenda/registro', function () {
    return view('view_agenda.agenda');
});



/////////////////////
Route::get('usuario/empleado', function () {
    return view('view_usuarios.view_empleado');
});


use App\Http\Controllers\EmpleadoController;
use App\Http\Controllers\MenuAdminController;
use App\Http\Controllers\RoleController;

Route::get('/empleados/list', [EmpleadoController::class, 'list']);
Route::post('/empleados/store', [EmpleadoController::class, 'store']);
Route::get('/empleados/get/{id}', [EmpleadoController::class, 'get']);
Route::post('/empleados/update/{id}', [EmpleadoController::class, 'update']);
Route::get('/empleados/delete/{id}', [EmpleadoController::class, 'delete']);



Route::get('/roles/dat', [RoleController::class, 'data'])->name('roles.data');
Route::resource('roles', RoleController::class)->except(['show', 'create']);


Route::get('/empleados/data', [EmpleadoController::class, 'data'])->name('empleados.data');
Route::resource('empleados', EmpleadoController::class)->except(['show', 'create']);


use App\Http\Controllers\NotaController;
use App\Http\Controllers\NoteController;

//Route::get('notas', [NotaController::class, 'index']);





Route::prefix('menu')->group(function () {

    Route::get('/menuvista', [MenuAdminController::class, 'index'])->name('menu.admin.index');
    Route::get('/data',    [MenuAdminController::class, 'data'])->name('menu.admin.data');
    Route::get('/padres',  [MenuAdminController::class, 'padres'])->name('menu.admin.padres');
    Route::post('/store_menu', [MenuAdminController::class, 'store'])->name('menu.admin.store');
    Route::get('/{menu}',  [MenuAdminController::class, 'edit'])->name('menu.admin.edit');
    Route::put('/{menu}',  [MenuAdminController::class, 'update'])->name('menu.admin.update');
    Route::delete('/{menu}',[MenuAdminController::class, 'destroy'])->name('menu.admin.destroy');
});

Route::get('/notes/data', [NoteController::class, 'data'])->name('notes.data');
Route::resource('notes', NoteController::class)->except(['show', 'create', 'edit']);