Browse Source

feat: top customer and report info

Muhammad Iqbal Afandi 3 years ago
parent
commit
049090a243

+ 21
- 18
app/Http/Controllers/CustomerController.php View File

@@ -97,24 +97,27 @@ class CustomerController extends Controller
97 97
                 ['label' => 'Perempuan', 'value' => 1],
98 98
                 ['label' => 'Laki-laki', 'value' => 2],
99 99
             ],
100
-            'transactions' => $customer->transaction()
101
-                ->latest()
102
-                ->paginate(10)
103
-                ->withQueryString()
104
-                ->through(fn($transaction) => [
105
-                    'id' => $transaction->id,
106
-                    'transactionNumber' => $transaction->transaction_number,
107
-                    'createdAt' => $transaction->created_at,
108
-                    'customer' => [
109
-                        'number' => $customer->customer_number,
110
-                        'name' => $customer->name,
111
-                        'phone' => $customer->phone,
112
-                    ],
113
-                    'price' => $transaction->totalPriceAsFullString(),
114
-                    'outlet' => $transaction->outlet->name,
115
-                    'transactionStatusName' => $transaction->transactionStatus->name,
116
-                    'transactionStatusId' => $transaction->transactionStatus->id,
117
-                ]),
100
+            'transactions' => [
101
+                'details' => $customer->transaction()
102
+                    ->latest()
103
+                    ->paginate(10)
104
+                    ->withQueryString()
105
+                    ->through(fn($transaction) => [
106
+                        'id' => $transaction->id,
107
+                        'transactionNumber' => $transaction->transaction_number,
108
+                        'createdAt' => $transaction->created_at,
109
+                        'customer' => [
110
+                            'number' => $customer->customer_number,
111
+                            'name' => $customer->name,
112
+                            'phone' => $customer->phone,
113
+                        ],
114
+                        'price' => $transaction->totalPriceAsFullString(),
115
+                        'outlet' => $transaction->outlet->name,
116
+                        'transactionStatusName' => $transaction->transactionStatus->name,
117
+                        'transactionStatusId' => $transaction->transactionStatus->id,
118
+                    ]),
119
+                'totalTransaction' => $customer->transaction->count(),
120
+            ],
118 121
         ]);
119 122
     }
120 123
 

+ 13
- 4
app/Http/Controllers/DashboardController.php View File

@@ -33,10 +33,11 @@ class DashboardController extends Controller
33 33
 
34 34
         $products = Product::get();
35 35
 
36
-        $transactionChart = Transaction::get()->groupBy([
37
-            fn($transaction) => Carbon::parse($transaction->getRawOriginal('created_at'))->format('Y'),
38
-            fn($transaction) => Carbon::parse($transaction->getRawOriginal('created_at'))->format('M'),
39
-        ]);
36
+        $transactionChart = Transaction::get()
37
+            ->groupBy([
38
+                fn($transaction) => Carbon::parse($transaction->getRawOriginal('created_at'))->format('Y'),
39
+                fn($transaction) => Carbon::parse($transaction->getRawOriginal('created_at'))->format('M'),
40
+            ]);
40 41
 
41 42
         $mutationChart = Mutation::whereYear('created_at', date('Y'))
42 43
             ->get()
@@ -53,6 +54,9 @@ class DashboardController extends Controller
53 54
                 fn($transaction) => $transaction->outlet->name,
54 55
             ]);
55 56
 
57
+        $topTransactionChart = Transaction::get()
58
+            ->groupBy('customer_number');
59
+
56 60
         return inertia('home/Index', [
57 61
             'cardStatistics' => [
58 62
                 [
@@ -99,6 +103,11 @@ class DashboardController extends Controller
99 103
                 'description' => Carbon::parse(date('Y-m-d'))->translatedFormat('F, Y'),
100 104
                 'data' => (new TransactionService)->statisticData($transactionOutletChart)->first(),
101 105
             ],
106
+            'chartTopTransactionStatistic' => [
107
+                'title' => __('words.top_customer'),
108
+                'description' => __('words.top_number_customer', ['number' => 5]),
109
+                'data' => (new TransactionService)->topTransaction($topTransactionChart),
110
+            ],
102 111
         ]);
103 112
     }
104 113
 }

+ 20
- 12
app/Http/Controllers/ReportMutationController.php View File

@@ -6,6 +6,7 @@ use App\Exports\MutationExport;
6 6
 use App\Http\Controllers\Controller;
7 7
 use App\Models\Mutation;
8 8
 use App\Models\Outlet;
9
+use App\Services\MutationService;
9 10
 use Illuminate\Support\Facades\Gate;
10 11
 use Inertia\Inertia;
11 12
 
@@ -24,21 +25,28 @@ class ReportMutationController extends Controller
24 25
             request()->merge(['outlet' => request()->user()->outlet_id]);
25 26
         }
26 27
 
