<?php


use App\Http\Controllers\HomeController;
use App\Http\Controllers\Admin\UserController;
use App\Http\Controllers\Admin\BackendController;
use App\Http\Controllers\Admin\CategoryController;
use App\Http\Controllers\Admin\TagController;
use App\Http\Controllers\Admin\PostController;
use App\Http\Controllers\Admin\PageController;
use App\Http\Controllers\Admin\SiteSettingController;
use Illuminate\Support\Facades\Route;

Route::get('/contact-us', function () {
    return view('frontend.otherpages.contact');
})->name('contact');

Route::get('/about-us', function () {
    return view('frontend.otherpages.about');
})->name('about');


Route::get('/', [HomeController::class, 'Index'])->name('home');
Route::get('/admin', [UserController::class, 'LogIn'])->name('login');

Route::post('/login-data', [UserController::class, 'Match'])->name('login.data');
Route::post('/register-data', [UserController::class, 'Register'])->name('register.data');
Route::get('/forget-password', [UserController::class, 'ForgetPassword'])->name('forget.pass');
Route::get('/sign/up-form', [UserController::class, 'SignUp'])->name('signup');
Route::get('/logout', [UserController::class, 'logout'])->name('logout');

// Route::get('/edit-profile', [JobseekerController::class, 'EditProfile'])->name('edit.profile');
// Route::get('/user-letter', [JobseekerController::class, 'UserLetter'])->name('dit.profile');
// Route::get('/UserProfile', [FrontendController::class, 'UserProfile']);

Route::post('/newsletter-store', [BackendController::class, 'newsletter'])->name('newsletter');

// Route::get('/private-chat', [ChatController::class, 'Chat'])->name('private.chat');

Route::get('/category/{slugurl}', [HomeController::class, 'Category'])->name('category');
Route::get('/tag/{slugurl}', [HomeController::class, 'Tag'])->name('tag');
Route::post('/comments', [HomeController::class, 'Comment'])->name('post.comments');

// Route::get('/load-more', [FrontendController::class, 'LoadMore'])->name('post.loadMore');
// Route::get('/{slugurl}', [FrontendController::class, 'Details'])->name('post.details');
// Route::get('/user-letter', [JobseekerController::class, 'UserLetter'])->name('dit.profile');



Route::prefix('/admin')->group(function () {
    Route::group(['middleware' => 'auth'], function () {
        // category section 
        Route::get('/dashboard', [BackendController::class, 'Dashboard'])->name('dashboard');
        Route::get('user-list', [BackendController::class, 'List'])->name('user.list');
        Route::get('user-add', [BackendController::class, 'Add'])->name('user.add');
        Route::Post('user-store', [BackendController::class, 'Store'])->name('user.store');
        Route::get('user-edit/{id}', [BackendController::class, 'Edit'])->name('edit.user');
        Route::post('user-update/{id}', [BackendController::class, 'Update'])->name('update.user');
        Route::get('user-status/{id}', [BackendController::class, 'Status'])->name('user.status');
        Route::get('user-delete/{id}', [BackendController::class, 'Delete'])->name('delete.user');

        // Category sections 
        Route::get('category-list', [CategoryController::class, 'List'])->name('category.list');
        Route::get('category-add', [CategoryController::class, 'Add'])->name('category.add');
        Route::Post('category-store', [CategoryController::class, 'Store'])->name('category.store');
        Route::get('category-edit/{id}', [CategoryController::class, 'Edit'])->name('edit.category');
        Route::Put('category-update/{id}', [CategoryController::class, 'Update'])->name('update.category');
        Route::get('category-status/{id}', [CategoryController::class, 'Status'])->name('category.status');
        Route::delete('category-delete/{id}', [CategoryController::class, 'destroy'])->name('delete.category');
        Route::post('/categories/change-status', [CategoryController::class, 'changeStatusAjax'])->name('category.changeStatusAjax');

        // Post sections 
        Route::get('post-list', [PostController::class, 'List'])->name('post.list');
        Route::get('tra-post-list', [PostController::class, 'Trashed'])->name('tra.post.list');
        Route::get('post-add', [PostController::class, 'Add'])->name('post.add');
        Route::Post('post-store', [PostController::class, 'Store'])->name('post.store');
        Route::get('post-view/{id}', [PostController::class, 'View'])->name('view.post');
        Route::get('post-edit/{id}', [PostController::class, 'Edit'])->name('edit.post');
        Route::Put('post-update/{id}', [PostController::class, 'Update'])->name('update.post');
        Route::get('post-status/{id}', [PostController::class, 'Status'])->name('post.status');
        Route::get('post-delete/{id}', [PostController::class, 'destroy'])->name('delete.post');
        Route::get('restore-post/{id}', [PostController::class, 'Restore'])->name('restore.post');
        Route::get('per-post-delete/{id}', [PostController::class, 'premanentdestroy'])->name('per.delete.post');
        Route::post('/posts/change-status', [PostController::class, 'changeStatusAjax'])->name('post.changeStatusAjax');

        Route::get('sitesetting-list', [SiteSettingController::class, 'checktoredirect'])->name('sitesetting');
        Route::get('sitesetting-add', [SiteSettingController::class, 'Add'])->name('sitesetting.add');
        Route::Post('sitesetting-store', [SiteSettingController::class, 'Store'])->name('sitesetting.store');
        Route::get('sitesetting-edit/{id}', [SiteSettingController::class, 'Edit'])->name('edit.sitesetting');
        Route::Put('sitesetting-update/{id}', [SiteSettingController::class, 'Update'])->name('update.sitesetting');

        Route::get('tag-list', [TagController::class, 'List'])->name('tag.list');
        Route::get('tag-add', [TagController::class, 'Add'])->name('tag.add');
        Route::Post('tag-store', [TagController::class, 'Store'])->name('tag.store');
        Route::get('tag-edit/{id}', [TagController::class, 'Edit'])->name('edit.tag');
        Route::Put('tag-update/{id}', [TagController::class, 'Update'])->name('update.tag');
        Route::get('tag-status/{id}', [TagController::class, 'Status'])->name('tag.status');
        Route::post('/tags/change-status', [TagController::class, 'changeStatusAjax'])->name('tag.changeStatusAjax');
        Route::delete('/tags/{id}', [TagController::class, 'destroy'])->name('tag.delete');  // ajax 
        Route::post('/tags', [TagController::class, 'tagstore'])->name('tags.store');
        // Job Titles sections 

    });
});
Route::middleware(['auth'])->prefix('admin')->name('admin.')->group(function () {
    Route::resource('pages', PageController::class);
});
Route::post('/comment-store', [HomeController::class, 'Comment'])->name('comment.save');
Route::get('/{slugurl}', [HomeController::class, 'Details'])->name('post.view');
Route::get('other/{slug}', [PageController::class, 'show'])->name('page.show');//other pages show like contact about 
