<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// Route::get('/', function () {
//     return view('welcome');
// });


Route::fallback(function() {
    return view('404'); // la vue 404.blade.php
 });
Route::fallback([App\Http\Controllers\frontend\ErrorController::class, 'index']);

//Presentation backend

Route::post('upload_image',[App\Http\Controllers\backend\ckEditorController::class, 'uploadImg'])->name('upload');

Route::get('/idara/dash', [App\Http\Controllers\backend\PresentationController::class, 'admin'])->name('dashboard');

Route::get('/idara/presentations', [App\Http\Controllers\backend\PresentationController::class, 'Index'])->name('presentations');
Route::get('/presentation/add', [App\Http\Controllers\backend\PresentationController::class, 'Create'])->name('presentation.add');
Route::post('/presentation', [App\Http\Controllers\backend\PresentationController::class, 'store'])->name('presentation');
Route::get('/idara/presentation/{id}', [App\Http\Controllers\backend\PresentationController::class, 'show'])->name('presentation.show');
Route::get('/idara/presentation/{id}/edit', [App\Http\Controllers\backend\PresentationController::class, 'edit'])->name('presentation.edit');
Route::put('presentation/{id}', [App\Http\Controllers\backend\PresentationController::class, 'update']);
Route::get('/idarapresentations/{id}/editImage', [App\Http\Controllers\backend\PresentationController::class, 'editImage'])->name('presentation.editImage');
Route::put('presentationsImage/{id}', [App\Http\Controllers\backend\PresentationController::class, 'updateImage']);
Route::delete("deleteImageP/{id}", [App\Http\Controllers\backend\PresentationController::class, "deleteImage"])->name("delete");

Route::get('changeStatusPresentation',  [App\Http\Controllers\backend\PresentationController::class, 'changeStatus']);

Route::delete("presentations/{id}", [App\Http\Controllers\backend\PresentationController::class, "destroyP"]);

Route::get('/idara/presentations/{id}/editDetails', [App\Http\Controllers\backend\PresentationController::class, 'editDetails'])->name('presentation.editDetails');
Route::put('presentationsDetails/{id}', [App\Http\Controllers\backend\PresentationController::class, 'updateDetails']);

Route::get('presentations/{id}/editVideo', [App\Http\Controllers\backend\PresentationController::class, 'editVideo'])->name('presentation.editVideo');
Route::put('presentationsVideo/{id}', [App\Http\Controllers\backend\PresentationController::class, 'uploadVideo']);
Route::delete("deleteVideo/{id}", [App\Http\Controllers\backend\PresentationController::class, "deleteVideo"])->name("delete");

Route::POST('/file-upload-presentation', [App\Http\Controllers\backend\PresentationController::class, 'fileUpload']);
Route::delete("/file-delete-presentation", [App\Http\Controllers\backend\PresentationController::class, "deleteUpload"]);
// Route::resource('/test', PresentationController::class);

//Slide backend
Route::get('/idara/slides', [App\Http\Controllers\backend\SlideController::class, 'Index'])->name('slides');

Route::get('/idara/slide/add', [App\Http\Controllers\backend\SlideController::class, 'Create'])->name('slide.add');
Route::post('/slide', [App\Http\Controllers\backend\SlideController::class, 'store'])->name('slide');
Route::get('/idara/slide/{id}', [App\Http\Controllers\backend\SlideController::class, 'show'])->name('slide.show');
Route::get('/idara/slide/{id}/edit', [App\Http\Controllers\backend\SlideController::class, 'edit'])->name('slide.edit');
Route::put('slide/{id}', [App\Http\Controllers\backend\SlideController::class, 'update']);
Route::delete("slide/{id}", [App\Http\Controllers\backend\SlideController::class, "destroy"]);
Route::get('changeStatusSlide',  [App\Http\Controllers\backend\SlideController::class, 'changeStatus']);
Route::POST('/file-upload-slide', [App\Http\Controllers\backend\SlideController::class, 'fileUpload']);
Route::delete("/file-delete-slide", [App\Http\Controllers\backend\SlideController::class, "deleteUpload"]);

//category backend
Route::get('/idara/categories', [App\Http\Controllers\backend\CategorieController::class, 'Index'])->name('categories');

Route::get('/idara/categorie/add', [App\Http\Controllers\backend\CategorieController::class, 'Create'])->name('categorie.add');
Route::post('/categorie', [App\Http\Controllers\backend\CategorieController::class, 'store'])->name('/categorie');

Route::get('/idara/categorie/{id}', [App\Http\Controllers\backend\CategorieController::class, 'show'])->name('category.show');