28
+        $mutations = Mutation::filter(request()->only('startDate', 'endDate', 'outlet'));
29
+
27 30
         return inertia('mutation/Report', [
28 31
             'filters' => request()->all('startDate', 'endDate', 'outlet'),
29 32
             'mutations' => Inertia::lazy(
30
-                fn() => Mutation::filter(request()->only('startDate', 'endDate', 'outlet'))
31
-                    ->latest()
32
-                    ->paginate(10)
33
-                    ->withQueryString()
34
-                    ->through(fn($mutation) => [
35
-                        'createdAt' => $mutation->created_at,
36
-                        'outlet' => $mutation->outlet->name,
37
-                        'amount' => $mutation->amount,
38
-                        'type' => $mutation->type,
39
-                        'transactionId' => $mutation->transaction_id,
40
-                        'expenseId' => $mutation->expense_id,
41
-                    ])
33
+                fn() => [
34
+                    'details' => $mutations
35
+                        ->latest()
36
+                        ->paginate(10)
37
+                        ->withQueryString()
38
+                        ->through(fn($mutation) => [
39
+                            'createdAt' => $mutation->created_at,
40
+                            'outlet' => $mutation->outlet->name,
41
+                            'amount' => $mutation->amount,
42
+                            'type' => $mutation->type,
43
+                            'transactionId' => $mutation->transaction_id,
44
+                            'expenseId' => $mutation->expense_id,
45
+                        ]),
46
+                    'totalIncome' => (new MutationService)->totalIncomeAsString($mutations->get()),
47
+                    'totalExpense' => (new MutationService)->totalExpenseAsString($mutations->get()),
48
+                    'totalAmount' => (new MutationService)->totalAmountAsString($mutations->get()),
49
+                ]
42 50
             ),
43 51
             'outlets' => Outlet::all()
44 52
                 ->transform(fn($outlet) => [

+ 9
- 5
app/Http/Controllers/ReportTransactionController.php View File

@@ -25,9 +25,9 @@ class ReportTransactionController extends Controller
25 25
             request()->merge(['outlet' => request()->user()->outlet_id]);
26 26
         }
27 27
 
28
-        $transactions = Transaction::filter(request()->only('startDate', 'endDate', 'outlet'))
29
-            ->get()
30
-            ->groupBy('created_at')
28
+        $transactions = Transaction::filter(request()->only('startDate', 'endDate', 'outlet'))->get();
29
+
30
+        $transactionGroupBy = $transactions->groupBy('created_at')
31 31
             ->transform(fn($transactions) => [[
32 32
                 'date' => $transactions->first()->getRawOriginal('created_at'),
33 33
                 'createdAt' => $transactions->first()->created_at,
@@ -37,12 +37,16 @@ class ReportTransactionController extends Controller
37 37
             ->flatten(1)
38 38
             ->toArray();
39 39
 
40
-        $transaction = (new TransactionService)->getPaginator($transactions);
40
+        $transaction = (new TransactionService)->getPaginator($transactionGroupBy);
41 41
 
42 42
         return inertia('transaction/Report', [
43 43
             'filters' => request()->all('startDate', 'endDate', 'outlet'),
44 44
             'transactions' => Inertia::lazy(
45
-                fn() => $transaction
45
+                fn() => [
46
+                    'details' => $transaction,
47
+                    'totalTransaction' => $transactions->count(),
48
+                    'totalAmount' => (new TransactionService)->totalPriceGroupAsString($transactions),
49
+                ]
46 50
             ),
47 51
             'outlets' => Outlet::all()
48 52
                 ->transform(fn($outlet) => [

+ 1
- 1
app/Services/ExpenseService.php View File

@@ -14,7 +14,7 @@ class ExpenseService extends CurrencyFormatService
14 14
 
15 15
     public function totalPriceAsString(EloquentCollection $collection)
16 16
     {
17
-        return (new CurrencyFormatService)->setRupiahFormat($this->totalPrice($collection), true);
17
+        return $this->setRupiahFormat($this->totalPrice($collection), true);
18 18
     }
19 19
 
20 20
     public function totalPerMonth(EloquentCollection $collections)

+ 1
- 1
app/Services/MutationService.php View File

@@ -39,7 +39,7 @@ class MutationService extends CurrencyFormatService
39 39
         return $this->setRupiahFormat($this->totalExpense($collections), true);
40 40
     }
41 41
 
42
-    public function totalAmount(EloquentCollection $collections)
42
+    public function totalAmountAsString(EloquentCollection $collections)
43 43
     {
44 44
         $amount = $this->totalIncome($collections) - $this->totalExpense($collections);
45 45
         return $this->setRupiahFormat($amount, true);

+ 13
- 0
app/Services/TransactionService.php View File

@@ -49,4 +49,17 @@ class TransactionService
49 49
         $collections->transform(fn($collections) => $this->totalPerMonth($collections));
50 50
         return $collections;
51 51
     }
52
+
53
+    public function topTransaction(EloquentCollection $collections, int $take = 5)
54
+    {
55
+        return $collections
56
+            ->transform(fn($collect) => [[
57
+                'customerNumber' => $collect->first()->customer->customer_number,
58
+                'name' => $collect->first()->customer->name,
59
+                'totalPrice' => $this->totalPriceGroup($collect),
60
+            ]])
61
+            ->sortByDesc('totalPrice')
62
+            ->take($take)
63
+            ->flatten(1);
64
+    }
52 65
 }

+ 2
- 0
lang/en/words.php View File

@@ -27,5 +27,7 @@ return [
27 27
     'mutation_statistic' => 'Mutations Statistic',
28 28
     'transaction_outlet_statistic' => 'Transaction Statistic/Outlet',
29 29
     'per_year' => 'Per Year',
30
+    'top_customer' => 'Top customer',
31
+    'top_number_customer' => 'Top :number Customer',
30 32
 
31 33
 ];

+ 2
- 0
lang/id/words.php View File

@@ -27,5 +27,7 @@ return [
27 27
     'mutation_statistic' => 'Statistik Mutasi',
28 28
     'transaction_outlet_statistic' => 'Statistik Transaksi/Outlet',
29 29
     'per_year' => 'Pertahun',
30
+    'top_customer' => 'Top Pelanggan',
31
+    'top_number_customer' => 'Top :number Pelanggan',
30 32
 
31 33
 ];

+ 33
- 8
public/js/resources_js_pages_customer_Edit_vue.js View File

@@ -1535,15 +1535,38 @@ var _hoisted_11 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElement
1535 1535
 );
1536 1536
 
1537 1537
 var _hoisted_12 = {
1538
-  "class": "grid"
1538
+  key: 0,
1539
+  "class": "grid mt-3 ml-1"
1539 1540
 };
1540 1541
 var _hoisted_13 = {
1542
+  "class": "col-auto"
1543
+};
1544
+
1545
+var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
1546
+  "class": "text-base"
1547
+}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
1548
+  "class": "pi pi-shopping-cart"
1549
+}), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Total Transaksi")], -1
1550
+/* HOISTED */
1551
+);
1552
+
1553
+var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
1554
+/* HOISTED */
1555
+);
1556
+
1557
+var _hoisted_16 = {
1558
+  "class": "text-xl font-bold"
1559
+};
1560
+var _hoisted_17 = {
1561
+  "class": "grid"
1562
+};
1563
+var _hoisted_18 = {
1541 1564
   "class": "col-12"
1542 1565
 };
1543
-var _hoisted_14 = {
1566
+var _hoisted_19 = {
1544 1567
   "class": "font-bold"
1545 1568
 };
1546
-var _hoisted_15 = {
1569
+var _hoisted_20 = {
1547 1570
   "class": "font-bold"
1548 1571
 };
1549 1572
 function render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -1635,12 +1658,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1635 1658
         _: 1
1636 1659
         /* STABLE */
1637 1660
 
1638
-      })])]), _hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_12, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_13, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Card, null, {
1661
+      })])]), _hoisted_11, $props.transactions.totalTransaction ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_12, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_13, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_14, _hoisted_15, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_16, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.transactions.totalTransaction), 1
1662
+      /* TEXT */
1663
+      )])])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_17, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_18, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Card, null, {
1639 1664
         content: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1640 1665
           return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_DataTable, {
1641 1666
             "responsive-layout": "scroll",
1642 1667
             "column-resize-mode": "expand",
1643
-            value: $props.transactions.data,
1668
+            value: $props.transactions.details.data,
1644 1669
             "row-hover": true,
1645 1670
             "striped-rows": true
1646 1671
           }, {
@@ -1656,7 +1681,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1656 1681
                         field = _ref.field;
1657 1682
                     return [field === 'transactionNumber' ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
1658 1683
                       key: 0
1659
-                    }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", _hoisted_14, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data[field]), 1
1684
+                    }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", _hoisted_19, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data[field]), 1
1660 1685
                     /* TEXT */
1661 1686
                     ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data.createdAt), 1
