327 lines
13 KiB
PHP
327 lines
13 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Enums\PriceRequestStatus;
|
|
use App\Models\PriceRequest;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class ViewServiceProvider extends ServiceProvider
|
|
{
|
|
public function boot(): void
|
|
{
|
|
if (! Schema::hasTable('price_requests')) {
|
|
return;
|
|
}
|
|
|
|
$priceRequestCount = PriceRequest::where('status', PriceRequestStatus::PENDING->value)->count();
|
|
|
|
View::composer('*', function ($view) use ($priceRequestCount) {
|
|
$sidebar = [
|
|
[
|
|
'heading' => 'Dasbor',
|
|
'items' => [
|
|
[
|
|
'label' => 'Ringkasan',
|
|
'icon' => 'squares-plus',
|
|
'route' => 'studio.dashboard.overview',
|
|
'match' => 'studio.dashboard.overview',
|
|
'can' => 'view studio overview',
|
|
],
|
|
[
|
|
'label' => 'Analisa',
|
|
'icon' => 'chart-bar',
|
|
'route' => 'studio.dashboard.analysis',
|
|
'match' => 'studio.dashboard.analysis',
|
|
'can' => 'view analysis',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Master',
|
|
'items' => [
|
|
[
|
|
'label' => 'Outlet',
|
|
'icon' => 'home-modern',
|
|
'route' => 'studio.master.outlet.index',
|
|
'match' => 'studio.master.outlet.*',
|
|
'can' => 'view outlet',
|
|
],
|
|
[
|
|
'label' => 'Pegawai',
|
|
'icon' => 'users',
|
|
'route' => 'studio.master.user.index',
|
|
'match' => 'studio.master.user.*',
|
|
'can' => 'view user',
|
|
],
|
|
[
|
|
'label' => 'Rumus',
|
|
'icon' => 'variable',
|
|
'route' => 'studio.master.formula.index',
|
|
'match' => 'studio.master.formula.*',
|
|
'can' => 'view formula',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Loyalty',
|
|
'items' => [
|
|
[
|
|
'label' => 'Tier',
|
|
'icon' => 'star',
|
|
'route' => 'studio.loyalty.tier.index',
|
|
'match' => 'studio.loyalty.tier.*',
|
|
'can' => 'view tier',
|
|
],
|
|
[
|
|
'label' => 'Voucher',
|
|
'icon' => 'ticket',
|
|
'route' => 'studio.loyalty.voucher.index',
|
|
'match' => 'studio.loyalty.voucher.*',
|
|
'can' => 'view voucher',
|
|
],
|
|
[
|
|
'label' => 'Customer',
|
|
'icon' => 'user-plus',
|
|
'route' => 'studio.loyalty.customer.index',
|
|
'match' => 'studio.loyalty.customer.*',
|
|
'can' => 'view customer',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Katalog',
|
|
'items' => [
|
|
[
|
|
'label' => 'Kategori',
|
|
'icon' => 'list-bullet',
|
|
'route' => 'studio.catalog.category.index',
|
|
'match' => 'studio.catalog.category.*',
|
|
'can' => 'view category',
|
|
],
|
|
[
|
|
'label' => 'Merek',
|
|
'icon' => 'tag',
|
|
'route' => 'studio.catalog.brand.index',
|
|
'match' => 'studio.catalog.brand.*',
|
|
'can' => 'view brand',
|
|
],
|
|
[
|
|
'label' => 'Parfum',
|
|
'icon' => 'flower-2',
|
|
'route' => 'studio.catalog.perfume.index',
|
|
'match' => 'studio.catalog.perfume.*',
|
|
'can' => 'view perfume',
|
|
],
|
|
[
|
|
'label' => 'Produk',
|
|
'icon' => 'boxes',
|
|
'route' => 'studio.catalog.product.index',
|
|
'match' => 'studio.catalog.product.*',
|
|
'can' => 'view product',
|
|
],
|
|
[
|
|
'label' => 'Botol',
|
|
'icon' => 'beaker',
|
|
'route' => 'studio.catalog.bottle.index',
|
|
'match' => 'studio.catalog.bottle.*',
|
|
'can' => 'view bottle',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Keuangan',
|
|
'items' => [
|
|
[
|
|
'label' => 'Pengeluaran',
|
|
'icon' => 'banknote-arrow-down',
|
|
'route' => 'studio.finance.expense.index',
|
|
'match' => 'studio.finance.expense.*',
|
|
'can' => 'view expense',
|
|
],
|
|
[
|
|
'label' => 'Penggajian',
|
|
'icon' => 'hand-coins',
|
|
'route' => 'studio.finance.payroll.index',
|
|
'match' => 'studio.finance.payroll.*',
|
|
'can' => 'view payroll',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Kelola',
|
|
'items' => [
|
|
[
|
|
'label' => 'Order',
|
|
'icon' => 'truck',
|
|
'route' => 'studio.manage.order.index',
|
|
'match' => 'studio.manage.order.*',
|
|
'can' => 'view order',
|
|
],
|
|
[
|
|
'label' => 'Belanja',
|
|
'icon' => 'shopping-bag',
|
|
'route' => 'studio.manage.purchase.index',
|
|
'match' => 'studio.manage.purchase.*',
|
|
'can' => 'view purchase',
|
|
],
|
|
[
|
|
'label' => 'Stock Opname',
|
|
'icon' => 'clipboard-document-check',
|
|
'route' => 'studio.manage.stock_opname.index',
|
|
'match' => 'studio.manage.stock_opname.*',
|
|
'can' => 'view stock opname',
|
|
],
|
|
[
|
|
'label' => 'Artikel',
|
|
'icon' => 'newspaper',
|
|
'route' => 'studio.manage.article.index',
|
|
'match' => 'studio.manage.article.*',
|
|
'can' => 'view article',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Informasi',
|
|
'items' => [
|
|
[
|
|
'label' => 'Broadcast',
|
|
'icon' => 'megaphone',
|
|
'route' => 'studio.information.broadcast.index',
|
|
'match' => 'studio.information.broadcast.*',
|
|
'can' => 'view broadcast',
|
|
],
|
|
[
|
|
'label' => 'Permintaan Harga',
|
|
'icon' => 'exclamation-triangle',
|
|
'route' => 'studio.information.price_request.index',
|
|
'match' => 'studio.information.price_request.*',
|
|
'can' => 'view price request',
|
|
'badge' => $priceRequestCount,
|
|
],
|
|
[
|
|
'label' => 'FAQs',
|
|
'icon' => 'question-mark-circle',
|
|
'route' => 'studio.information.faq.index',
|
|
'match' => 'studio.information.faq.*',
|
|
'can' => 'view faq',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Keunggulan',
|
|
'items' => [
|
|
[
|
|
'label' => 'Keunggulan Parfum',
|
|
'icon' => 'rocket-launch',
|
|
'route' => 'studio.feature.perfume_feature.index',
|
|
'match' => 'studio.feature.perfume_feature.*',
|
|
'can' => 'view perfume feature',
|
|
],
|
|
[
|
|
'label' => 'Pilih Kami',
|
|
'icon' => 'trophy',
|
|
'route' => 'studio.feature.choose_us.index',
|
|
'match' => 'studio.feature.choose_us.*',
|
|
'can' => 'view choose us',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Pengaturan',
|
|
'items' => [
|
|
[
|
|
'label' => 'Aplikasi',
|
|
'icon' => 'cog-6-tooth',
|
|
'route' => 'studio.setting.application',
|
|
'match' => 'studio.setting.application',
|
|
'can' => 'view application settings',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'heading' => 'Pintu Doraemon',
|
|
'items' => [
|
|
[
|
|
'label' => 'Member',
|
|
'icon' => 'arrow-right-end-on-rectangle',
|
|
'route' => 'member.overview',
|
|
'match' => '',
|
|
'can' => 'view member overview',
|
|
],
|
|
// [
|
|
// 'label' => 'Partner',
|
|
// 'icon' => 'arrow-right-end-on-rectangle',
|
|
// 'route' => 'partner.overview',
|
|
// 'match' => '',
|
|
// 'can' => 'view partner overview',
|
|
// ],
|
|
],
|
|
],
|
|
];
|
|
|
|
$header = [
|
|
[
|
|
'title' => 'Beranda',
|
|
'type' => 'link',
|
|
'route' => 'homepage',
|
|
'match' => 'homepage',
|
|
],
|
|
[
|
|
'title' => 'Outlet',
|
|
'type' => 'link',
|
|
'route' => 'outlet',
|
|
'match' => 'outlet',
|
|
],
|
|
[
|
|
'title' => 'Produk',
|
|
'type' => 'dropdown',
|
|
'action' => 'goToProduct',
|
|
'items' => [
|
|
[
|
|
'title' => 'Parfum',
|
|
'route' => 'product.perfume.index',
|
|
'match' => 'product.perfume.*',
|
|
],
|
|
[
|
|
'title' => 'Botol',
|
|
'route' => 'product.bottle.index',
|
|
'match' => 'product.bottle.*',
|
|
],
|
|
[
|
|
'title' => 'Arabian',
|
|
'route' => 'product.arabian.index',
|
|
'match' => 'product.arabian.*',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'title' => 'Voucher',
|
|
'type' => 'link',
|
|
'route' => 'voucher',
|
|
'match' => 'voucher',
|
|
],
|
|
[
|
|
'title' => 'Artikel',
|
|
'type' => 'link',
|
|
'route' => 'article.index',
|
|
'match' => 'article.*',
|
|
],
|
|
[
|
|
'title' => 'FAQ',
|
|
'type' => 'link',
|
|
'route' => 'faq',
|
|
'match' => 'faq',
|
|
],
|
|
];
|
|
|
|
$view->with([
|
|
'sidebar' => $sidebar,
|
|
'header' => $header,
|
|
]);
|
|
});
|
|
}
|
|
}
|