diff --git a/app/Livewire/Datatable/Studio/Catalog/BottlesTable.php b/app/Livewire/Datatable/Catalog/BottlesTable.php similarity index 99% rename from app/Livewire/Datatable/Studio/Catalog/BottlesTable.php rename to app/Livewire/Datatable/Catalog/BottlesTable.php index b7fda45..33215cf 100644 --- a/app/Livewire/Datatable/Studio/Catalog/BottlesTable.php +++ b/app/Livewire/Datatable/Catalog/BottlesTable.php @@ -1,6 +1,6 @@ with([ 'categories', diff --git a/app/Livewire/Datatable/Studio/Catalog/ProductsTable.php b/app/Livewire/Datatable/Catalog/ProductsTable.php similarity index 99% rename from app/Livewire/Datatable/Studio/Catalog/ProductsTable.php rename to app/Livewire/Datatable/Catalog/ProductsTable.php index 53941df..042dadc 100644 --- a/app/Livewire/Datatable/Studio/Catalog/ProductsTable.php +++ b/app/Livewire/Datatable/Catalog/ProductsTable.php @@ -1,6 +1,6 @@ whereIn('outlet_id', auth()->user()->outlets->pluck('id')->toArray()) ->with(['outlet', 'user', 'user.employee']); } diff --git a/app/Livewire/Datatable/Studio/Finance/PayrollsTable.php b/app/Livewire/Datatable/Finance/PayrollsTable.php similarity index 91% rename from app/Livewire/Datatable/Studio/Finance/PayrollsTable.php rename to app/Livewire/Datatable/Finance/PayrollsTable.php index caaf0d5..1b7971d 100644 --- a/app/Livewire/Datatable/Studio/Finance/PayrollsTable.php +++ b/app/Livewire/Datatable/Finance/PayrollsTable.php @@ -1,6 +1,6 @@ where('period_month', '!=', now()->format('Y-m')) ->with(['user', 'user.employee']); } diff --git a/app/Livewire/Datatable/Studio/Information/BroadcastsTable.php b/app/Livewire/Datatable/Information/BroadcastsTable.php similarity index 97% rename from app/Livewire/Datatable/Studio/Information/BroadcastsTable.php rename to app/Livewire/Datatable/Information/BroadcastsTable.php index 08626ee..ed644cf 100644 --- a/app/Livewire/Datatable/Studio/Information/BroadcastsTable.php +++ b/app/Livewire/Datatable/Information/BroadcastsTable.php @@ -1,6 +1,6 @@ with('outlets'); + return Voucher::select('id', 'name', 'code', 'tags', 'min_purchase', 'discount_amount', 'max_discount', 'quota', 'available_count', 'limit_per_user', 'start_date', 'end_date', 'type', 'created_at')->with('outlets'); } } diff --git a/app/Livewire/Datatable/Studio/Manage/ArticlesTable.php b/app/Livewire/Datatable/Manage/ArticlesTable.php similarity index 92% rename from app/Livewire/Datatable/Studio/Manage/ArticlesTable.php rename to app/Livewire/Datatable/Manage/ArticlesTable.php index 9931aef..03bb2ab 100644 --- a/app/Livewire/Datatable/Studio/Manage/ArticlesTable.php +++ b/app/Livewire/Datatable/Manage/ArticlesTable.php @@ -1,6 +1,6 @@ with(['author', 'author.employee']); + return Article::select('articles.id', 'author_id', 'title', 'articles.status', 'published_at')->with(['author', 'author.employee']); } } diff --git a/app/Livewire/Datatable/Studio/Manage/OrdersTable.php b/app/Livewire/Datatable/Manage/OrdersTable.php similarity index 99% rename from app/Livewire/Datatable/Studio/Manage/OrdersTable.php rename to app/Livewire/Datatable/Manage/OrdersTable.php index 36695ef..aacff67 100644 --- a/app/Livewire/Datatable/Studio/Manage/OrdersTable.php +++ b/app/Livewire/Datatable/Manage/OrdersTable.php @@ -1,6 +1,6 @@ with('outlet'); + return Purchase::select('purchases.id', 'outlet_id', 'invoice_number', 'purchase_date', 'total')->with('outlet'); } } diff --git a/app/Livewire/Datatable/Studio/Manage/StockOpnameTable.php b/app/Livewire/Datatable/Manage/StockOpnameTable.php similarity index 93% rename from app/Livewire/Datatable/Studio/Manage/StockOpnameTable.php rename to app/Livewire/Datatable/Manage/StockOpnameTable.php index d80f567..9ae2d78 100644 --- a/app/Livewire/Datatable/Studio/Manage/StockOpnameTable.php +++ b/app/Livewire/Datatable/Manage/StockOpnameTable.php @@ -1,6 +1,6 @@ where('period_month', '!=', now()->format('Y-m')) ->with('outlet'); } diff --git a/resources/views/livewire/studio/catalog/bottle/index.blade.php b/resources/views/livewire/studio/catalog/bottle/index.blade.php index 6663fd6..6c9641e 100644 --- a/resources/views/livewire/studio/catalog/bottle/index.blade.php +++ b/resources/views/livewire/studio/catalog/bottle/index.blade.php @@ -22,7 +22,7 @@ class="text-sm"> - + @include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/catalog/brands.blade.php b/resources/views/livewire/studio/catalog/brands.blade.php index bcee7d5..5b06ab3 100644 --- a/resources/views/livewire/studio/catalog/brands.blade.php +++ b/resources/views/livewire/studio/catalog/brands.blade.php @@ -15,7 +15,7 @@
- +
@include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/catalog/categories.blade.php b/resources/views/livewire/studio/catalog/categories.blade.php index 60f2b23..6f414a7 100644 --- a/resources/views/livewire/studio/catalog/categories.blade.php +++ b/resources/views/livewire/studio/catalog/categories.blade.php @@ -15,7 +15,7 @@
- +
@include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/catalog/perfume/index.blade.php b/resources/views/livewire/studio/catalog/perfume/index.blade.php index 63bc75f..553448f 100644 --- a/resources/views/livewire/studio/catalog/perfume/index.blade.php +++ b/resources/views/livewire/studio/catalog/perfume/index.blade.php @@ -22,7 +22,7 @@ class="text-sm"> - + @include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/catalog/product/index.blade.php b/resources/views/livewire/studio/catalog/product/index.blade.php index 7783220..caf6592 100644 --- a/resources/views/livewire/studio/catalog/product/index.blade.php +++ b/resources/views/livewire/studio/catalog/product/index.blade.php @@ -22,7 +22,7 @@ class="text-sm"> - + @include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/feature/choose-us.blade.php b/resources/views/livewire/studio/feature/choose-us.blade.php index a1c2cf1..4feec5f 100644 --- a/resources/views/livewire/studio/feature/choose-us.blade.php +++ b/resources/views/livewire/studio/feature/choose-us.blade.php @@ -16,7 +16,7 @@
- +
@include('components.modals.confirmation', [ @@ -27,7 +27,7 @@ 'buttonColor' => 'danger', 'buttonText' => 'Ya, Hapus', ]) - +
{{ $modalTitle }} diff --git a/resources/views/livewire/studio/feature/perfume-features.blade.php b/resources/views/livewire/studio/feature/perfume-features.blade.php index 950b5dd..18cc80b 100644 --- a/resources/views/livewire/studio/feature/perfume-features.blade.php +++ b/resources/views/livewire/studio/feature/perfume-features.blade.php @@ -16,7 +16,7 @@
- +
@include('components.modals.confirmation', [ @@ -27,7 +27,7 @@ 'buttonColor' => 'danger', 'buttonText' => 'Ya, Hapus', ]) - +
{{ $modalTitle }} diff --git a/resources/views/livewire/studio/finance/expenses.blade.php b/resources/views/livewire/studio/finance/expenses.blade.php index b4313ce..581cc2a 100644 --- a/resources/views/livewire/studio/finance/expenses.blade.php +++ b/resources/views/livewire/studio/finance/expenses.blade.php @@ -16,7 +16,7 @@
- +
@include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/finance/payrolls.blade.php b/resources/views/livewire/studio/finance/payrolls.blade.php index d0f8a4e..a349b4d 100644 --- a/resources/views/livewire/studio/finance/payrolls.blade.php +++ b/resources/views/livewire/studio/finance/payrolls.blade.php @@ -84,7 +84,7 @@ class="font-bold {{ $item->type->value == \App\Enums\SalaryAdjustmentType::DEDUC @endforeach - + @include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/information/broadcasts.blade.php b/resources/views/livewire/studio/information/broadcasts.blade.php index a06da44..659a1c9 100644 --- a/resources/views/livewire/studio/information/broadcasts.blade.php +++ b/resources/views/livewire/studio/information/broadcasts.blade.php @@ -15,7 +15,7 @@
- +
@include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/information/faqs.blade.php b/resources/views/livewire/studio/information/faqs.blade.php index 108b988..437e55e 100644 --- a/resources/views/livewire/studio/information/faqs.blade.php +++ b/resources/views/livewire/studio/information/faqs.blade.php @@ -15,7 +15,7 @@
- +
@include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/information/price-requests.blade.php b/resources/views/livewire/studio/information/price-requests.blade.php index f7ca4b8..018436f 100644 --- a/resources/views/livewire/studio/information/price-requests.blade.php +++ b/resources/views/livewire/studio/information/price-requests.blade.php @@ -6,7 +6,7 @@
- +
@include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/loyalty/customers.blade.php b/resources/views/livewire/studio/loyalty/customers.blade.php index 1f93cc5..dc853d0 100644 --- a/resources/views/livewire/studio/loyalty/customers.blade.php +++ b/resources/views/livewire/studio/loyalty/customers.blade.php @@ -26,7 +26,7 @@ @endif - + @include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/loyalty/voucher/index.blade.php b/resources/views/livewire/studio/loyalty/voucher/index.blade.php index 5b29f1b..365dcd5 100644 --- a/resources/views/livewire/studio/loyalty/voucher/index.blade.php +++ b/resources/views/livewire/studio/loyalty/voucher/index.blade.php @@ -25,7 +25,7 @@ class="text-sm"> @endif - + @include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/manage/article/index.blade.php b/resources/views/livewire/studio/manage/article/index.blade.php index b3d67e1..ace5258 100644 --- a/resources/views/livewire/studio/manage/article/index.blade.php +++ b/resources/views/livewire/studio/manage/article/index.blade.php @@ -14,7 +14,7 @@ class="text-sm">
- +
@include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/manage/order/index.blade.php b/resources/views/livewire/studio/manage/order/index.blade.php index e9b62a9..2257160 100644 --- a/resources/views/livewire/studio/manage/order/index.blade.php +++ b/resources/views/livewire/studio/manage/order/index.blade.php @@ -17,7 +17,7 @@ class="text-sm">
- +
@include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/manage/purchase/index.blade.php b/resources/views/livewire/studio/manage/purchase/index.blade.php index a485ef0..02cb9c2 100644 --- a/resources/views/livewire/studio/manage/purchase/index.blade.php +++ b/resources/views/livewire/studio/manage/purchase/index.blade.php @@ -21,7 +21,7 @@ class="text-sm"> - + @include('components.modals.confirmation', [ diff --git a/resources/views/livewire/studio/manage/stock-opname/index.blade.php b/resources/views/livewire/studio/manage/stock-opname/index.blade.php index e43a3dc..39e2ce6 100644 --- a/resources/views/livewire/studio/manage/stock-opname/index.blade.php +++ b/resources/views/livewire/studio/manage/stock-opname/index.blade.php @@ -99,7 +99,7 @@ @endforeach - + @include('components.modals.confirmation', [ diff --git a/tests/Feature/Livewire/Datatable/Studio/Finance/ExpensesTableTest.php b/tests/Feature/Livewire/Datatable/Studio/Finance/ExpensesTableTest.php deleted file mode 100644 index 81c6a82..0000000 --- a/tests/Feature/Livewire/Datatable/Studio/Finance/ExpensesTableTest.php +++ /dev/null @@ -1,121 +0,0 @@ -user = User::factory()->has(Employee::factory(), 'employee')->create(); - $this->outlet = Outlet::factory()->create(); - $this->user->outlets()->attach($this->outlet); - - // Give permissions to view actions - // actions column checks: update expense, delete expense, or own data - // So for own data, no perm needed. -}); - -it('renders successfully', function () { - $this->actingAs($this->user); - - Livewire::test(ExpensesTable::class) - ->assertStatus(200); -}); - -it('shows expenses from user outlets', function () { - $this->actingAs($this->user); - - Expense::factory()->create([ - 'user_id' => $this->user->id, - 'outlet_id' => $this->outlet->id, - 'description' => 'My Expense', - 'amount' => 50000, - ]); - - Livewire::test(ExpensesTable::class) - ->assertSee('My Expense') - ->assertSee('50.000'); // Assuming currency formatting adds dot for thousands (ID) -}); - -it('does not show expenses from other outlets', function () { - $this->actingAs($this->user); - - $otherOutlet = Outlet::factory()->create(); - $otherUser = User::factory()->has(Employee::factory(), 'employee')->create(); - $otherUser->outlets()->attach($otherOutlet); - - Expense::factory()->create([ - 'user_id' => $otherUser->id, - 'outlet_id' => $otherOutlet->id, - 'description' => 'Other Expense', - 'amount' => 100000, - ]); - - Livewire::test(ExpensesTable::class) - ->assertDontSee('Other Expense'); -}); - -it('can search by description', function () { - $this->actingAs($this->user); - - Expense::factory()->create([ - 'user_id' => $this->user->id, - 'outlet_id' => $this->outlet->id, - 'description' => 'UniqueTerm', - 'amount' => 12345, - ]); - - Expense::factory()->create([ - 'user_id' => $this->user->id, - 'outlet_id' => $this->outlet->id, - 'description' => 'AnotherItem', - 'amount' => 67890, - ]); - - Livewire::test(ExpensesTable::class) - ->set('search', 'UniqueTerm') // Standard search property - ->assertSee('UniqueTerm') - ->assertDontSee('AnotherItem'); -}); - -it('can search by amount', function () { - $this->actingAs($this->user); - - Expense::factory()->create([ - 'user_id' => $this->user->id, - 'outlet_id' => $this->outlet->id, - 'description' => 'Exp1', - 'amount' => 8888, - ]); - - Expense::factory()->create([ - 'user_id' => $this->user->id, - 'outlet_id' => $this->outlet->id, - 'description' => 'Exp2', - 'amount' => 9999, - ]); - - Livewire::test(ExpensesTable::class) - ->set('search', '8888') - ->assertSee('Exp1') - ->assertDontSee('Exp2'); -}); - -it('renders columns correctly', function () { - $this->actingAs($this->user); - - Livewire::test(ExpensesTable::class) - ->assertSee('Pegawai') - ->assertSee('Keterangan') - ->assertSee('Jumlah') - ->assertSee('Outlet') - ->assertSee('Tanggal') - ->assertSee('Aksi'); -});