1662 1687
                     /* TEXT */
@@ -1664,7 +1689,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1664 1689
                     /* STABLE_FRAGMENT */
1665 1690
                     )) : field === 'customer' ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
1666 1691
                       key: 1
1667
-                    }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", _hoisted_15, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data.customer.number), 1
1692
+                    }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", _hoisted_20, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data.customer.number), 1
1668 1693
                     /* TEXT */
1669 1694
                     ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data.customer.name), 1
1670 1695
                     /* TEXT */
@@ -1731,7 +1756,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1731 1756
           }, 8
1732 1757
           /* PROPS */
1733 1758
           , ["value"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppPagination"], {
1734
-            links: $props.transactions.links
1759
+            links: $props.transactions.details.links
1735 1760
           }, null, 8
1736 1761
           /* PROPS */
1737 1762
           , ["links"])];

+ 4859
- 182
public/js/resources_js_pages_home_Index_vue.js
File diff suppressed because it is too large
View File


+ 87
- 20
public/js/resources_js_pages_mutation_Report_vue.js View File

@@ -386,8 +386,8 @@ __webpack_require__.r(__webpack_exports__);
386 386
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
387 387
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
388 388
 /* harmony export */ });
389
-/* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
390
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
389
+/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
390
+/* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
391 391
 /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
392 392
 /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");
393 393
 /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__);
@@ -411,9 +411,11 @@ __webpack_require__.r(__webpack_exports__);
411 411
     mutations: {
412 412
       type: Object,
413 413
       "default": {
414
-        data: [],
415
-        links: [],
416
-        total: 0
414
+        details: {
415
+          data: [],
416
+          links: [],
417
+          total: 0
418
+        }
417 419
       }
418 420
     },
419 421
     filters: Object,
@@ -429,7 +431,7 @@ __webpack_require__.r(__webpack_exports__);
429 431
       endDate: props.filters.endDate,
430 432
       outlet: props.filters.outlet
431 433
     });
432
-    (0,vue__WEBPACK_IMPORTED_MODULE_1__.onMounted)(function () {
434
+    (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function () {
433 435
       if (props.filters.startDate || props.filters.endDate) {
434 436
         if (props.filters.endDate) {
435 437
           filterForm.dates = [new Date(props.filters.startDate), new Date(props.filters.endDate)];
@@ -438,7 +440,7 @@ __webpack_require__.r(__webpack_exports__);
438 440
         }
439 441
       }
440 442
     });
441
-    (0,vue__WEBPACK_IMPORTED_MODULE_1__.watch)(filterForm, function () {
443
+    (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(filterForm, function () {
442 444
       if (filterForm.dates) {
443 445
         if (filterForm.dates[1]) {
444 446
           filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
@@ -452,7 +454,7 @@ __webpack_require__.r(__webpack_exports__);
452 454
         filterForm.startDate = null;
453 455
       }
454 456
 
455
-      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia.reload({
457
+      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.reload({
456 458
         data: lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default()({
457 459
           startDate: filterForm.startDate,
458 460
           endDate: filterForm.endDate,
@@ -465,7 +467,7 @@ __webpack_require__.r(__webpack_exports__);
465 467
     });
466 468
 
467 469
     var filterReset = function filterReset() {
468
-      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia.get('/reports/mutations');
470
+      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.get('/reports/mutations');
469 471
     };
470 472
 
471 473
     var linkReference = function linkReference(data) {
@@ -476,21 +478,19 @@ __webpack_require__.r(__webpack_exports__);
476 478
       }
477 479
     };
478 480
 
479
-    var exportExcelLink = (0,vue__WEBPACK_IMPORTED_MODULE_1__.ref)('/reports/mutations/export/excel');
481
+    var exportExcelLink = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)('/reports/mutations/export/excel');
480 482
     var __returned__ = {
481 483
       props: props,
482 484
       filterForm: filterForm,
483 485
       filterReset: filterReset,
484 486
       linkReference: linkReference,
485 487
       exportExcelLink: exportExcelLink,
486
-      Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia,
487
-      watch: vue__WEBPACK_IMPORTED_MODULE_1__.watch,
488
-      computed: vue__WEBPACK_IMPORTED_MODULE_1__.computed,
489
-      onMounted: vue__WEBPACK_IMPORTED_MODULE_1__.onMounted,
490
-      ref: vue__WEBPACK_IMPORTED_MODULE_1__.ref,
488
+      watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
489
+      onMounted: vue__WEBPACK_IMPORTED_MODULE_0__.onMounted,
490
+      ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
491
+      Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia,
491 492
       Head: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.Head,
492 493
       useForm: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm,
493
-      usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage,
494 494
       dayjs: (dayjs__WEBPACK_IMPORTED_MODULE_3___default()),
495 495
       pickBy: (lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default()),
496 496
       AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
@@ -1154,6 +1154,67 @@ var _hoisted_7 = {
1154 1154
 var _hoisted_8 = {
1155 1155
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1156 1156
 };
1157
+var _hoisted_9 = {
1158
+  key: 0,
1159
+  "class": "grid mt-3 ml-1"
1160
+};
1161
+var _hoisted_10 = {
1162
+  "class": "col-auto mr-7"
1163
+};
1164
+
1165
+var _hoisted_11 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
1166
+  "class": "text-base"
1167
+}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
1168
+  "class": "pi pi-wallet"
1169
+}), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Pendapatan")], -1
1170
+/* HOISTED */
1171
+);
1172
+
1173
+var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
1174
+/* HOISTED */
1175
+);
1176
+
1177
+var _hoisted_13 = {
1178
+  "class": "text-xl font-bold"
1179
+};
1180
+var _hoisted_14 = {
1181
+  "class": "col-auto mr-7"
1182
+};
1183
+
1184
+var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
1185
+  "class": "text-base"
1186
+}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
1187
+  "class": "pi pi-wallet"
1188
+}), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Pengeluaran")], -1
1189
+/* HOISTED */
1190
+);
1191
+
1192
+var _hoisted_16 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
1193
+/* HOISTED */
1194
+);
1195
+
1196
+var _hoisted_17 = {
1197
+  "class": "text-xl font-bold"
1198
+};
1199
+var _hoisted_18 = {
1200
+  "class": "col-auto"
1201
+};
1202
+
1203
+var _hoisted_19 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
1204
+  "class": "text-base"
1205
+}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
1206
+  "class": "pi pi-wallet"
1207
+}), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Total")], -1
1208
+/* HOISTED */
1209
+);
1210
+
1211
+var _hoisted_20 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
1212
+/* HOISTED */
1213
+);
1214
+
1215
+var _hoisted_21 = {
1216
+  "class": "text-xl font-bold"
1217
+};
1157 1218
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1158 1219
   var _component_Calendar = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Calendar");