Route::get('/idara/categorie/{id}/edit', [App\Http\Controllers\backend\CategorieController::class, 'edit'])->name('category.edit');
Route::put('categorie/{id}', [App\Http\Controllers\backend\CategorieController::class, 'update']);
Route::delete("categorie/{id}", [App\Http\Controllers\backend\CategorieController::class, "destroy"]);
Route::get('changeStatusCategory',  [App\Http\Controllers\backend\CategorieController::class, 'changeStatus']);
Route::POST('/file-upload-category', [App\Http\Controllers\backend\CategorieController::class, 'fileUpload']);
Route::delete("/file-delete-category", [App\Http\Controllers\backend\CategorieController::class, "deleteUpload"]);
//produit categorie


Route::get('/idara/produits', [App\Http\Controllers\backend\ProduitController::class, 'Index'])->name('produits');

Route::get('/produit/add', [App\Http\Controllers\backend\ProduitController::class, 'Create'])->name('produit.add');
Route::post('/produit', [App\Http\Controllers\backend\ProduitController::class, 'store'])->name('/produit');

Route::get('/idara/produit/{id}', [App\Http\Controllers\backend\ProduitController::class, 'show'])->name('produit.idara.show');
Route::get('/idara/produit/{id}/edit', [App\Http\Controllers\backend\ProduitController::class, 'edit'])->name('produit.edit');
Route::put('produit/{id}', [App\Http\Controllers\backend\ProduitController::class, 'update']);
Route::get('/idara/produit/{id}/diapo', [App\Http\Controllers\backend\ProduitController::class, 'diapo'])->name('produit.editDiapo');
Route::put('produitDiapo/{id}', [App\Http\Controllers\backend\ProduitController::class, 'updateDiapo']);
Route::delete("deleteMedia/{id}", [App\Http\Controllers\backend\ProduitController::class, "destroyMedia"])->name("delete");
Route::delete("produit/{id}", [App\Http\Controllers\backend\ProduitController::class, "destroyProduit"]);
Route::POST('/file-upload-produit', [App\Http\Controllers\backend\ProduitController::class, 'fileUploadProduit']);
Route::delete("/file-delete-produit", [App\Http\Controllers\backend\ProduitController::class, "fileDeleteProduit"]);

Route::POST('/file-upload', [App\Http\Controllers\backend\ProduitController::class, 'fileUpload']);
Route::delete("/file-delete", [App\Http\Controllers\backend\ProduitController::class, "deleteUpload"]);
Route::get('changeStatusProduit',  [App\Http\Controllers\backend\ProduitController::class, 'changeStatus']);
Route::get('changeStatusProduitHome',  [App\Http\Controllers\backend\ProduitController::class, 'homeStatus']);

Route::get('/idara/produit/{id}/editDoc', [App\Http\Controllers\backend\ProduitController::class, 'editDoc'])->name('produit.editDoc');
Route::get('Doc/{produit}/download', [App\Http\Controllers\backend\ProduitController::class, 'downloadDoc'])->name('doc.download');
Route::get('Doc/{produit}/size', [App\Http\Controllers\backend\ProduitController::class, 'sizeDoc'])->name('doc.size');


Route::put('produitDoc/{id}', [App\Http\Controllers\backend\ProduitController::class, 'updateDoc']);

Route::POST('/doc-upload', [App\Http\Controllers\backend\ProduitController::class, 'docUpload']);
Route::delete("/doc-delete", [App\Http\Controllers\backend\ProduitController::class, "docUploadDelete"]);





//promotion routes

Route::get('/idara/promotions', [App\Http\Controllers\backend\PromotionController::class, 'Index'])->name('promotions');

Route::get('/idara/promotion/add', [App\Http\Controllers\backend\PromotionController::class, 'Create'])->name('promotion.add');
Route::get('/idara/promotion/pack/add', [App\Http\Controllers\backend\PromotionController::class, 'CreatePack'])->name('promotionPack.add');
Route::post('/promotion/produit', [App\Http\Controllers\backend\PromotionController::class, 'store'])->name('/promotion/produit');
Route::post('/promotion/produitPack', [App\Http\Controllers\backend\PromotionController::class, 'storePack'])->name('/promotion/produit');

Route::get('/idara/promotion/{id}', [App\Http\Controllers\backend\PromotionController::class, 'show'])->name('promotion.show');

Route::get('promotion/{id}/edit', [App\Http\Controllers\backend\PromotionController::class, 'edit'])->name('promotion.edit');
Route::put('promotion/{id}', [App\Http\Controllers\backend\PromotionController::class, 'update']);
Route::get('promotion/pack/{id}/edit', [App\Http\Controllers\backend\PromotionController::class, 'editPack'])->name('promotion.editPack');
Route::put('promotion/pack/{id}', [App\Http\Controllers\backend\PromotionController::class, 'updatePack']);


Route::POST('/file-upload-promotion', [App\Http\Controllers\backend\PromotionController::class, 'fileUploadPromotion']);
Route::delete("/file-delete-promotion", [App\Http\Controllers\backend\PromotionController::class, "fileDeletePromotion"]);
Route::get('changeStatusPromotion',  [App\Http\Controllers\backend\PromotionController::class, 'changeStatus']);
Route::delete("promotion/{id}", [App\Http\Controllers\backend\PromotionController::class, "destroy"]);


