<?php


use Illuminate\Support\Facades\Route;
use Mehrab\Comment\Http\Controllers\ServiceCommentController;
use Mehrab\Dashboard;
use Mehrab\Front\Http\Controllers\ContactUsController;
use Mehrab\Front\Http\Controllers\FaqController;
use Mehrab\Front\Http\Controllers\MainController;
use Mehrab\Front\Http\Controllers\OrderController;
use Mehrab\Front\Http\Controllers\PanelController;
use Mehrab\Front\Http\Controllers\SearchController;
use Mehrab\Front\Http\Controllers\ServiceInfoController;

//public routes front
Route::group([], function () {

    //front routes
    Route::group([
            'middleware' => ['web']
        ]
        , function () {

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


            Route::get('/service/{slug}', [ServiceInfoController::class, 'index'])->name('service.info');
            Route::get('/service/parent/{slug}', [ServiceInfoController::class, 'parent'])->name('service.parent');

            Route::get('/order/{slug}', [OrderController::class, 'index'])->name('order.index');

            Route::post('/address/set', [OrderController::class, 'address_store'])->name('address.store')->middleware('auth');

            Route::post('order/{parent}/{service}', [OrderController::class, 'store'])->name('service_order_front.store')->middleware('auth');

            Route::get('search',[SearchController::class,'index'])->name('search.index');

            Route::get('faq',[FaqController::class,'index'])->name('faq.index');

            Route::post('contactUs',[ContactUsController::class,'store'])->name('contactUs.store')->middleware('throttle:20,1');

        });

});

//panel routes front
Route::group([
    'prefix' => 'panel',
    'middleware' => ['web', 'auth','DashboardUserMiddleware']
], function () {

    Route::get('/', [PanelController::class, 'index'])->name('panel.index');

    Route::post('/uploadImg',[PanelController::class,'uploadImg'])->name('panel.uploadImg');

    Route::get('/orders', [PanelController::class, 'orders'])->name('panel.orders');

    Route::get('/order/{id}', [PanelController::class, 'order_factor'])->name('panel.order_factor');

    Route::post('payment/{order_service}', [PanelController::class, 'do_payment'])->name('service_order_front.do_payment');

    Route::get('/payments', [PanelController::class, 'payments'])->name('panel.payments');

    Route::post('/rate/{order}',[PanelController::class, 'rate'])->name('panel.rate');

    Route::post('/cancel/{order}',[PanelController::class, 'cancel_service'])->name('panel.cancel');

    Route::get('/profile/edit',[PanelController::class, 'edit_profile'])->name('panel.edit_profile');
    Route::post('/profile/edit',[PanelController::class, 'update_profile'])->name('panel.update_profile');


    Route::get('/password',[PanelController::class, 'edit_password'])->name('panel.edit_password');
    Route::post('/password',[PanelController::class, 'update_password'])->name('panel.update_password');


});

