diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php
new file mode 100644
index 0000000..cb15799
--- /dev/null
+++ b/app/Http/Controllers/ReportsController.php
@@ -0,0 +1,154 @@
+ $request->input('page', 1),
+ 'page_size' => 5,
+ 'date_start' => $request->input('date_start'),
+ 'date_end' => $request->input('date_end'),
+ 'sorting' => $request->input('sort', 'date|desc'),
+ ];
+
+ $response = Http::get($this->apiBaseUrl . 'cms/reportMobileUsage', $params);
+ $data = $response->json();
+
+ $mobileUsageData = [];
+ $currentPage = $params['page'];
+ $lastPage = 1;
+ $total = 0;
+
+ if ($response->successful() && isset($data['data'])) {
+ $mobileUsageData = array_map(function ($item) {
+ return [
+ 'id' => $item['id'] ?? uniqid(),
+ 'date' => $item['date'],
+ 'activeUsers' => $item['active_users'],
+ 'inactiveUsers' => $item['inactive_users'],
+ 'lockedUsers' => $item['locked_users'],
+ ];
+ }, $data['data']);
+ $currentPage = $data['meta']['current_page'] ?? 1;
+ $lastPage = $data['meta']['last_page'] ?? 1;
+ $total = $data['meta']['total'] ?? count($mobileUsageData);
+ }
+
+ return view('pages.reports.mobile-usage-report', compact('mobileUsageData', 'currentPage', 'lastPage', 'total'));
+ }
+
+ public function registration(Request $request)
+ {
+ $params = [
+ 'page' => $request->input('page', 1),
+ 'page_size' => 5,
+ 'date_start' => $request->input('date_start'),
+ 'date_end' => $request->input('date_end'),
+ 'sorting' => $request->input('sort', 'date|desc'),
+ ];
+
+ $response = Http::get($this->apiBaseUrl . 'cms/reportRegistration', $params);
+ $data = $response->json();
+
+ $registrationData = [];
+ $currentPage = $params['page'];
+ $lastPage = 1;
+ $total = 0;
+
+ if ($response->successful() && isset($data['data'])) {
+ $registrationData = array_map(function ($item) {
+ return [
+ 'id' => $item['id'] ?? uniqid(),
+ 'date' => $item['date'],
+ 'activatedCards' => $item['activated_cards'],
+ 'registeredMembers' => $item['registered_members'],
+ ];
+ }, $data['data']);
+ $currentPage = $data['meta']['current_page'] ?? 1;
+ $lastPage = $data['meta']['last_page'] ?? 1;
+ $total = $data['meta']['total'] ?? count($registrationData);
+ }
+
+ return view('pages.reports.registration-report', compact('registrationData', 'currentPage', 'lastPage', 'total'));
+ }
+
+ public function stationRating(Request $request)
+ {
+ $params = [
+ 'page' => $request->input('page', 1),
+ 'page_size' => 5,
+ 'date_start' => $request->input('date_start'),
+ 'date_end' => $request->input('date_end'),
+ 'sorting' => $request->input('sort', 'transaction_date_time|desc'),
+ ];
+
+ $response = Http::get($this->apiBaseUrl . 'cms/reportStationRatings', $params);
+ $data = $response->json();
+
+ $stationRatingData = [];
+ $currentPage = $params['page'];
+ $lastPage = 1;
+ $total = 0;
+
+ if ($response->successful() && isset($data['data'])) {
+ $stationRatingData = array_map(function ($item) {
+ return [
+ 'id' => $item['id'] ?? uniqid(),
+ 'transactionDateTime' => $item['transaction_date_time'],
+ 'cardNumber' => $item['card_number'],
+ 'salesInvoice' => $item['sales_invoice'],
+ 'station' => $item['station'],
+ 'ratings' => $item['ratings'],
+ ];
+ }, $data['data']);
+ $currentPage = $data['meta']['current_page'] ?? 1;
+ $lastPage = $data['meta']['last_page'] ?? 1;
+ $total = $data['meta']['total'] ?? count($stationRatingData);
+ }
+
+ return view('pages.reports.station-rating-report', compact('stationRatingData', 'currentPage', 'lastPage', 'total'));
+ }
+
+ public function topUp(Request $request)
+ {
+ $params = [
+ 'page' => $request->input('page', 1),
+ 'page_size' => 5,
+ 'date_start' => $request->input('date_start'),
+ 'date_end' => $request->input('date_end'),
+ 'sorting' => $request->input('sort', 'transaction_date_time|desc'),
+ ];
+
+ $response = Http::get($this->apiBaseUrl . 'cms/reportTopUp', $params);
+ $data = $response->json();
+
+ $topUpData = [];
+ $currentPage = $params['page'];
+ $lastPage = 1;
+ $total = 0;
+
+ if ($response->successful() && isset($data['data'])) {
+ $topUpData = array_map(function ($item) {
+ return [
+ 'id' => $item['id'] ?? uniqid(),
+ 'transactionDateTime' => $item['transaction_date_time'],
+ 'cardNumber' => $item['card_number'],
+ 'topUpAmount' => $item['top_up_amount'],
+ ];
+ }, $data['data']);
+ $currentPage = $data['meta']['current_page'] ?? 1;
+ $lastPage = $data['meta']['last_page'] ?? 1;
+ $total = $data['meta']['total'] ?? count($topUpData);
+ }
+
+ return view('pages.reports.top-up-usage-report', compact('topUpData', 'currentPage', 'lastPage', 'total'));
+ }
+}
\ No newline at end of file
diff --git a/resources/views/components/reports-component.blade.php b/resources/views/components/reports-component.blade.php
new file mode 100644
index 0000000..e6a8f2d
--- /dev/null
+++ b/resources/views/components/reports-component.blade.php
@@ -0,0 +1,331 @@
+@props([
+ 'pageTitle' => '',
+ 'data' => [],
+ 'columns' => [],
+ 'allFields' => [],
+ 'actions' => [],
+ 'showAddButton' => false,
+ 'addButtonUrl' => '#',
+ 'showCheckboxes' => false,
+ 'showBatchDelete' => false,
+ 'showSearch' => true,
+ 'currentPage' => 1,
+ 'lastPage' => 1,
+ 'total' => 0,
+])
+
+
+
+
+
+
+ @if ($showSearch)
+
+ @endif
+ {{--
--}}
+ {{--
--}}
+
+
+
+
+
+
+
+
+
+
+
+ @foreach ($columns as $index => $column)
+
+ {{ $column['name'] }}
+ @if ($column['sortable'])
+
+ @endif
+ |
+ @endforeach
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/pages/reports/mobile-usage-report.blade.php b/resources/views/pages/reports/mobile-usage-report.blade.php
index 2570ca3..f47c495 100644
--- a/resources/views/pages/reports/mobile-usage-report.blade.php
+++ b/resources/views/pages/reports/mobile-usage-report.blade.php
@@ -3,18 +3,6 @@
@section('page_title', 'Mobile Usage Report')
@section('content')
- @php
- $mobileUsageData = [
- ['id' => 1, 'date' => '2025-04-16', 'activeUsers' => 100, 'inactiveUsers' => 20, 'lockedUsers' => 5],
- ['id' => 2, 'date' => '2025-04-15', 'activeUsers' => 95, 'inactiveUsers' => 22, 'lockedUsers' => 4],
- ['id' => 3, 'date' => '2025-04-14', 'activeUsers' => 98, 'inactiveUsers' => 18, 'lockedUsers' => 6],
- ['id' => 4, 'date' => '2025-04-13', 'activeUsers' => 102, 'inactiveUsers' => 19, 'lockedUsers' => 3],
- ['id' => 5, 'date' => '2025-04-12', 'activeUsers' => 99, 'inactiveUsers' => 21, 'lockedUsers' => 4],
- ['id' => 6, 'date' => '2025-04-11', 'activeUsers' => 101, 'inactiveUsers' => 20, 'lockedUsers' => 5],
- ['id' => 7, 'date' => '2025-04-10', 'activeUsers' => 100, 'inactiveUsers' => 19, 'lockedUsers' => 4],
- ];
- @endphp
-
Mobile Usage Report
@@ -43,8 +31,9 @@
- @include('components.table-component', [
- 'data' => $mobileUsageData,
+ @include('components.reports-component', [
+ 'pageTitle' => 'Mobile Usage Report',
+ 'data' => $mobileUsageData ?? [],
'columns' => [
['name' => 'Date', 'key' => 'date', 'sortable' => true, 'format' => 'date'],
['name' => 'Active Registered Users', 'key' => 'activeUsers', 'sortable' => true],
@@ -56,9 +45,10 @@
'showAddButton' => false,
'showCheckboxes' => false,
'showBatchDelete' => false,
- 'showEditModal' => false,
- 'showViewModal' => false,
- 'showSearch' => false
+ 'showSearch' => false,
+ 'currentPage' => $currentPage ?? 1,
+ 'lastPage' => $lastPage ?? 1,
+ 'total' => $total ?? 0,
])
@@ -93,12 +83,6 @@
diff --git a/resources/views/pages/reports/station-rating-report.blade.php b/resources/views/pages/reports/station-rating-report.blade.php
index 44198cb..f79e2d6 100644
--- a/resources/views/pages/reports/station-rating-report.blade.php
+++ b/resources/views/pages/reports/station-rating-report.blade.php
@@ -3,18 +3,6 @@
@section('page_title', 'Station Rating Report')
@section('content')
- @php
- $stationRatingData = [
- ['id' => 1, 'transactionDateTime' => '2025-04-16 10:30:00', 'cardNumber' => '4111111111111111', 'salesInvoice' => 'INV001', 'station' => 'Station A', 'ratings' => 4.5],
- ['id' => 2, 'transactionDateTime' => '2025-04-15 14:45:00', 'cardNumber' => '4012888888881881', 'salesInvoice' => 'INV002', 'station' => 'Station B', 'ratings' => 3.8],
- ['id' => 3, 'transactionDateTime' => '2025-04-14 09:15:00', 'cardNumber' => '5555555555554444', 'salesInvoice' => 'INV003', 'station' => 'Station C', 'ratings' => 4.2],
- ['id' => 4, 'transactionDateTime' => '2025-04-13 16:20:00', 'cardNumber' => '378282246310005', 'salesInvoice' => 'INV004', 'station' => 'Station D', 'ratings' => 4.0],
- ['id' => 5, 'transactionDateTime' => '2025-04-12 11:00:00', 'cardNumber' => '6011111111111117', 'salesInvoice' => 'INV005', 'station' => 'Station E', 'ratings' => 3.9],
- ['id' => 6, 'transactionDateTime' => '2025-04-11 08:50:00', 'cardNumber' => '3530111333300000', 'salesInvoice' => 'INV006', 'station' => 'Station F', 'ratings' => 4.3],
- ['id' => 7, 'transactionDateTime' => '2025-04-10 12:10:00', 'cardNumber' => '4917610000000000', 'salesInvoice' => 'INV007', 'station' => 'Station G', 'ratings' => 4.1],
- ];
- @endphp
-
Station Rating Report
@@ -43,8 +31,9 @@
- @include('components.table-component', [
- 'data' => $stationRatingData,
+ @include('components.reports-component', [
+ 'pageTitle' => 'Station Rating Report',
+ 'data' => $stationRatingData ?? [],
'columns' => [
['name' => 'Transaction Date and Time', 'key' => 'transactionDateTime', 'sortable' => true],
['name' => 'Card Number', 'key' => 'cardNumber', 'sortable' => true],
@@ -57,9 +46,10 @@
'showAddButton' => false,
'showCheckboxes' => false,
'showBatchDelete' => false,
- 'showEditModal' => false,
- 'showViewModal' => false,
- 'showSearch' => false
+ 'showSearch' => false,
+ 'currentPage' => $currentPage ?? 1,
+ 'lastPage' => $lastPage ?? 1,
+ 'total' => $total ?? 0,
])
@@ -92,64 +82,59 @@
}
-
+
@endsection
\ No newline at end of file
diff --git a/resources/views/pages/reports/top-up-usage-report.blade.php b/resources/views/pages/reports/top-up-usage-report.blade.php
index 1d71eb2..57a0f6d 100644
--- a/resources/views/pages/reports/top-up-usage-report.blade.php
+++ b/resources/views/pages/reports/top-up-usage-report.blade.php
@@ -3,53 +3,6 @@
@section('page_title', 'Top-Up Usage Report')
@section('content')
- @php
- $topUpData = [
- [
- 'id' => 1,
- 'transactionDateTime' => '2025-04-16 10:30:00',
- 'cardNumber' => '4111111111111111',
- 'topUpAmount' => '50.00'
- ],
- [
- 'id' => 2,
- 'transactionDateTime' => '2025-04-15 14:45:00',
- 'cardNumber' => '4012888888881881',
- 'topUpAmount' => '20.00'
- ],
- [
- 'id' => 3,
- 'transactionDateTime' => '2025-04-14 09:15:00',
- 'cardNumber' => '5555555555554444',
- 'topUpAmount' => '30.00'
- ],
- [
- 'id' => 4,
- 'transactionDateTime' => '2025-04-13 16:20:00',
- 'cardNumber' => '378282246310005',
- 'topUpAmount' => '10.00'
- ],
- [
- 'id' => 5,
- 'transactionDateTime' => '2025-04-12 11:00:00',
- 'cardNumber' => '6011111111111117',
- 'topUpAmount' => '40.00'
- ],
- [
- 'id' => 6,
- 'transactionDateTime' => '2025-04-11 08:50:00',
- 'cardNumber' => '3530111333300000',
- 'topUpAmount' => '25.00'
- ],
- [
- 'id' => 7,
- 'transactionDateTime' => '2025-04-10 12:10:00',
- 'cardNumber' => '4917610000000000',
- 'topUpAmount' => '15.00'
- ]
- ];
- @endphp
-
Top-Up Usage Report
@@ -78,8 +31,9 @@
- @include('components.table-component', [
- 'data' => $topUpData,
+ @include('components.reports-component', [
+ 'pageTitle' => 'Top-Up Usage Report',
+ 'data' => $topUpData ?? [],
'columns' => [
['name' => 'Transaction Date and Time', 'key' => 'transactionDateTime', 'sortable' => true],
['name' => 'Card Number', 'key' => 'cardNumber', 'sortable' => true],
@@ -90,9 +44,10 @@
'showAddButton' => false,
'showCheckboxes' => false,
'showBatchDelete' => false,
- 'showEditModal' => false,
- 'showViewModal' => false,
- 'showSearch' => false
+ 'showSearch' => false,
+ 'currentPage' => $currentPage ?? 1,
+ 'lastPage' => $lastPage ?? 1,
+ 'total' => $total ?? 0,
])
@@ -127,12 +82,6 @@