From 4cb94e3ed5ee6f2a103032c0711c4b5c026d6c9d Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Sat, 3 Jan 2026 00:12:47 +0700 Subject: [PATCH] Remove Livewire chart components for outlet revenue, expense, and channel, and their dashboard display. --- app/Livewire/Chart/ChannelRevenue.php | 48 ------------------- app/Livewire/Chart/OutletExpense.php | 47 ------------------ app/Livewire/Chart/OutletRevenue.php | 40 ---------------- app/Livewire/Chart/OutletRevenueExpense.php | 44 ----------------- .../studio/dashboard/analysis.blade.php | 9 ---- 5 files changed, 188 deletions(-) delete mode 100644 app/Livewire/Chart/ChannelRevenue.php delete mode 100644 app/Livewire/Chart/OutletExpense.php delete mode 100644 app/Livewire/Chart/OutletRevenue.php delete mode 100644 app/Livewire/Chart/OutletRevenueExpense.php diff --git a/app/Livewire/Chart/ChannelRevenue.php b/app/Livewire/Chart/ChannelRevenue.php deleted file mode 100644 index 6e6fac2..0000000 --- a/app/Livewire/Chart/ChannelRevenue.php +++ /dev/null @@ -1,48 +0,0 @@ -whereIn('outlet_id', array_keys($outlets)) - ->get() - ->groupBy('channel'); - - $data = []; - - foreach (OrderChannel::cases() as $channel) { - $channelOrders = $orders[$channel->value] ?? collect(); - $total = $channelOrders->sum('total'); - - $data[] = $total; - $this->channels[] = $channel->label(); - } - - $this->revenues = $data; - - // random colors - $count = count(OrderChannel::cases()); - $this->backgroundColors = generateRandomRgbaColors($count, 0.2); - $this->borderColors = generateRandomRgbaColors($count, 1.0); - } - - public function render() - { - return view('livewire.chart.channel-revenue'); - } -} diff --git a/app/Livewire/Chart/OutletExpense.php b/app/Livewire/Chart/OutletExpense.php deleted file mode 100644 index b15d430..0000000 --- a/app/Livewire/Chart/OutletExpense.php +++ /dev/null @@ -1,47 +0,0 @@ - $name) { - $expenseTotal = Expense::where('outlet_id', $id)->sum('amount'); - - $payrollTotal = Payroll::whereHas('user.outlets', fn ($q) => $q->where('outlet_id', $id))->sum('total_salary'); - - $total = $expenseTotal + $payrollTotal; - - $expensesData[$name] = $total; - } - - $this->outlets = array_values($outlets); - - $this->expenses = array_values($expensesData); - - // random colors - $count = count($this->outlets); - $this->backgroundColors = generateRandomRgbaColors($count, 0.2); - $this->borderColors = generateRandomRgbaColors($count, 1.0); - } - - public function render() - { - return view('livewire.chart.outlet-expense'); - } -} diff --git a/app/Livewire/Chart/OutletRevenue.php b/app/Livewire/Chart/OutletRevenue.php deleted file mode 100644 index 2a256ac..0000000 --- a/app/Livewire/Chart/OutletRevenue.php +++ /dev/null @@ -1,40 +0,0 @@ -select('outlet_id', DB::raw('SUM(total) as total_revenue')) - ->whereIn('outlet_id', array_keys($outlets)) - ->groupBy('outlet_id') - ->pluck('total_revenue', 'outlet_id'); - - $this->outlets = array_values($outlets); - - $this->revenues = collect($outlets)->map(fn ($name, $id) => $revenues[$id] ?? 0)->values()->toArray(); - - // random colors - $count = count($this->outlets); - $this->backgroundColors = generateRandomRgbaColors($count, 0.2); - $this->borderColors = generateRandomRgbaColors($count, 1.0); - } - - public function render() - { - return view('livewire.chart.outlet-revenue'); - } -} diff --git a/app/Livewire/Chart/OutletRevenueExpense.php b/app/Livewire/Chart/OutletRevenueExpense.php deleted file mode 100644 index 778e5de..0000000 --- a/app/Livewire/Chart/OutletRevenueExpense.php +++ /dev/null @@ -1,44 +0,0 @@ - $name) { - $totalRevenue = Order::where('outlet_id', $id)->sum('total'); - $revenueData[$name] = $totalRevenue; - - $expenseTotal = Expense::where('outlet_id', $id)->sum('amount'); - $payrollTotal = Payroll::whereHas('user.outlets', fn ($q) => $q->where('outlet_id', $id))->sum('total_salary'); - $expenseData[$name] = $expenseTotal + $payrollTotal; - } - - $this->outlets = array_values($outlets); - - $this->revenues = array_values($revenueData); - - $this->expenses = array_values($expenseData); - } - - public function render() - { - return view('livewire.chart.outlet-revenue-expense'); - } -} diff --git a/resources/views/livewire/studio/dashboard/analysis.blade.php b/resources/views/livewire/studio/dashboard/analysis.blade.php index 117fed5..ad29e98 100644 --- a/resources/views/livewire/studio/dashboard/analysis.blade.php +++ b/resources/views/livewire/studio/dashboard/analysis.blade.php @@ -156,14 +156,5 @@ - - @if (auth()->user()->hasRole(['Owner', 'Developer'])) -
- - - -
- - @endif