1159 1220
 
@@ -1172,7 +1233,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1172 1233
       }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_DataTable, {
1173 1234
         "responsive-layout": "scroll",
1174 1235
         "column-resize-mode": "expand",
1175
-        value: $props.mutations.data,
1236
+        value: $props.mutations.details.data,
1176 1237
         "row-hover": true,
1177 1238
         "striped-rows": true
1178 1239
       }, {
@@ -1205,7 +1266,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1205 1266
             label: "reset",
1206 1267
             "class": "p-button-link",
1207 1268
             onClick: $setup.filterReset
1208
-          })])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [$props.mutations.total ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppButton"], {
1269
+          })])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [$props.mutations.details.total ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppButton"], {
1209 1270
             key: 0,
1210 1271
             label: "Export excel",
1211 1272
             "class-button": "p-button-outlined md:w-16rem",
@@ -1214,7 +1275,13 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1214 1275
             href: $setup.exportExcelLink
1215 1276
           }, null, 8
1216 1277
           /* PROPS */
1217
-          , ["href"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])])];
1278
+          , ["href"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]), $props.mutations.totalAmount ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_10, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_11, _hoisted_12, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_13, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalIncome), 1
1279
+          /* TEXT */
1280
+          )])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_14, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_15, _hoisted_16, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_17, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalExpense), 1
1281
+          /* TEXT */
1282
+          )])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_18, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_19, _hoisted_20, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_21, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalAmount), 1
1283
+          /* TEXT */
1284
+          )])])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
1218 1285
         }),
1219 1286
         "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1220 1287
           return [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($setup.TableHeader, function (tableHeader) {
@@ -1249,7 +1316,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1249 1316
       }, 8
1250 1317
       /* PROPS */
1251 1318
       , ["value"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppPagination"], {
1252
-        links: $props.mutations.links
1319
+        links: $props.mutations.details.links
1253 1320
       }, null, 8
1254 1321
       /* PROPS */
1255 1322
       , ["links"])];

+ 55
- 9
public/js/resources_js_pages_transaction_Report_vue.js View File

@@ -411,9 +411,11 @@ __webpack_require__.r(__webpack_exports__);
411 411
     transactions: {
412 412
       type: Object,
413 413
       "default": {
414
-        data: [],
415
-        links: [],
416
-        total: 0
414
+        details: {
415
+          data: [],
416
+          links: [],
417
+          total: 0
418
+        }
417 419
       }
418 420
     },
419 421
     filters: Object,
@@ -475,13 +477,11 @@ __webpack_require__.r(__webpack_exports__);
475 477
       filterReset: filterReset,
476 478
       exportExcelLink: exportExcelLink,
477 479
       watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
478
-      computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
479 480
       onMounted: vue__WEBPACK_IMPORTED_MODULE_0__.onMounted,
480 481
       ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
481 482
       Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia,
482 483
       Head: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.Head,
483 484
       useForm: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm,
484
-      usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage,
485 485
       dayjs: (dayjs__WEBPACK_IMPORTED_MODULE_3___default()),
486 486
       pickBy: (lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default()),
487 487
       AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