//route logiciel backend
Route::get('/idara/logiciel',[App\Http\Controllers\backend\LogicielController::class, 'index'])->name('logiciel.index');
Route::get('/idara/logiciel/add', [App\Http\Controllers\backend\LogicielController::class, 'create'])->name('logiciel.add');
Route::post('/store/logiciel', [App\Http\Controllers\backend\LogicielController::class, 'store'])->name('logiciel.store');
Route::get('changeStatusLogiciel',  [App\Http\Controllers\backend\LogicielController::class, 'changeStatus']);

Route::get('/idara/logiciel/{id}', [App\Http\Controllers\backend\LogicielController::class, 'show'])->name('logiciel.idara.show');
Route::get('logiciel/{id}/edit', [App\Http\Controllers\backend\LogicielController::class, 'edit'])->name('logiciel.edit');
Route::put('logiciel/{id}', [App\Http\Controllers\backend\LogicielController::class, 'update']);
Route::delete("logiciel/{id}", [App\Http\Controllers\backend\LogicielController::class, "destroy"]);
Route::POST('/file-upload/logiciel', [App\Http\Controllers\backend\LogicielController::class, 'fileUpload']);
Route::delete("/file-delete/logiciel", [App\Http\Controllers\backend\LogicielController::class, "deleteUpload"]);

// route coordonnees

Route::get('/idara/contact',[App\Http\Controllers\backend\ContactController::class, 'index'])->name('contacts');
Route::get('contact/add', [App\Http\Controllers\backend\ContactController::class, 'create'])->name('contact.add');
Route::post('contactstore', [App\Http\Controllers\backend\ContactController::class, 'store']);
Route::get('/idara/contacts/{id}/edit', [App\Http\Controllers\backend\ContactController::class, 'edit'])->name('contact.edit');
Route::put('contacts/{id}', [App\Http\Controllers\backend\ContactController::class, 'update']);
Route::get('changeStatusContact',  [App\Http\Controllers\backend\ContactController::class, 'changeStatusContact']);
Route::delete("contacts/{id}", [App\Http\Controllers\backend\ContactController::class, "destroyC"]);


Route::get('send', [App\Http\Controllers\backend\NotifyController::class, 'Index']);


// Auth::routes();

Route::get('/tifawt', [App\Http\Controllers\frontend\PresentationController::class, 'index'])->name('tifawt.index');



Route::get('/send-notification', [backend\NotificationController::class, 'sendPromotionNotification']);

//search

Route::get('/', [App\Http\Controllers\frontend\HomeController::class, 'index']);

Route::get('/search', [App\Http\Controllers\frontend\ProduitController::class, 'search'])->name('produits.search');
Route::get('/produits/{categorieId?}', [App\Http\Controllers\frontend\ProduitController::class, 'index'])->name('produits.index');
Route::get('/produits/details/{id}', [App\Http\Controllers\frontend\ProduitController::class, 'show'])->name('produit.show');


Route::delete("deleteDoc/{id}", [App\Http\Controllers\backend\ProduitController::class, "deleteDoc"]);


Route::get('/promotions', [App\Http\Controllers\frontend\PromotionController::class, 'index'])->name('promotions.index');

Route::get('/promotion/details/{id}', [App\Http\Controllers\frontend\PromotionController::class, 'show'])->name('promo.show');


Route::get('/logiciels', [App\Http\Controllers\frontend\LogicielController::class, 'index'])->name('logiciel');
Route::get('/logiciel/details/{id}', [App\Http\Controllers\frontend\LogicielController::class, 'show'])->name('logiciel.show');



Route::get('/contact', [App\Http\Controllers\frontend\ContactController::class, 'index'])->name('contact');
Route::post('/contactez-nous', [App\Http\Controllers\frontend\ContactController::class, 'store'])->name('contactez-nous');


Route::get('/devis', [App\Http\Controllers\frontend\DeviController::class, 'index'])->name('devis');
Route::post('/devis/store', [App\Http\Controllers\frontend\DeviController::class, 'store'])->name('devis.store');


Route::get('/idara/demande', [App\Http\Controllers\backend\DemandeDevisController::class, 'index'])->name('demande');
Route::get('/idara/demande/show/{id}/', [App\Http\Controllers\backend\DemandeDevisController::class, 'show'])->name('demande.show');
Route::delete("/delete/demande/{id}", [App\Http\Controllers\backend\DemandeDevisController::class, "delete"]);

Route::get('/idara', 'App\Http\Controllers\Auth\LoginController@showLoginForm')->name('login');
Route::post('/idara', 'App\Http\Controllers\Auth\LoginController@login')
->name('login.post');

Route::post('déconnexion', 'App\Http\Controllers\Auth\LoginController@logout')
->name('logout.post');
Auth::routes(['login' => false, 'register' => false]);

