<?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::get('/new', function () {
    return view('index');
});
// Route::get('/produit', function () {
//     return view('frontend/produits/produit');
// });

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');



//Presentation backend
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.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 coordonnees

Route::get('/idara/contact',[App\Http\Controllers\backend\ContactController::class, 'index'])->name('contact');
Route::get('contact/add', [App\Http\Controllers\backend\ContactController::class, 'create'])->name('contact.add');
Route::post('contacts', [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('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

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

//search

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

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