@@ -1145,6 +1145,48 @@ var _hoisted_7 = {
1145 1145
 var _hoisted_8 = {
1146 1146
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1147 1147
 };
1148
+var _hoisted_9 = {
1149
+  key: 0,
1150
+  "class": "grid mt-3 ml-1"
1151
+};
1152
+var _hoisted_10 = {
1153
+  "class": "col-auto mr-7"
1154
+};
1155
+
1156
+var _hoisted_11 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
1157
+  "class": "text-base"
1158
+}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
1159
+  "class": "pi pi-shopping-cart"
1160
+}), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Total Transaksi")], -1
1161
+/* HOISTED */
1162
+);
1163
+
1164
+var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
1165
+/* HOISTED */
1166
+);
1167
+
1168
+var _hoisted_13 = {
1169
+  "class": "text-xl font-bold"
1170
+};
1171
+var _hoisted_14 = {
1172
+  "class": "col-auto"
1173
+};
1174
+
1175
+var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
1176
+  "class": "text-base"
1177
+}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
1178
+  "class": "pi pi-wallet"
1179
+}), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Total Nilai")], -1
1180
+/* HOISTED */
1181
+);
1182
+
1183
+var _hoisted_16 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
1184
+/* HOISTED */
1185
+);
1186
+
1187
+var _hoisted_17 = {
1188
+  "class": "text-xl font-bold"
1189
+};
1148 1190
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1149 1191
   var _component_Calendar = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Calendar");
1150 1192
 
@@ -1163,7 +1205,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1163 1205
       }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_DataTable, {
1164 1206
         "responsive-layout": "scroll",
1165 1207
         "column-resize-mode": "expand",
1166
-        value: $props.transactions.data,
1208
+        value: $props.transactions.details.data,
1167 1209
         "row-hover": true,
1168 1210
         "striped-rows": true
1169 1211
       }, {
@@ -1196,7 +1238,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1196 1238
             label: "reset",
1197 1239
             "class": "p-button-link",
1198 1240
             onClick: $setup.filterReset
1199
-          })])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [$props.transactions.total ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppButton"], {
1241
+          })])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [$props.transactions.details.total ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppButton"], {
1200 1242
             key: 0,
1201 1243
             label: "Export excel",
1202 1244
             "class-button": "p-button-outlined md:w-16rem",
@@ -1205,7 +1247,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1205 1247
             href: $setup.exportExcelLink
1206 1248
           }, null, 8
1207 1249
           /* PROPS */
1208
-          , ["href"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])])];
1250
+          , ["href"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]), $props.transactions.totalAmount ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_10, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_11, _hoisted_12, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_13, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.transactions.totalTransaction), 1
1251
+          /* TEXT */
1252
+          )])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_14, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_15, _hoisted_16, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_17, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.transactions.totalAmount), 1
1253
+          /* TEXT */
1254
+          )])])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
1209 1255
         }),
1210 1256
         "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1211 1257
           return [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($setup.TransactionReportTable, function (tableHeader) {
@@ -1240,7 +1286,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1240 1286
       }, 8
1241 1287
       /* PROPS */
1242 1288
       , ["value"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppPagination"], {
1243
-        links: $props.transactions.links
1289
+        links: $props.transactions.details.links
1244 1290
       }, null, 8
1245 1291
       /* PROPS */
1246 1292
       , ["links"])];

+ 1
- 1
public/js/vue.js View File

@@ -58088,7 +58088,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
58088 58088
 /******/ 		// This function allow to reference async chunks
