<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\authController;
use App\Http\Controllers\adminController;
use App\Http\Controllers\brandController;
use App\Http\Controllers\kasirController;
use App\Http\Controllers\mesinController;
use App\Http\Controllers\paketController;
use App\Http\Controllers\barangController;
use App\Http\Controllers\parfumController;
use App\Http\Controllers\laundryController;
use App\Http\Controllers\pegawaiController;
use App\Http\Controllers\pelangganController;
use App\Http\Controllers\transaksiController;
use App\Http\Controllers\kepalaTokoController;
use App\Http\Controllers\pemakaianBahanController;
use App\Http\Controllers\metodePembayaranController;
use App\Http\Controllers\pembelianBahanBakuController;

/*
|--------------------------------------------------------------------------
| 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('login');
});

// Route::get('/', function () {
//     return view('component.app');
// });


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



// Route::get('kasirnya', function () {
//     return view('kasir.index_new');
// });

Route::get('/login', [authController::class, 'index'])->name('login');
Route::post('/login-proses', [authController::class, 'login'])->name('login-proses');
Route::post('/logout', [authController::class, 'logout'])->name('logout');

Route::group(['middleware' => 'auth'], function () {

    Route::get('/dashboard', function () {
        return view('index');
    })->name('dashboard');

    Route::prefix('brand')->group(function () {
        Route::get('/', [brandController::class, 'index'])->name('brand.index');
        Route::get('/create', [brandController::class, 'create'])->name('brand.create');
        Route::post('/store', [brandController::class, 'store'])->name('brand.store');
        Route::get('/editnya/{id}', [brandController::class, 'edit'])->name('brand.edit');
        Route::post('/edit/{id}', [brandController::class, 'update'])->name('brand.update');
        Route::get('/destroy/{id}', [brandController::class, 'destroy'])->name('brand.destroy');
        Route::post('/aktifasi/{id}', [brandController::class, 'aktifasi'])->name('brand.aktifasi');
    });

    Route::prefix('laundry')->group(function () {
        Route::get('/', [laundryController::class, 'index'])->name('laundry.index');
        Route::get('/create', [laundryController::class, 'create'])->name('laundry.create');
        Route::post('/store', [laundryController::class, 'store'])->name('laundry.store');
        Route::get('/edit/{id}', [laundryController::class, 'edit'])->name('laundry.edit');
        Route::post('/update/{id}', [laundryController::class, 'update'])->name('laundry.update');
        Route::get('/destroy/{id}', [laundryController::class, 'destroy'])->name('laundry.destroy');
    });

    Route::prefix('admin')->group(function () {
        Route::get('/', [adminController::class, 'index'])->name('admin.index');
        Route::get('/create', [adminController::class, 'create'])->name('admin.create');
        Route::post('/store', [adminController::class, 'store'])->name('admin.store');
        Route::get('/edit/{id}', [adminController::class, 'edit'])->name('admin.edit');
        Route::post('/update/{id}', [adminController::class, 'update'])->name('admin.update');
        Route::get('/destroy/{id}', [adminController::class, 'destroy'])->name('admin.destroy');
        Route::post('/aktifasi/{id}', [adminController::class, 'aktifasi'])->name('admin.aktifasi');
    });
    // kepala Toko
    Route::prefix('kepala_toko')->group(function () {
        Route::get('/', [kepalaTokoController::class, 'index'])->name('kepala_toko.index');
        Route::get('/create', [kepalaTokoController::class, 'create'])->name('kepala_toko.create');
        Route::post('/store', [kepalaTokoController::class, 'store'])->name('kepala_toko.store');
        Route::get('/edit/{id}', [kepalaTokoController::class, 'edit'])->name('kepala_toko.edit');
        Route::post('/update/{id}', [kepalaTokoController::class, 'update'])->name('kepala_toko.update');
        Route::get('/destroy/{id}', [kepalaTokoController::class, 'destroy'])->name('kepala_toko.destroy');
        Route::post('/aktifasi/{id}', [kepalaTokoController::class, 'aktifasi'])->name('kepala_toko.aktifasi');
    });


    Route::prefix('pegawai')->group(function () {
        Route::get('/', [pegawaiController::class, 'index'])->name('pegawai.index');
        Route::get('/create', [pegawaiController::class, 'create'])->name('pegawai.create');
        Route::post('/store', [pegawaiController::class, 'store'])->name('pegawai.store');
        Route::get('/detail/{id}', [pegawaiController::class, 'show'])->name('pegawai.show');
        Route::get('/edit/{id}', [pegawaiController::class, 'edit'])->name('pegawai.edit');
        Route::post('/update/{id}', [pegawaiController::class, 'update'])->name('pegawai.update');
        Route::get('/destroy/{id}', [pegawaiController::class, 'destroy'])->name('pegawai.destroy');
        Route::post('/aktifasi/{id}', [pegawaiController::class, 'aktifasi'])->name('pegawai.aktifasi');
        Route::post('/tambah-paket/{id}', [pegawaiController::class, 'tambahPaket'])->name('tambahPaket');
        Route::post('/pegawaiPaketUpdate/{id}', [pegawaiController::class, 'pegawaiPaketUpdate'])->name('pegawaiPaketUpdate');
        Route::post('/pegawaiPaketDestroy/{id}', [pegawaiController::class, 'pegawaiPaketDestroy'])->name('pegawaiPaketDestroy');
    });

    // pelanggan
    Route::prefix('pelanggan')->group(function () {
        Route::get('/', [pelangganController::class, 'index'])->name('pelanggan.index');
        Route::get('/create', [pelangganController::class, 'create'])->name('pelanggan.create');
        Route::post('/store', [pelangganController::class, 'store'])->name('pelanggan.store');
        Route::get('/edit/{id}', [pelangganController::class, 'edit'])->name('pelanggan.edit');
        Route::post('/update/{id}', [pelangganController::class, 'update'])->name('pelanggan.update');
        Route::get('/destroy/{id}', [pelangganController::class, 'destroy'])->name('pelanggan.destroy');
        Route::post('/aktifasi/{id}', [pelangganController::class, 'aktifasi'])->name('pelanggan.aktifasi');
    });
    // paket
    Route::prefix('paket')->group(function () {
        Route::get('/', [paketController::class, 'index'])->name('paket.index');
        Route::get('/create', [paketController::class, 'create'])->name('paket.create');
        Route::post('/store', [paketController::class, 'store'])->name('paket.store');
        Route::get('/edit/{id}', [paketController::class, 'edit'])->name('paket.edit');
        Route::post('/update/{id}', [paketController::class, 'update'])->name('paket.update');
        Route::get('/destroy/{id}', [paketController::class, 'destroy'])->name('paket.destroy');
        Route::post('/aktifasi/{id}', [paketController::class, 'aktifasi'])->name('paket.aktifasi');
        Route::post('/tambah-bahan-baku/{id}', [paketController::class, 'tambahBahanBaku'])->name('tambahBahanBaku');
        Route::post('/deleteBahanBaku/{id}', [paketController::class, 'deleteBahanBaku'])->name('deleteBahanBaku');
        Route::get('/bahanbaku', [paketController::class, 'trashBahanBaku'])->name('trashBahanBaku');
        Route::post('/editBahanBakuPaket/{id}', [paketController::class, 'editBahanBakuPaket'])->name('editBahanBakuPaket');
    });
    // parfum
    Route::prefix('parfum')->group(function () {
        Route::get('/', [parfumController::class, 'index'])->name('parfum.index');
        Route::get('/create', [parfumController::class, 'create'])->name('parfum.create');
        Route::post('/store', [parfumController::class, 'store'])->name('parfum.store');
        Route::get('/edit/{id}', [parfumController::class, 'edit'])->name('parfum.edit');
        Route::post('/update/{id}', [parfumController::class, 'update'])->name('parfum.update');
    });

    // metode pembayaran
    Route::prefix('metode-pembayaran')->group(function () {
        Route::get('/', [metodePembayaranController::class, 'index'])->name('metode-pembayaran.index');
        Route::get('/create', [metodePembayaranController::class, 'create'])->name('metode-pembayaran.create');
        Route::post('/store', [metodePembayaranController::class, 'store'])->name('metode-pembayaran.store');
        Route::get('/edit/{id}', [metodePembayaranController::class, 'edit'])->name('metode-pembayaran.edit');
        Route::post('/update/{id}', [metodePembayaranController::class, 'update'])->name('metode-pembayaran.update');
        Route::get('/destroy/{id}', [metodePembayaranController::class, 'destroy'])->name('metode-pembayaran.destroy');
        Route::post('/aktifasi/{id}', [metodePembayaranController::class, 'aktifasi'])->name('metode-pembayaran.aktifasi');
    });

    Route::prefix('mesin')->group(function () {
        Route::get('/', [mesinController::class, 'index'])->name('mesin.index');
        Route::get('/create', [mesinController::class, 'create'])->name('mesin.create');
        Route::post('/store', [mesinController::class, 'store'])->name('mesin.store');
        Route::get('/edit/{id}', [mesinController::class, 'edit'])->name('mesin.edit');
        Route::post('/update/{id}', [mesinController::class, 'update'])->name('mesin.update');
        Route::get('/destroy/{id}', [mesinController::class, 'destroy'])->name('mesin.destroy');
        Route::post('/aktifasi/{id}', [mesinController::class, 'aktifasi'])->name('mesin.aktifasi');
    });

    Route::prefix('barang')->group(function () {
        Route::get('/', [barangController::class, 'index'])->name('barang.index');
        Route::get('/create', [barangController::class, 'create'])->name('barang.create');
        Route::post('/store', [barangController::class, 'store'])->name('barang.store');
        Route::get('/edit/{id}', [barangController::class, 'edit'])->name('barang.edit');
        Route::post('/update/{id}', [barangController::class, 'update'])->name('barang.update');
        Route::get('/destroy/{id}', [barangController::class, 'destroy'])->name('barang.destroy');
        Route::post('/aktifasi/{id}', [barangController::class, 'aktifasi'])->name('barang.aktifasi');
    });

    Route::get('/barangnya/{id}', [barangController::class, 'barangnya'])->name('barangnya.index');

    Route::prefix('pembelian-bahan-baku')->group(function () {
        Route::get('/', [pembelianBahanBakuController::class, 'index'])->name('pembelian-bahan-baku.index');
        Route::get('/create', [pembelianBahanBakuController::class, 'create'])->name('pembelian-bahan-baku.create');
        Route::post('/store', [pembelianBahanBakuController::class, 'store'])->name('pembelian-bahan-baku.store');
        Route::get('/edit/{id}', [pembelianBahanBakuController::class, 'edit'])->name('pembelian-bahan-baku.edit');
        Route::post('/update/{id}', [pembelianBahanBakuController::class, 'update'])->name('pembelian-bahan-baku.update');
        Route::get('/destroy/{id}', [pembelianBahanBakuController::class, 'destroy'])->name('pembelian-bahan-baku.destroy');
        Route::post('/aktifasi/{id}', [pembelianBahanBakuController::class, 'aktifasi'])->name('pembelian-bahan-baku.aktifasi');
    });

    Route::prefix('kasir')->group(function () {
        Route::get('/', [kasirController::class, 'index'])->name('kasir.index');
        Route::get('/create', [kasirController::class, 'create'])->name('kasir.create');
        Route::post('/store', [kasirController::class, 'store'])->name('kasir.store');
        Route::get('/edit/{id}', [kasirController::class, 'edit'])->name('kasir.edit');
        Route::post('/update/{id}', [kasirController::class, 'update'])->name('kasir.update');
        Route::get('/destroy/{id}', [kasirController::class, 'destroy'])->name('kasir.destroy');
        Route::post('/aktifasi/{id}', [kasirController::class, 'aktifasi'])->name('kasir.aktifasi');
        Route::post('tutup/{id}/{total_transaksi}', [kasirController::class, 'tutup'])->name('kasir.tutup');
        Route::post('pelanggan_baru', [kasirController::class, 'pelanggan_baru'])->name('kasir.pelanggan_baru');
    });

    Route::prefix('transaksi')->group(function () {
        Route::get('/', [transaksiController::class, 'index'])->name('transaksi.index');
        Route::get('/proses', [transaksiController::class, 'index_proses'])->name('transaksi.proses');
        Route::get('/selesai', [transaksiController::class, 'index_selesai'])->name('transaksi.selesai');
        Route::get('/create', [transaksiController::class, 'create'])->name('transaksi.create');
        Route::post('/store', [transaksiController::class, 'store'])->name('transaksi.store');
        Route::get('/detail/{id}', [transaksiController::class, 'show'])->name('transaksi.show');
        Route::get('/edit/{id}', [transaksiController::class, 'edit'])->name('transaksi.edit');
        Route::post('/update/{id}', [transaksiController::class, 'update'])->name('transaksi.update');
        Route::get('/destroy/{id}', [transaksiController::class, 'destroy'])->name('transaksi.destroy');
        Route::get('/{kode_transaksi}', [transaksiController::class, 'transaksinya'])->name('transaksi.transaksinya');
    });

    // pemakaian bahan baku dari riwayat transaksi
    Route::prefix('pemakaianBahanBaku')->group(function () {
        Route::get('/', [pemakaianBahanController::class, 'index'])->name('pemakaianBahan.index');
    });
});
// kasirnya