58089 58089
 /******/ 		__webpack_require__.u = (chunkId) => {
58090 58090
 /******/ 			// return url for filenames based on template
58091
-/******/ 			return "js/" + chunkId + ".js?id=" + {"node_modules_chart_js_auto_auto_esm_js":"10c6b388645ceb22","resources_js_pages_auth_ForgotPassword_vue":"06e3fde2f6b5dfa3","resources_js_pages_auth_Login_vue":"0d70b4f828bb2ae3","resources_js_pages_auth_ResetPassword_vue":"2ba70d514b47ecff","resources_js_pages_auth_VerifyEmail_vue":"ebac28cf5fb51cfc","resources_js_pages_customer_Create_vue":"1220be5949d46569","resources_js_pages_customer_Edit_vue":"7571072c6961cb67","resources_js_pages_customer_Index_vue":"89aeb69bc7bf9125","resources_js_pages_customer_TableHeader_js":"71be5afdca048a9c","resources_js_pages_discount_Index_vue":"7a73e2119e6e6c6f","resources_js_pages_error_Error_vue":"39121f9961877130","resources_js_pages_expense_Create_vue":"8fa047c8fcff0fa3","resources_js_pages_expense_Index_vue":"b56d8a0027fef24c","resources_js_pages_expense_Show_vue":"e46cf4a28b9e732b","resources_js_pages_expense_TableHeader_js":"72e3dee74175b1c0","resources_js_pages_home_Index_vue":"1802df7736a203e0","resources_js_pages_laundry_Create_vue":"f5731b3f078c4bff","resources_js_pages_laundry_Edit_vue":"430f285b197d2fc1","resources_js_pages_laundry_Index_vue":"ee761f9e7d6e4502","resources_js_pages_laundry_TableHeader_js":"494e577855bbcaf6","resources_js_pages_mutation_Report_vue":"f53d6840d3891069","resources_js_pages_mutation_TableHeader_js":"82c2999bd7d098a1","resources_js_pages_outlet_Create_vue":"4958b1a88d1e03d1","resources_js_pages_outlet_Edit_vue":"3ce4dea5bd8e134a","resources_js_pages_outlet_Index_vue":"f58972cb6db52f4a","resources_js_pages_outlet_TableHeader_js":"498bf7e64bc0d0c4","resources_js_pages_product_Create_vue":"6f7ae2bf0addfd2c","resources_js_pages_product_Edit_vue":"aec56d000e33fbe6","resources_js_pages_product_Index_vue":"e73d3cd965bdbfb3","resources_js_pages_product_TableHeader_js":"b8eaaa9de25a2322","resources_js_pages_transaction_Create_vue":"04881653c83db0e8","resources_js_pages_transaction_Index_vue":"54a40dce85162abd","resources_js_pages_transaction_Report_vue":"8b3c37b617041b96","resources_js_pages_transaction_Show_vue":"bc1cb7b5161b5386","resources_js_pages_transaction_TableHeader_js":"be63e672e103818b","resources_js_pages_user_Create_vue":"9328027e33f14038","resources_js_pages_user_Edit_vue":"5e97bc1dbb553877","resources_js_pages_user_Index_vue":"bc60d10f530734f1","resources_js_pages_user_Show_vue":"0acbc3d158904cf1","resources_js_pages_user_TableHeader_js":"5653ecbcd70fd235"}[chunkId] + "";
58091
+/******/ 			return "js/" + chunkId + ".js?id=" + {"node_modules_chart_js_auto_auto_esm_js":"10c6b388645ceb22","resources_js_pages_auth_ForgotPassword_vue":"06e3fde2f6b5dfa3","resources_js_pages_auth_Login_vue":"0d70b4f828bb2ae3","resources_js_pages_auth_ResetPassword_vue":"2ba70d514b47ecff","resources_js_pages_auth_VerifyEmail_vue":"ebac28cf5fb51cfc","resources_js_pages_customer_Create_vue":"1220be5949d46569","resources_js_pages_customer_Edit_vue":"9b1098714289a805","resources_js_pages_customer_Index_vue":"89aeb69bc7bf9125","resources_js_pages_customer_TableHeader_js":"71be5afdca048a9c","resources_js_pages_discount_Index_vue":"7a73e2119e6e6c6f","resources_js_pages_error_Error_vue":"39121f9961877130","resources_js_pages_expense_Create_vue":"8fa047c8fcff0fa3","resources_js_pages_expense_Index_vue":"b56d8a0027fef24c","resources_js_pages_expense_Show_vue":"e46cf4a28b9e732b","resources_js_pages_expense_TableHeader_js":"72e3dee74175b1c0","resources_js_pages_home_Index_vue":"bf3cb4af92334410","resources_js_pages_laundry_Create_vue":"f5731b3f078c4bff","resources_js_pages_laundry_Edit_vue":"430f285b197d2fc1","resources_js_pages_laundry_Index_vue":"ee761f9e7d6e4502","resources_js_pages_laundry_TableHeader_js":"494e577855bbcaf6","resources_js_pages_mutation_Report_vue":"0c16f00427eb4815","resources_js_pages_mutation_TableHeader_js":"82c2999bd7d098a1","resources_js_pages_outlet_Create_vue":"4958b1a88d1e03d1","resources_js_pages_outlet_Edit_vue":"3ce4dea5bd8e134a","resources_js_pages_outlet_Index_vue":"f58972cb6db52f4a","resources_js_pages_outlet_TableHeader_js":"498bf7e64bc0d0c4","resources_js_pages_product_Create_vue":"6f7ae2bf0addfd2c","resources_js_pages_product_Edit_vue":"aec56d000e33fbe6","resources_js_pages_product_Index_vue":"e73d3cd965bdbfb3","resources_js_pages_product_TableHeader_js":"b8eaaa9de25a2322","resources_js_pages_transaction_Create_vue":"04881653c83db0e8","resources_js_pages_transaction_Index_vue":"54a40dce85162abd","resources_js_pages_transaction_Report_vue":"a3646e1ede56ed0d","resources_js_pages_transaction_Show_vue":"bc1cb7b5161b5386","resources_js_pages_transaction_TableHeader_js":"be63e672e103818b","resources_js_pages_user_Create_vue":"9328027e33f14038","resources_js_pages_user_Edit_vue":"5e97bc1dbb553877","resources_js_pages_user_Index_vue":"bc60d10f530734f1","resources_js_pages_user_Show_vue":"0acbc3d158904cf1","resources_js_pages_user_TableHeader_js":"5653ecbcd70fd235"}[chunkId] + "";
58092 58092
 /******/ 		};
58093 58093
 /******/ 	})();
58094 58094
 /******/ 	

+ 13
- 2
resources/js/pages/customer/Edit.vue View File

@@ -112,6 +112,17 @@ const onCancel = () => (visibleDialog.value = false)
112 112
     </div>
113 113
 
114 114
     <h2>Riwayat Transaksi</h2>
115
+    <div v-if="transactions.totalTransaction" class="grid mt-3 ml-1">
116
+      <div class="col-auto">
117
+        <h2>
118
+          <span class="text-base"> <i class="pi pi-shopping-cart" /> Total Transaksi</span>
119
+
120
+          <br />
121
+
122
+          <span class="text-xl font-bold">{{ transactions.totalTransaction }}</span>
123
+        </h2>
124
+      </div>
125
+    </div>
115 126
     <div class="grid">
116 127
       <div class="col-12">
117 128
         <Card>
@@ -119,7 +130,7 @@ const onCancel = () => (visibleDialog.value = false)
119 130
             <DataTable
120 131
               responsive-layout="scroll"
121 132
               column-resize-mode="expand"
122
-              :value="transactions.data"
133
+              :value="transactions.details.data"
123 134
               :row-hover="true"
124 135
               :striped-rows="true"
125 136
             >
@@ -165,7 +176,7 @@ const onCancel = () => (visibleDialog.value = false)
165 176
               </Column>
166 177
             </DataTable>
167 178
 
168
-            <AppPagination :links="transactions.links" />
179
+            <AppPagination :links="transactions.details.links" />
169 180
           </template>
170 181
         </Card>
171 182
       </div>

+ 64
- 24
resources/js/pages/home/Index.vue View File

@@ -1,21 +1,30 @@
1 1
 <script setup>
2
-import { onMounted } from 'vue'
3 2
 import { Head } from '@inertiajs/inertia-vue3'
3
+import orderBy from 'lodash/orderBy'
4 4
 import AppLayout from '@/layouts/AppLayout.vue'
5 5
 
6
-const props = defineProps({
6
+defineProps({
7 7
   cardStatistics: Object,
8 8
   chartTransactionStatistics: Object,
9 9
   chartOutletStatistic: Object,
10
+  chartTopTransactionStatistic: Object,
10 11
 })
11 12
 
12
-onMounted(() => {
13
-  console.log(props.chartTransactionStatistics)
14
-  console.log(props.chartOutletStatistic)
15
-})
13
+const colors = [
14
+  '#349dcf',
15
+  '#00b2da',
16
+  '#00c7dd',
17
+  '#1fdbdb',
18
+  '#57eed3',
19
+  '#88ffc9',
20
+  '#96ed9a',
21
+  '#a8d96c',
22
+  '#bbc242',
23
+  '#cda91d',
24
+]
16 25
 
17 26
 const transactionBarData = (chartData) => {
18
-  const colors = ['#17b6ff', '#ffb51c']
27
+  const colors = ['#349dcf', '#a8d96c']
19 28
 
20 29
   const data = {
21 30
     datasets: [],
@@ -36,21 +45,8 @@ const transactionBarData = (chartData) => {
36 45
 }
37 46
 
38 47
 const transactionBarOption = {
39
-  responsive: true,
40 48
   maintainAspectRatio: false,
41 49
   datasetFill: false,
42
-  scales: {
43
-    y: {
44
-      ticks: {
45
-        beginAtZero: true,
46
-        callback: function (label) {
47
-          if (Math.floor(label) === label) {
48
-            return label
49
-          }
50
-        },
51
-      },
52
-    },
53
-  },
54 50
 }
55 51
 
56 52
 const transactionOutletPieData = (chartData) => {
@@ -67,7 +63,7 @@ const transactionOutletPieData = (chartData) => {
67 63
     datasets: [
68 64
       {
69 65
         data: data,
70
-        backgroundColor: ['#17b6ff', '#00c3f7', '#00cbdc', '#00d1b2', '#2bd281', '#86cf50', '#c5c623', '#ffb51c'],
66
+        backgroundColor: colors,
71 67
       },
72 68
     ],
73 69
   }
@@ -76,11 +72,35 @@ const transactionOutletPieData = (chartData) => {
76 72
 const transactionOutletPieOption = {
77 73
   maintainAspectRatio: false,
78 74
   datasetFill: false,
75
+}
76
+
77
+const topTransactionData = (chartData) => {
78
+  const labels = []
79
+  const data = []
80
+
81
+  for (const chartData of orderBy(chartData, ['totalPrice'], ['desc'])) {
82
+    labels.push([chartData.customerNumber, chartData.name])
83
+    data.push(chartData.totalPrice)
84
+  }
85
+
86
+  return {
87
+    labels: labels,
88
+    datasets: [
89
+      {
90
+        data: data,
91
+        backgroundColor: colors,
92
+      },
93
+    ],
94
+  }
95
+}
96
+
97
+const topTransactionOption = {
98
+  maintainAspectRatio: false,
99
+  datasetFill: false,
100
+  indexAxis: 'y',
79 101
   plugins: {
80 102
     legend: {
81
-      labels: {
82
-        color: '#495057',
83
-      },
103
+      display: false,
84 104
     },
85 105
   },
86 106
 }
@@ -145,6 +165,26 @@ const transactionOutletPieOption = {
145 165
           </template>
146 166
         </Card>
147 167
       </div>
168
+
169
+      <div class="col-12 md:col-6">
170
+        <Card>
171
+          <template #title>
172
+            <div class="flex flex-column">
173
+              <span>{{ chartTopTransactionStatistic.title }}</span>
174
+              <span class="text-base font-normal">{{ chartTopTransactionStatistic.description }}</span>
175
+            </div>
176
+          </template>
177
+          <template #content>
178
+            <Chart
179
+              type="bar"
180
+              :width="600"
181
+              :height="300"
182
+              :data="topTransactionData(chartTopTransactionStatistic.data)"
183
+              :options="topTransactionOption"
184
+            />
185
+          </template>
186
+        </Card>
187
+      </div>
148 188
     </div>
149 189
   </AppLayout>
150 190
 </template>

+ 40
- 8
resources/js/pages/mutation/Report.vue View File

@@ -1,7 +1,7 @@
1 1
 <script setup>
2
+import { watch, onMounted, ref } from 'vue'
2 3
 import { Inertia } from '@inertiajs/inertia'
3
-import { watch, computed, onMounted, ref } from 'vue'
4
-import { Head, useForm, usePage } from '@inertiajs/inertia-vue3'
4
+import { Head, useForm } from '@inertiajs/inertia-vue3'
5 5
 import dayjs from 'dayjs'
6 6
 import pickBy from 'lodash/pickBy'
7 7
 import AppLayout from '@/layouts/AppLayout.vue'
@@ -14,9 +14,11 @@ const props = defineProps({
14 14
   mutations: {
15 15
     type: Object,
16 16
     default: {
17
-      data: [],
18
-      links: [],
19
-      total: 0,
17
+      details: {
18
+        data: [],
19
+        links: [],
20
+        total: 0,
21
+      },
20 22
     },
21 23
   },
22 24
   filters: Object,
@@ -89,7 +91,7 @@ const exportExcelLink = ref('/reports/mutations/export/excel')
89 91
     <DataTable
90 92
       responsive-layout="scroll"
91 93
       column-resize-mode="expand"
92
-      :value="mutations.data"
94
+      :value="mutations.details.data"
93 95
       :row-hover="true"
94 96
       :striped-rows="true"
95 97
     >
@@ -126,7 +128,7 @@ const exportExcelLink = ref('/reports/mutations/export/excel')
126 128
           </div>
127 129
           <div class="col-12 md:col-4 flex flex-column md:flex-row justify-content-end">
128 130
             <AppButton
129
-              v-if="mutations.total"
131
+              v-if="mutations.details.total"
130 132
               label="Export excel"
131 133
               class-button="p-button-outlined md:w-16rem"
132 134
               icon="pi pi-file-excel"
@@ -135,6 +137,36 @@ const exportExcelLink = ref('/reports/mutations/export/excel')
135 137
             />
136 138
           </div>
137 139
         </div>
140
+
141
+        <div v-if="mutations.totalAmount" class="grid mt-3 ml-1">
142
+          <div class="col-auto mr-7">
143
+            <h2>
144
+              <span class="text-base"> <i class="pi pi-wallet" /> Pendapatan</span>
145
+
146
+              <br />
147
+
148
+              <span class="text-xl font-bold">{{ mutations.totalIncome }}</span>
149
+            </h2>
150
+          </div>
151
+          <div class="col-auto mr-7">
152
+            <h2>
153
+              <span class="text-base"> <i class="pi pi-wallet" /> Pengeluaran</span>
154
+
155
+              <br />
156
+
157
+              <span class="text-xl font-bold">{{ mutations.totalExpense }}</span>
158
+            </h2>
159
+          </div>
160
+          <div class="col-auto">
161
+            <h2>
162
+              <span class="text-base"> <i class="pi pi-wallet" /> Total</span>
163
+
164
+              <br />
165
+
166
+              <span class="text-xl font-bold">{{ mutations.totalAmount }}</span>
167
+            </h2>
168
+          </div>
169
+        </div>
138 170
       </template>
139 171
 
140 172
       <Column
@@ -155,6 +187,6 @@ const exportExcelLink = ref('/reports/mutations/export/excel')
155 187
       </Column>
156 188
     </DataTable>
157 189
 
158
-    <AppPagination :links="mutations.links" />
190
+    <AppPagination :links="mutations.details.links" />
159 191
   </AppLayout>
160 192
 </template>

+ 30
- 8
resources/js/pages/transaction/Report.vue View File

@@ -1,7 +1,7 @@
1 1
 <script setup>
2
-import { watch, computed, onMounted, ref } from 'vue'
2
+import { watch, onMounted, ref } from 'vue'
3 3
 import { Inertia } from '@inertiajs/inertia'
4
-import { Head, useForm, usePage } from '@inertiajs/inertia-vue3'
4
+import { Head, useForm } from '@inertiajs/inertia-vue3'
5 5
 import dayjs from 'dayjs'
6 6
 import pickBy from 'lodash/pickBy'
7 7
 import AppLayout from '@/layouts/AppLayout.vue'
@@ -14,9 +14,11 @@ const props = defineProps({
14 14
   transactions: {
15 15
     type: Object,
16 16
     default: {
17
-      data: [],
18
-      links: [],
19
-      total: 0,
17
+      details: {
18
+        data: [],
19
+        links: [],
20
+        total: 0,
21
+      },
20 22
     },
21 23
   },
22 24
   filters: Object,
@@ -81,7 +83,7 @@ const exportExcelLink = ref('/reports/transactions/export/excel')
81 83
     <DataTable
82 84
       responsive-layout="scroll"
83 85
       column-resize-mode="expand"
84
-      :value="transactions.data"
86
+      :value="transactions.details.data"
85 87
       :row-hover="true"
86 88
       :striped-rows="true"
87 89
     >
@@ -118,7 +120,7 @@ const exportExcelLink = ref('/reports/transactions/export/excel')
118 120
           </div>
119 121
           <div class="col-12 md:col-4 flex flex-column md:flex-row justify-content-end">
120 122
             <AppButton
121
-              v-if="transactions.total"
123
+              v-if="transactions.details.total"
122 124
               label="Export excel"
123 125
               class-button="p-button-outlined md:w-16rem"
124 126
               icon="pi pi-file-excel"
@@ -127,6 +129,26 @@ const exportExcelLink = ref('/reports/transactions/export/excel')
127 129
             />
128 130
           </div>
129 131
         </div>
132
+        <div v-if="transactions.totalAmount" class="grid mt-3 ml-1">
133
+          <div class="col-auto mr-7">
134
+            <h2>
135
+              <span class="text-base"> <i class="pi pi-shopping-cart" /> Total Transaksi</span>
136
+
137
+              <br />
138
+
139
+              <span class="text-xl font-bold">{{ transactions.totalTransaction }}</span>
140
+            </h2>
141
+          </div>
142
+          <div class="col-auto">
143
+            <h2>
144
+              <span class="text-base"> <i class="pi pi-wallet" /> Total Nilai</span>
145
+
146
+              <br />
147
+
148
+              <span class="text-xl font-bold">{{ transactions.totalAmount }}</span>
149
+            </h2>
150
+          </div>
151
+        </div>
130 152
       </template>
131 153
 
132 154
       <Column
@@ -147,6 +169,6 @@ const exportExcelLink = ref('/reports/transactions/export/excel')
147 169
       </Column>
148 170
     </DataTable>
149 171
 
150
-    <AppPagination :links="transactions.links" />
172
+    <AppPagination :links="transactions.details.links" />
151 173
   </AppLayout>
152 174
 </template>

+ 3
- 3
resources/views/excel/mutation-report.blade.php View File

@@ -33,15 +33,15 @@
33 33
         </tr>
34 34
         <tr>
35 35
             <td colspan="3">Pendapatan</td>
36
-            <td>{{ (new App\Services\MutationService)->totalIncomeAsString($mutations) }}</td>
36
+            <td>{{ (new App\Services\MutationService())->totalIncomeAsString($mutations) }}</td>
37 37
         </tr>
38 38
         <tr>
39 39
             <td colspan="3">Pengeluran</td>
40
-            <td>{{ (new App\Services\MutationService)->totalExpenseAsString($mutations) }}</td>
40
+            <td>{{ (new App\Services\MutationService())->totalExpenseAsString($mutations) }}</td>
41 41
         </tr>
42 42
         <tr>
43 43
             <td colspan="3">Jumlah</td>
44
-            <td>{{ (new App\Services\MutationService)->totalAmount($mutations) }}</td>
44
+            <td>{{ (new App\Services\MutationService())->totalAmountAsString($mutations) }}</td>
45 45
         </tr>
46 46
     </tbody>
47 47
 </table>