Parcourir la source

feat: reset filter

Muhammad Iqbal Afandi il y a 3 ans
Parent
révision
3048d5d93d

+ 15
- 12
app/Http/Controllers/ReportMutationController.php Voir le fichier

@@ -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 Inertia\Inertia;
9 10
 
10 11
 class ReportMutationController extends Controller
11 12
 {
@@ -18,18 +19,20 @@ class ReportMutationController extends Controller
18 19
     {
19 20
         return inertia('mutation/Report', [
20 21
             'filters' => request()->all('startDate', 'endDate', 'outlet'),
21
-            'mutations' => Mutation::filter(request()->only('startDate', 'endDate', 'outlet'))
22
-                ->latest()
23
-                ->paginate(10)
24
-                ->withQueryString()
25
-                ->through(fn($mutation) => [
26
-                    'createdAt' => $mutation->created_at,
27
-                    'outlet' => $mutation->outlet->name,
28
-                    'amount' => $mutation->amount,
29
-                    'type' => $mutation->type,
30
-                    'transactionId' => $mutation->transaction_id,
31
-                    'expenseId' => $mutation->expense_id,
32
-                ]),
22
+            'mutations' => Inertia::lazy(
23
+                fn() => Mutation::filter(request()->only('startDate', 'endDate', 'outlet'))
24
+                    ->latest()
25
+                    ->paginate(10)
26
+                    ->withQueryString()
27
+                    ->through(fn($mutation) => [
28
+                        'createdAt' => $mutation->created_at,
29
+                        'outlet' => $mutation->outlet->name,
30
+                        'amount' => $mutation->amount,
31
+                        'type' => $mutation->type,
32
+                        'transactionId' => $mutation->transaction_id,
33
+                        'expenseId' => $mutation->expense_id,
34
+                    ])
35
+            ),
33 36
             'outlets' => Outlet::all()
34 37
                 ->transform(fn($outlet) => [
35 38
                     'label' => $outlet->name,

+ 3
- 1
app/Http/Controllers/ReportTransactionController.php Voir le fichier

@@ -34,7 +34,9 @@ class ReportTransactionController extends Controller
34 34
 
35 35
         return inertia('transaction/Report', [
36 36
             'filters' => request()->all('startDate', 'endDate', 'outlet'),
37
-            'transactions' => $transaction,
37
+            'transactions' => Inertia::lazy(
38
+                fn() => $transaction
39
+            ),
38 40
             'outlets' => Outlet::all()
39 41
                 ->transform(fn($outlet) => [
40 42
                     'label' => $outlet->name,

+ 18
- 4
public/js/resources_js_pages_expense_Index_vue.js Voir le fichier

@@ -444,7 +444,7 @@ __webpack_require__.r(__webpack_exports__);
444 444
         }
445 445
       }
446 446
     });
447
-    (0,vue__WEBPACK_IMPORTED_MODULE_1__.watch)(filterForm, lodash_throttle__WEBPACK_IMPORTED_MODULE_4___default()(function () {
447
+    (0,vue__WEBPACK_IMPORTED_MODULE_1__.watch)(filterForm, function () {
448 448
       if (filterForm.dates) {
449 449
         if (filterForm.dates[1]) {
450 450
           filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
@@ -465,13 +465,19 @@ __webpack_require__.r(__webpack_exports__);
465 465
       }), {
466 466
         preserveState: true
467 467
       });
468
-    }, 300));
468
+    });
469
+
470
+    var filterReset = function filterReset() {
471
+      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia.get('/expenses');
472
+    };
473
+
469 474
     var isAdmin = (0,vue__WEBPACK_IMPORTED_MODULE_1__.computed)(function () {
470 475
       return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage)().props.value.isAdmin;
471 476
     });
472 477
     var __returned__ = {
473 478
       props: props,
474 479
       filterForm: filterForm,
480
+      filterReset: filterReset,
475 481
       isAdmin: isAdmin,
476 482
       Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia,
477 483
       watch: vue__WEBPACK_IMPORTED_MODULE_1__.watch,
@@ -1138,6 +1144,9 @@ var _hoisted_6 = {
1138 1144
   "class": "col-12 md:col-4"
1139 1145
 };
1140 1146
 var _hoisted_7 = {
1147
+  "class": "col-auto mt-2 ml-2"
1148
+};
1149
+var _hoisted_8 = {
1141 1150
   "class": "col-12 md:col-4 flex justify-content-end"
1142 1151
 };
1143 1152
 function render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -1145,6 +1154,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1145 1154
 
1146 1155
   var _component_Dropdown = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dropdown");
1147 1156
 
1157
+  var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
1158
+
1148 1159
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
1149 1160
 
1150 1161
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
@@ -1170,7 +1181,6 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1170 1181
             "selection-mode": "range",
1171 1182
             placeholder: "filter waktu...",
1172 1183
             "date-format": "dd/mm/yy",
1173
-            "show-button-bar": true,
1174 1184
             "manual-input": false
1175 1185
           }, null, 8
1176 1186
           /* PROPS */
@@ -1187,7 +1197,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1187 1197
             options: $props.outlets
1188 1198
           }, null, 8
1189 1199
           /* PROPS */
1190
-          , ["modelValue", "options"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppButton"], {
1200
+          , ["modelValue", "options"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
1201
+            label: "reset",
1202
+            "class": "p-button-link",
1203
+            onClick: $setup.filterReset
1204
+          })])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppButton"], {
1191 1205
             label: "Tambah Pengeluaran",
1192 1206
             "class": "p-button-outlined",
1193 1207
             icon: "pi pi-pencil",

+ 43
- 471
public/js/resources_js_pages_mutation_Report_vue.js Voir le fichier

@@ -401,15 +401,12 @@ __webpack_require__.r(__webpack_exports__);
401 401
 /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
402 402
 /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");
403 403
 /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__);
404
-/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/throttle */ "./node_modules/lodash/throttle.js");
405
-/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_4__);
406
-/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/pickBy */ "./node_modules/lodash/pickBy.js");
407
-/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_pickBy__WEBPACK_IMPORTED_MODULE_5__);
408
-/* harmony import */ var _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/layouts/AppLayout.vue */ "./resources/js/layouts/AppLayout.vue");
409
-/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
410
-/* harmony import */ var _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/components/AppButton.vue */ "./resources/js/components/AppButton.vue");
411
-/* harmony import */ var _TableHeader__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TableHeader */ "./resources/js/pages/mutation/TableHeader.js");
412
-
404
+/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/pickBy */ "./node_modules/lodash/pickBy.js");
405
+/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_pickBy__WEBPACK_IMPORTED_MODULE_4__);
406
+/* harmony import */ var _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/layouts/AppLayout.vue */ "./resources/js/layouts/AppLayout.vue");
407
+/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
408
+/* harmony import */ var _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/AppButton.vue */ "./resources/js/components/AppButton.vue");
409
+/* harmony import */ var _TableHeader__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TableHeader */ "./resources/js/pages/mutation/TableHeader.js");
413 410
 
414 411
 
415 412
 
@@ -421,7 +418,14 @@ __webpack_require__.r(__webpack_exports__);
421 418
 
422 419
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
423 420
   props: {
424
-    mutations: Object,
421
+    mutations: {
422
+      type: Object,
423
+      "default": {
424
+        data: [],
425
+        links: [],
426
+        total: 0
427
+      }
428
+    },
425 429
     filters: Object,
426 430
     outlets: Array
427 431
   },
@@ -444,7 +448,7 @@ __webpack_require__.r(__webpack_exports__);
444 448
         }
445 449
       }
446 450
     });
447
-    (0,vue__WEBPACK_IMPORTED_MODULE_1__.watch)(filterForm, lodash_throttle__WEBPACK_IMPORTED_MODULE_4___default()(function () {
451
+    (0,vue__WEBPACK_IMPORTED_MODULE_1__.watch)(filterForm, function () {
448 452
       if (filterForm.dates) {
449 453
         if (filterForm.dates[1]) {
450 454
           filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
@@ -458,16 +462,21 @@ __webpack_require__.r(__webpack_exports__);
458 462
         filterForm.startDate = null;
459 463
       }
460 464
 
461
-      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia.get('/reports/mutations', lodash_pickBy__WEBPACK_IMPORTED_MODULE_5___default()({
462
-        startDate: filterForm.startDate,
463
-        endDate: filterForm.endDate,
464
-        outlet: filterForm.outlet
465
-      }), {
466
-        preserveState: true
465
+      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia.reload({
466
+        data: lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default()({
467
+          startDate: filterForm.startDate,
468
+          endDate: filterForm.endDate,
469
+          outlet: filterForm.outlet
470
+        }),
471
+        only: ['mutations']
467 472
       });
468 473
       var params = window.location.search;
469 474
       exportExcelLink.value = "/reports/mutations/export/excel".concat(params);
470
-    }, 300));
475
+    });
476
+
477
+    var filterReset = function filterReset() {
478
+      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia.get('/reports/mutations');
479
+    };
471 480
 
472 481
     var linkReference = function linkReference(data) {
473 482
       if (data.transactionId) {
@@ -484,6 +493,7 @@ __webpack_require__.r(__webpack_exports__);
484 493
     var __returned__ = {
485 494
       props: props,
486 495
       filterForm: filterForm,
496
+      filterReset: filterReset,
487 497
       linkReference: linkReference,
488 498
       exportExcelLink: exportExcelLink,
489 499
       isAdmin: isAdmin,
@@ -496,12 +506,11 @@ __webpack_require__.r(__webpack_exports__);
496 506
       useForm: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm,
497 507
       usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage,
498 508
       dayjs: (dayjs__WEBPACK_IMPORTED_MODULE_3___default()),
499
-      throttle: (lodash_throttle__WEBPACK_IMPORTED_MODULE_4___default()),
500
-      pickBy: (lodash_pickBy__WEBPACK_IMPORTED_MODULE_5___default()),
501
-      AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
502
-      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
503
-      AppButton: _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_8__["default"],
504
-      TableHeader: _TableHeader__WEBPACK_IMPORTED_MODULE_9__["default"]
509
+      pickBy: (lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default()),
510
+      AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
511
+      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
512
+      AppButton: _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
513
+      TableHeader: _TableHeader__WEBPACK_IMPORTED_MODULE_8__["default"]
505 514
     };
506 515
     Object.defineProperty(__returned__, '__isScriptSetup', {
507 516
       enumerable: false,
@@ -1153,6 +1162,9 @@ var _hoisted_6 = {
1153 1162
   "class": "col-12 md:col-4"
1154 1163
 };
1155 1164
 var _hoisted_7 = {
1165
+  "class": "col-auto mt-2 ml-2"
1166
+};
1167
+var _hoisted_8 = {
1156 1168
   "class": "col-12 md:col-4 flex justify-content-end"
1157 1169
 };
1158 1170
 function render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -1160,6 +1172,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1160 1172
 
1161 1173
   var _component_Dropdown = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dropdown");
1162 1174
 
1175
+  var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
1176
+
1163 1177
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
1164 1178
 
1165 1179
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
@@ -1185,7 +1199,6 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1185 1199
             "selection-mode": "range",
1186 1200
             placeholder: "filter waktu...",
1187 1201
             "date-format": "dd/mm/yy",
1188
-            "show-button-bar": true,
1189 1202
             "manual-input": false
1190 1203
           }, null, 8
1191 1204
           /* PROPS */
@@ -1202,7 +1215,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1202 1215
             options: $props.outlets
1203 1216
           }, null, 8
1204 1217
           /* PROPS */
1205
-          , ["modelValue", "options"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [$props.mutations.total ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppButton"], {
1218
+          , ["modelValue", "options"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
1219
+            label: "reset",
1220
+            "class": "p-button-link",
1221
+            onClick: $setup.filterReset
1222
+          })])])]), (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"], {
1206 1223
             key: 0,
1207 1224
             label: "Export excel",
1208 1225
             "class-button": "p-button-outlined md:w-16rem",
@@ -2951,35 +2968,6 @@ function baseToString(value) {
2951 2968
 module.exports = baseToString;
2952 2969
 
2953 2970
 
2954
-/***/ }),
2955
-
2956
-/***/ "./node_modules/lodash/_baseTrim.js":
2957
-/*!******************************************!*\
2958
-  !*** ./node_modules/lodash/_baseTrim.js ***!
2959
-  \******************************************/
2960
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2961
-
2962
-var trimmedEndIndex = __webpack_require__(/*! ./_trimmedEndIndex */ "./node_modules/lodash/_trimmedEndIndex.js");
2963
-
2964
-/** Used to match leading whitespace. */
2965
-var reTrimStart = /^\s+/;
2966
-
2967
-/**
2968
- * The base implementation of `_.trim`.
2969
- *
2970
- * @private
2971
- * @param {string} string The string to trim.
2972
- * @returns {string} Returns the trimmed string.
2973
- */
2974
-function baseTrim(string) {
2975
-  return string
2976
-    ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
2977
-    : string;
2978
-}
2979
-
2980
-module.exports = baseTrim;
2981
-
2982
-
2983 2971
 /***/ }),
2984 2972
 
2985 2973
 /***/ "./node_modules/lodash/_baseUnary.js":
@@ -5099,236 +5087,6 @@ function toSource(func) {
5099 5087
 module.exports = toSource;
5100 5088
 
5101 5089
 
5102
-/***/ }),
5103
-
5104
-/***/ "./node_modules/lodash/_trimmedEndIndex.js":
5105
-/*!*************************************************!*\
5106
-  !*** ./node_modules/lodash/_trimmedEndIndex.js ***!
5107
-  \*************************************************/
5108
-/***/ ((module) => {
5109
-
5110
-/** Used to match a single whitespace character. */
5111
-var reWhitespace = /\s/;
5112
-
5113
-/**
5114
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
5115
- * character of `string`.
5116
- *
5117
- * @private
5118
- * @param {string} string The string to inspect.
5119
- * @returns {number} Returns the index of the last non-whitespace character.
5120
- */
5121
-function trimmedEndIndex(string) {
5122
-  var index = string.length;
5123
-
5124
-  while (index-- && reWhitespace.test(string.charAt(index))) {}
5125
-  return index;
5126
-}
5127
-
5128
-module.exports = trimmedEndIndex;
5129
-
5130
-
5131
-/***/ }),
5132
-
5133
-/***/ "./node_modules/lodash/debounce.js":
5134
-/*!*****************************************!*\
5135
-  !*** ./node_modules/lodash/debounce.js ***!
5136
-  \*****************************************/
5137
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5138
-
5139
-var isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),
5140
-    now = __webpack_require__(/*! ./now */ "./node_modules/lodash/now.js"),
5141
-    toNumber = __webpack_require__(/*! ./toNumber */ "./node_modules/lodash/toNumber.js");
5142
-
5143
-/** Error message constants. */
5144
-var FUNC_ERROR_TEXT = 'Expected a function';
5145
-
5146
-/* Built-in method references for those with the same name as other `lodash` methods. */
5147
-var nativeMax = Math.max,
5148
-    nativeMin = Math.min;
5149
-
5150
-/**
5151
- * Creates a debounced function that delays invoking `func` until after `wait`
5152
- * milliseconds have elapsed since the last time the debounced function was
5153
- * invoked. The debounced function comes with a `cancel` method to cancel
5154
- * delayed `func` invocations and a `flush` method to immediately invoke them.
5155
- * Provide `options` to indicate whether `func` should be invoked on the
5156
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
5157
- * with the last arguments provided to the debounced function. Subsequent
5158
- * calls to the debounced function return the result of the last `func`
5159
- * invocation.
5160
- *
5161
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
5162
- * invoked on the trailing edge of the timeout only if the debounced function
5163
- * is invoked more than once during the `wait` timeout.
5164
- *
5165
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
5166
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
5167
- *
5168
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
5169
- * for details over the differences between `_.debounce` and `_.throttle`.
5170
- *
5171
- * @static
5172
- * @memberOf _
5173
- * @since 0.1.0
5174
- * @category Function
5175
- * @param {Function} func The function to debounce.
5176
- * @param {number} [wait=0] The number of milliseconds to delay.
5177
- * @param {Object} [options={}] The options object.
5178
- * @param {boolean} [options.leading=false]
5179
- *  Specify invoking on the leading edge of the timeout.
5180
- * @param {number} [options.maxWait]
5181
- *  The maximum time `func` is allowed to be delayed before it's invoked.
5182
- * @param {boolean} [options.trailing=true]
5183
- *  Specify invoking on the trailing edge of the timeout.
5184
- * @returns {Function} Returns the new debounced function.
5185
- * @example
5186
- *
5187
- * // Avoid costly calculations while the window size is in flux.
5188
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
5189
- *
5190
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
5191
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
5192
- *   'leading': true,
5193
- *   'trailing': false
5194
- * }));
5195
- *
5196
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
5197
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
5198
- * var source = new EventSource('/stream');
5199
- * jQuery(source).on('message', debounced);
5200
- *
5201
- * // Cancel the trailing debounced invocation.
5202
- * jQuery(window).on('popstate', debounced.cancel);
5203
- */
5204
-function debounce(func, wait, options) {
5205
-  var lastArgs,
5206
-      lastThis,
5207
-      maxWait,
5208
-      result,
5209
-      timerId,
5210
-      lastCallTime,
5211
-      lastInvokeTime = 0,
5212
-      leading = false,
5213
-      maxing = false,
5214
-      trailing = true;
5215
-
5216
-  if (typeof func != 'function') {
5217
-    throw new TypeError(FUNC_ERROR_TEXT);
5218
-  }
5219
-  wait = toNumber(wait) || 0;
5220
-  if (isObject(options)) {
5221
-    leading = !!options.leading;
5222
-    maxing = 'maxWait' in options;
5223
-    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
5224
-    trailing = 'trailing' in options ? !!options.trailing : trailing;
5225
-  }
5226
-
5227
-  function invokeFunc(time) {
5228
-    var args = lastArgs,
5229
-        thisArg = lastThis;
5230
-
5231
-    lastArgs = lastThis = undefined;
5232
-    lastInvokeTime = time;
5233
-    result = func.apply(thisArg, args);
5234
-    return result;
5235
-  }
5236
-
5237
-  function leadingEdge(time) {
5238
-    // Reset any `maxWait` timer.
5239
-    lastInvokeTime = time;
5240
-    // Start the timer for the trailing edge.
5241
-    timerId = setTimeout(timerExpired, wait);
5242
-    // Invoke the leading edge.
5243
-    return leading ? invokeFunc(time) : result;
5244
-  }
5245
-
5246
-  function remainingWait(time) {
5247
-    var timeSinceLastCall = time - lastCallTime,
5248
-        timeSinceLastInvoke = time - lastInvokeTime,
5249
-        timeWaiting = wait - timeSinceLastCall;
5250
-
5251
-    return maxing
5252
-      ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
5253
-      : timeWaiting;
5254
-  }
5255
-
5256
-  function shouldInvoke(time) {
5257
-    var timeSinceLastCall = time - lastCallTime,
5258
-        timeSinceLastInvoke = time - lastInvokeTime;
5259
-
5260
-    // Either this is the first call, activity has stopped and we're at the
5261
-    // trailing edge, the system time has gone backwards and we're treating
5262
-    // it as the trailing edge, or we've hit the `maxWait` limit.
5263
-    return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
5264
-      (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
5265
-  }
5266
-
5267
-  function timerExpired() {
5268
-    var time = now();
5269
-    if (shouldInvoke(time)) {
5270
-      return trailingEdge(time);
5271
-    }
5272
-    // Restart the timer.
5273
-    timerId = setTimeout(timerExpired, remainingWait(time));
5274
-  }
5275
-
5276
-  function trailingEdge(time) {
5277
-    timerId = undefined;
5278
-
5279
-    // Only invoke if we have `lastArgs` which means `func` has been
5280
-    // debounced at least once.
5281
-    if (trailing && lastArgs) {
5282
-      return invokeFunc(time);
5283
-    }
5284
-    lastArgs = lastThis = undefined;
5285
-    return result;
5286
-  }
5287
-
5288
-  function cancel() {
5289
-    if (timerId !== undefined) {
5290
-      clearTimeout(timerId);
5291
-    }
5292
-    lastInvokeTime = 0;
5293
-    lastArgs = lastCallTime = lastThis = timerId = undefined;
5294
-  }
5295
-
5296
-  function flush() {
5297
-    return timerId === undefined ? result : trailingEdge(now());
5298
-  }
5299
-
5300
-  function debounced() {
5301
-    var time = now(),
5302
-        isInvoking = shouldInvoke(time);
5303
-
5304
-    lastArgs = arguments;
5305
-    lastThis = this;
5306
-    lastCallTime = time;
5307
-
5308
-    if (isInvoking) {
5309
-      if (timerId === undefined) {
5310
-        return leadingEdge(lastCallTime);
5311
-      }
5312
-      if (maxing) {
5313
-        // Handle invocations in a tight loop.
5314
-        clearTimeout(timerId);
5315
-        timerId = setTimeout(timerExpired, wait);
5316
-        return invokeFunc(lastCallTime);
5317
-      }
5318
-    }
5319
-    if (timerId === undefined) {
5320
-      timerId = setTimeout(timerExpired, wait);
5321
-    }
5322
-    return result;
5323
-  }
5324
-  debounced.cancel = cancel;
5325
-  debounced.flush = flush;
5326
-  return debounced;
5327
-}
5328
-
5329
-module.exports = debounce;
5330
-
5331
-
5332 5090
 /***/ }),
5333 5091
 
5334 5092
 /***/ "./node_modules/lodash/eq.js":
@@ -6088,39 +5846,6 @@ memoize.Cache = MapCache;
6088 5846
 module.exports = memoize;
6089 5847
 
6090 5848
 
6091
-/***/ }),
6092
-
6093
-/***/ "./node_modules/lodash/now.js":
6094
-/*!************************************!*\
6095
-  !*** ./node_modules/lodash/now.js ***!
6096
-  \************************************/
6097
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6098
-
6099
-var root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");
6100
-
6101
-/**
6102
- * Gets the timestamp of the number of milliseconds that have elapsed since
6103
- * the Unix epoch (1 January 1970 00:00:00 UTC).
6104
- *
6105
- * @static
6106
- * @memberOf _
6107
- * @since 2.4.0
6108
- * @category Date
6109
- * @returns {number} Returns the timestamp.
6110
- * @example
6111
- *
6112
- * _.defer(function(stamp) {
6113
- *   console.log(_.now() - stamp);
6114
- * }, _.now());
6115
- * // => Logs the number of milliseconds it took for the deferred invocation.
6116
- */
6117
-var now = function() {
6118
-  return root.Date.now();
6119
-};
6120
-
6121
-module.exports = now;
6122
-
6123
-
6124 5849
 /***/ }),
6125 5850
 
6126 5851
 /***/ "./node_modules/lodash/pickBy.js":
@@ -6271,159 +5996,6 @@ function stubFalse() {
6271 5996
 module.exports = stubFalse;
6272 5997
 
6273 5998
 
6274
-/***/ }),
6275
-
6276
-/***/ "./node_modules/lodash/throttle.js":
6277
-/*!*****************************************!*\
6278
-  !*** ./node_modules/lodash/throttle.js ***!
6279
-  \*****************************************/
6280
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6281
-
6282
-var debounce = __webpack_require__(/*! ./debounce */ "./node_modules/lodash/debounce.js"),
6283
-    isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js");
6284
-
6285
-/** Error message constants. */
6286
-var FUNC_ERROR_TEXT = 'Expected a function';
6287
-
6288
-/**
6289
- * Creates a throttled function that only invokes `func` at most once per
6290
- * every `wait` milliseconds. The throttled function comes with a `cancel`
6291
- * method to cancel delayed `func` invocations and a `flush` method to
6292
- * immediately invoke them. Provide `options` to indicate whether `func`
6293
- * should be invoked on the leading and/or trailing edge of the `wait`
6294
- * timeout. The `func` is invoked with the last arguments provided to the
6295
- * throttled function. Subsequent calls to the throttled function return the
6296
- * result of the last `func` invocation.
6297
- *
6298
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
6299
- * invoked on the trailing edge of the timeout only if the throttled function
6300
- * is invoked more than once during the `wait` timeout.
6301
- *
6302
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
6303
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
6304
- *
6305
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
6306
- * for details over the differences between `_.throttle` and `_.debounce`.
6307
- *
6308
- * @static
6309
- * @memberOf _
6310
- * @since 0.1.0
6311
- * @category Function
6312
- * @param {Function} func The function to throttle.
6313
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
6314
- * @param {Object} [options={}] The options object.
6315
- * @param {boolean} [options.leading=true]
6316
- *  Specify invoking on the leading edge of the timeout.
6317
- * @param {boolean} [options.trailing=true]
6318
- *  Specify invoking on the trailing edge of the timeout.
6319
- * @returns {Function} Returns the new throttled function.
6320
- * @example
6321
- *
6322
- * // Avoid excessively updating the position while scrolling.
6323
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
6324
- *
6325
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
6326
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
6327
- * jQuery(element).on('click', throttled);
6328
- *
6329
- * // Cancel the trailing throttled invocation.
6330
- * jQuery(window).on('popstate', throttled.cancel);
6331
- */
6332
-function throttle(func, wait, options) {
6333
-  var leading = true,
6334
-      trailing = true;
6335
-
6336
-  if (typeof func != 'function') {
6337
-    throw new TypeError(FUNC_ERROR_TEXT);
6338
-  }
6339
-  if (isObject(options)) {
6340
-    leading = 'leading' in options ? !!options.leading : leading;
6341
-    trailing = 'trailing' in options ? !!options.trailing : trailing;
6342
-  }
6343
-  return debounce(func, wait, {
6344
-    'leading': leading,
6345
-    'maxWait': wait,
6346
-    'trailing': trailing
6347
-  });
6348
-}
6349
-
6350
-module.exports = throttle;
6351
-
6352
-
6353
-/***/ }),
6354
-
6355
-/***/ "./node_modules/lodash/toNumber.js":
6356
-/*!*****************************************!*\
6357
-  !*** ./node_modules/lodash/toNumber.js ***!
6358
-  \*****************************************/
6359
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6360
-
6361
-var baseTrim = __webpack_require__(/*! ./_baseTrim */ "./node_modules/lodash/_baseTrim.js"),
6362
-    isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),
6363
-    isSymbol = __webpack_require__(/*! ./isSymbol */ "./node_modules/lodash/isSymbol.js");
6364
-
6365
-/** Used as references for various `Number` constants. */
6366
-var NAN = 0 / 0;
6367
-
6368
-/** Used to detect bad signed hexadecimal string values. */
6369
-var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
6370
-
6371
-/** Used to detect binary string values. */
6372
-var reIsBinary = /^0b[01]+$/i;
6373
-
6374
-/** Used to detect octal string values. */
6375
-var reIsOctal = /^0o[0-7]+$/i;
6376
-
6377
-/** Built-in method references without a dependency on `root`. */
6378
-var freeParseInt = parseInt;
6379
-
6380
-/**
6381
- * Converts `value` to a number.
6382
- *
6383
- * @static
6384
- * @memberOf _
6385
- * @since 4.0.0
6386
- * @category Lang
6387
- * @param {*} value The value to process.
6388
- * @returns {number} Returns the number.
6389
- * @example
6390
- *
6391
- * _.toNumber(3.2);
6392
- * // => 3.2
6393
- *
6394
- * _.toNumber(Number.MIN_VALUE);
6395
- * // => 5e-324
6396
- *
6397
- * _.toNumber(Infinity);
6398
- * // => Infinity
6399
- *
6400
- * _.toNumber('3.2');
6401
- * // => 3.2
6402
- */
6403
-function toNumber(value) {
6404
-  if (typeof value == 'number') {
6405
-    return value;
6406
-  }
6407
-  if (isSymbol(value)) {
6408
-    return NAN;
6409
-  }
6410
-  if (isObject(value)) {
6411
-    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
6412
-    value = isObject(other) ? (other + '') : other;
6413
-  }
6414
-  if (typeof value != 'string') {
6415
-    return value === 0 ? value : +value;
6416
-  }
6417
-  value = baseTrim(value);
6418
-  var isBinary = reIsBinary.test(value);
6419
-  return (isBinary || reIsOctal.test(value))
6420
-    ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
6421
-    : (reIsBadHex.test(value) ? NAN : +value);
6422
-}
6423
-
6424
-module.exports = toNumber;
6425
-
6426
-
6427 5999
 /***/ }),
6428 6000
 
6429 6001
 /***/ "./node_modules/lodash/toString.js":

+ 29
- 17
public/js/resources_js_pages_transaction_Index_vue.js Voir le fichier

@@ -821,7 +821,7 @@ __webpack_require__.r(__webpack_exports__);
821 821
         }
822 822
       }
823 823
     });
824
-    (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(filterForm, lodash_throttle__WEBPACK_IMPORTED_MODULE_4___default()(function () {
824
+    (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(filterForm, function () {
825 825
       if (filterForm.dates) {
826 826
         if (filterForm.dates[1]) {
827 827
           filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
@@ -843,7 +843,12 @@ __webpack_require__.r(__webpack_exports__);
843 843
       }), {
844 844
         preserveState: true
845 845
       });
846
-    }, 300));
846
+    });
847
+
848
+    var filterReset = function filterReset() {
849
+      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.get('/transactions');
850
+    };
851
+
847 852
     var transactionId = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)();
848 853
     var updateStatusDialogShow = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
849 854
     var updateStatusForm = (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm)({
@@ -908,6 +913,7 @@ __webpack_require__.r(__webpack_exports__);
908 913
     var __returned__ = {
909 914
       props: props,
910 915
       filterForm: filterForm,
916
+      filterReset: filterReset,
911 917
       transactionId: transactionId,
912 918
       updateStatusDialogShow: updateStatusDialogShow,
913 919
       updateStatusForm: updateStatusForm,
@@ -1862,30 +1868,33 @@ var _hoisted_4 = {
1862 1868
   "class": "grid"
1863 1869
 };
1864 1870
 var _hoisted_5 = {
1865
-  "class": "col-12 md:col-4"
1871
+  "class": "col-12 md:col-3"
1866 1872
 };
1867 1873
 var _hoisted_6 = {
1868
-  "class": "col-12 md:col-4"
1874
+  "class": "col-12 md:col-3"
1869 1875
 };
1870 1876
 var _hoisted_7 = {
1871
-  "class": "col-12 md:col-4"
1877
+  "class": "col-12 md:col-3"
1872 1878
 };
1873 1879
 var _hoisted_8 = {
1874
-  "class": "col-12 md:col-4 flex justify-content-end"
1880
+  "class": "col-auto mt-2 ml-2"
1875 1881
 };
1876 1882
 var _hoisted_9 = {
1877
-  "class": "font-bold"
1883
+  "class": "col-12 md:col-4 flex justify-content-end"
1878 1884
 };
1879 1885
 var _hoisted_10 = {
1880 1886
   "class": "font-bold"
1881 1887
 };
1882 1888
 var _hoisted_11 = {
1883
-  "class": "grid"
1889
+  "class": "font-bold"
1884 1890
 };
1885 1891
 var _hoisted_12 = {
1886
-  "class": "col-12"
1892
+  "class": "grid"
1887 1893
 };
1888 1894
 var _hoisted_13 = {
1895
+  "class": "col-12"
1896
+};
1897
+var _hoisted_14 = {
1889 1898
   "class": "flex justify-content-end"
1890 1899
 };
1891 1900
 function render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -1895,12 +1904,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1895 1904
 
1896 1905
   var _component_Dropdown = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dropdown");
1897 1906
 
1907
+  var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
1908
+
1898 1909
   var _component_Badge = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Badge");
1899 1910
 
1900 1911
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
1901 1912
 
1902
-  var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
1903
-
1904 1913
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1905 1914
 
1906 1915
   var _component_Dialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dialog");
@@ -1935,7 +1944,6 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1935 1944
             "selection-mode": "range",
1936 1945
             placeholder: "filter waktu...",
1937 1946
             "date-format": "dd/mm/yy",
1938
-            "show-button-bar": true,
1939 1947
             "manual-input": false
1940 1948
           }, null, 8
1941 1949
           /* PROPS */
@@ -1952,7 +1960,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1952 1960
             options: $props.outlets
1953 1961
           }, null, 8
1954 1962
           /* PROPS */
1955
-          , ["modelValue", "options"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppButton"], {
1963
+          , ["modelValue", "options"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
1964
+            label: "reset",
1965
+            "class": "p-button-link",
1966
+            onClick: $setup.filterReset
1967
+          })])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppButton"], {
1956 1968
             label: "Tambah Transaksi",
1957 1969
             "class": "p-button-outlined md:w-16rem",
1958 1970
             icon: "pi pi-pencil",
@@ -1973,7 +1985,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1973 1985
                     field = _ref.field;
1974 1986
                 return [field === 'transactionNumber' ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
1975 1987
                   key: 0
1976
-                }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", _hoisted_9, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data[field]), 1
1988
+                }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", _hoisted_10, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data[field]), 1
1977 1989
                 /* TEXT */
1978 1990
                 ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data.createdAt), 1
1979 1991
                 /* TEXT */
@@ -1981,7 +1993,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1981 1993
                 /* STABLE_FRAGMENT */
1982 1994
                 )) : field === 'customer' ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
1983 1995
                   key: 1
1984
-                }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", _hoisted_10, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data.customer.number), 1
1996
+                }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", _hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data.customer.number), 1
1985 1997
                 /* TEXT */
1986 1998
                 ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(data.customer.name), 1
1987 1999
                 /* TEXT */
@@ -2077,7 +2089,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2077 2089
         onHide: $setup.updateStatusDialogShow
2078 2090
       }, {
2079 2091
         footer: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
2080
-          return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_13, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
2092
+          return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_14, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
2081 2093
             label: "Simpan",
2082 2094
             icon: "pi pi-check",
2083 2095
             "class": "p-button-text",
@@ -2088,7 +2100,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2088 2100
           , ["disabled"])])];
2089 2101
         }),
2090 2102
         "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
2091
-          return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_11, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_12, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppDropdown"], {
2103
+          return [(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)($setup["AppDropdown"], {
2092 2104
             label: "Perbaharui Status",
2093 2105
             placeholder: "pilih satu",
2094 2106
             modelValue: $setup.updateStatusForm.transaction_status_id,

+ 54
- 481
public/js/resources_js_pages_transaction_Report_vue.js Voir le fichier

@@ -396,20 +396,17 @@ __webpack_require__.r(__webpack_exports__);
396 396
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
397 397
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
398 398
 /* harmony export */ });
399
-/* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
400
-/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
399
+/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
400
+/* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
401 401
 /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
402 402
 /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");
403 403
 /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__);
404
-/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/throttle */ "./node_modules/lodash/throttle.js");
405
-/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_4__);
406
-/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/pickBy */ "./node_modules/lodash/pickBy.js");
407
-/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_pickBy__WEBPACK_IMPORTED_MODULE_5__);
408
-/* harmony import */ var _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/layouts/AppLayout.vue */ "./resources/js/layouts/AppLayout.vue");
409
-/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
410
-/* harmony import */ var _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/components/AppButton.vue */ "./resources/js/components/AppButton.vue");
411
-/* harmony import */ var _TableHeader__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TableHeader */ "./resources/js/pages/transaction/TableHeader.js");
412
-
404
+/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/pickBy */ "./node_modules/lodash/pickBy.js");
405
+/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_pickBy__WEBPACK_IMPORTED_MODULE_4__);
406
+/* harmony import */ var _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/layouts/AppLayout.vue */ "./resources/js/layouts/AppLayout.vue");
407
+/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
408
+/* harmony import */ var _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/AppButton.vue */ "./resources/js/components/AppButton.vue");
409
+/* harmony import */ var _TableHeader__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TableHeader */ "./resources/js/pages/transaction/TableHeader.js");
413 410
 
414 411
 
415 412
 
@@ -421,7 +418,14 @@ __webpack_require__.r(__webpack_exports__);
421 418
 
422 419
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
423 420
   props: {
424
-    transactions: Object,
421
+    transactions: {
422
+      type: Object,
423
+      "default": {
424
+        data: [],
425
+        links: [],
426
+        total: 0
427
+      }
428
+    },
425 429
     filters: Object,
426 430
     outlets: Array
427 431
   },
@@ -435,7 +439,7 @@ __webpack_require__.r(__webpack_exports__);
435 439
       endDate: props.filters.endDate,
436 440
       outlet: props.filters.outlet
437 441
     });
438
-    (0,vue__WEBPACK_IMPORTED_MODULE_1__.onMounted)(function () {
442
+    (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function () {
439 443
       if (props.filters.startDate || props.filters.endDate) {
440 444
         if (props.filters.endDate) {
441 445
           filterForm.dates = [new Date(props.filters.startDate), new Date(props.filters.endDate)];
@@ -444,7 +448,7 @@ __webpack_require__.r(__webpack_exports__);
444 448
         }
445 449
       }
446 450
     });
447
-    (0,vue__WEBPACK_IMPORTED_MODULE_1__.watch)(filterForm, lodash_throttle__WEBPACK_IMPORTED_MODULE_4___default()(function () {
451
+    (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(filterForm, function () {
448 452
       if (filterForm.dates) {
449 453
         if (filterForm.dates[1]) {
450 454
           filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
@@ -458,40 +462,46 @@ __webpack_require__.r(__webpack_exports__);
458 462
         filterForm.startDate = null;
459 463
       }
460 464
 
461
-      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia.get('/reports/transactions', lodash_pickBy__WEBPACK_IMPORTED_MODULE_5___default()({
462
-        startDate: filterForm.startDate,
463
-        endDate: filterForm.endDate,
464
-        outlet: filterForm.outlet
465
-      }), {
466
-        preserveState: true
465
+      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.reload({
466
+        data: lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default()({
467
+          startDate: filterForm.startDate,
468
+          endDate: filterForm.endDate,
469
+          outlet: filterForm.outlet
470
+        }),
471
+        only: ['transactions']
467 472
       });
468 473
       var params = window.location.search;
469 474
       exportExcelLink.value = "/reports/transactions/export/excel".concat(params);
470
-    }, 300));
471
-    var exportExcelLink = (0,vue__WEBPACK_IMPORTED_MODULE_1__.ref)('/reports/transactions/export/excel');
472
-    var isAdmin = (0,vue__WEBPACK_IMPORTED_MODULE_1__.computed)(function () {
475
+    });
476
+
477
+    var filterReset = function filterReset() {
478
+      _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.get('/reports/transactions');
479
+    };
480
+
481
+    var exportExcelLink = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)('/reports/transactions/export/excel');
482
+    var isAdmin = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
473 483
       return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage)().props.value.isAdmin;
474 484
     });
475 485
     var __returned__ = {
476 486
       props: props,
477 487
       filterForm: filterForm,
488
+      filterReset: filterReset,
478 489
       exportExcelLink: exportExcelLink,
479 490
       isAdmin: isAdmin,
480
-      Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia,
481
-      watch: vue__WEBPACK_IMPORTED_MODULE_1__.watch,
482
-      computed: vue__WEBPACK_IMPORTED_MODULE_1__.computed,
483
-      onMounted: vue__WEBPACK_IMPORTED_MODULE_1__.onMounted,
484
-      ref: vue__WEBPACK_IMPORTED_MODULE_1__.ref,
491
+      watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
492
+      computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
493
+      onMounted: vue__WEBPACK_IMPORTED_MODULE_0__.onMounted,
494
+      ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
495
+      Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia,
485 496
       Head: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.Head,
486 497
       useForm: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm,
487 498
       usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage,
488 499
       dayjs: (dayjs__WEBPACK_IMPORTED_MODULE_3___default()),
489
-      throttle: (lodash_throttle__WEBPACK_IMPORTED_MODULE_4___default()),
490
-      pickBy: (lodash_pickBy__WEBPACK_IMPORTED_MODULE_5___default()),
491
-      AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
492
-      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
493
-      AppButton: _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_8__["default"],
494
-      TransactionReportTable: _TableHeader__WEBPACK_IMPORTED_MODULE_9__.TransactionReportTable
500
+      pickBy: (lodash_pickBy__WEBPACK_IMPORTED_MODULE_4___default()),
501
+      AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
502
+      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
503
+      AppButton: _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
504
+      TransactionReportTable: _TableHeader__WEBPACK_IMPORTED_MODULE_8__.TransactionReportTable
495 505
     };
496 506
     Object.defineProperty(__returned__, '__isScriptSetup', {
497 507
       enumerable: false,
@@ -1143,6 +1153,9 @@ var _hoisted_6 = {
1143 1153
   "class": "col-12 md:col-4"
1144 1154
 };
1145 1155
 var _hoisted_7 = {
1156
+  "class": "col-auto mt-2 ml-2"
1157
+};
1158
+var _hoisted_8 = {
1146 1159
   "class": "col-12 md:col-4 flex justify-content-end"
1147 1160
 };
1148 1161
 function render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -1150,6 +1163,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1150 1163
 
1151 1164
   var _component_Dropdown = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dropdown");
1152 1165
 
1166
+  var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
1167
+
1153 1168
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
1154 1169
 
1155 1170
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
@@ -1175,7 +1190,6 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1175 1190
             "selection-mode": "range",
1176 1191
             placeholder: "filter waktu...",
1177 1192
             "date-format": "dd/mm/yy",
1178
-            "show-button-bar": true,
1179 1193
             "manual-input": false
1180 1194
           }, null, 8
1181 1195
           /* PROPS */
@@ -1192,7 +1206,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1192 1206
             options: $props.outlets
1193 1207
           }, null, 8
1194 1208
           /* PROPS */
1195
-          , ["modelValue", "options"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [$props.transactions.total ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppButton"], {
1209
+          , ["modelValue", "options"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
1210
+            label: "reset",
1211
+            "class": "p-button-link",
1212
+            onClick: $setup.filterReset
1213
+          })])])]), (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"], {
1196 1214
             key: 0,
1197 1215
             label: "Export excel",
1198 1216
             "class-button": "p-button-outlined md:w-16rem",
@@ -2975,35 +2993,6 @@ function baseToString(value) {
2975 2993
 module.exports = baseToString;
2976 2994
 
2977 2995
 
2978
-/***/ }),
2979
-
2980
-/***/ "./node_modules/lodash/_baseTrim.js":
2981
-/*!******************************************!*\
2982
-  !*** ./node_modules/lodash/_baseTrim.js ***!
2983
-  \******************************************/
2984
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2985
-
2986
-var trimmedEndIndex = __webpack_require__(/*! ./_trimmedEndIndex */ "./node_modules/lodash/_trimmedEndIndex.js");
2987
-
2988
-/** Used to match leading whitespace. */
2989
-var reTrimStart = /^\s+/;
2990
-
2991
-/**
2992
- * The base implementation of `_.trim`.
2993
- *
2994
- * @private
2995
- * @param {string} string The string to trim.
2996
- * @returns {string} Returns the trimmed string.
2997
- */
2998
-function baseTrim(string) {
2999
-  return string
3000
-    ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
3001
-    : string;
3002
-}
3003
-
3004
-module.exports = baseTrim;
3005
-
3006
-
3007 2996
 /***/ }),
3008 2997
 
3009 2998
 /***/ "./node_modules/lodash/_baseUnary.js":
@@ -5123,236 +5112,6 @@ function toSource(func) {
5123 5112
 module.exports = toSource;
5124 5113
 
5125 5114
 
5126
-/***/ }),
5127
-
5128
-/***/ "./node_modules/lodash/_trimmedEndIndex.js":
5129
-/*!*************************************************!*\
5130
-  !*** ./node_modules/lodash/_trimmedEndIndex.js ***!
5131
-  \*************************************************/
5132
-/***/ ((module) => {
5133
-
5134
-/** Used to match a single whitespace character. */
5135
-var reWhitespace = /\s/;
5136
-
5137
-/**
5138
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
5139
- * character of `string`.
5140
- *
5141
- * @private
5142
- * @param {string} string The string to inspect.
5143
- * @returns {number} Returns the index of the last non-whitespace character.
5144
- */
5145
-function trimmedEndIndex(string) {
5146
-  var index = string.length;
5147
-
5148
-  while (index-- && reWhitespace.test(string.charAt(index))) {}
5149
-  return index;
5150
-}
5151
-
5152
-module.exports = trimmedEndIndex;
5153
-
5154
-
5155
-/***/ }),
5156
-
5157
-/***/ "./node_modules/lodash/debounce.js":
5158
-/*!*****************************************!*\
5159
-  !*** ./node_modules/lodash/debounce.js ***!
5160
-  \*****************************************/
5161
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5162
-
5163
-var isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),
5164
-    now = __webpack_require__(/*! ./now */ "./node_modules/lodash/now.js"),
5165
-    toNumber = __webpack_require__(/*! ./toNumber */ "./node_modules/lodash/toNumber.js");
5166
-
5167
-/** Error message constants. */
5168
-var FUNC_ERROR_TEXT = 'Expected a function';
5169
-
5170
-/* Built-in method references for those with the same name as other `lodash` methods. */
5171
-var nativeMax = Math.max,
5172
-    nativeMin = Math.min;
5173
-
5174
-/**
5175
- * Creates a debounced function that delays invoking `func` until after `wait`
5176
- * milliseconds have elapsed since the last time the debounced function was
5177
- * invoked. The debounced function comes with a `cancel` method to cancel
5178
- * delayed `func` invocations and a `flush` method to immediately invoke them.
5179
- * Provide `options` to indicate whether `func` should be invoked on the
5180
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
5181
- * with the last arguments provided to the debounced function. Subsequent
5182
- * calls to the debounced function return the result of the last `func`
5183
- * invocation.
5184
- *
5185
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
5186
- * invoked on the trailing edge of the timeout only if the debounced function
5187
- * is invoked more than once during the `wait` timeout.
5188
- *
5189
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
5190
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
5191
- *
5192
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
5193
- * for details over the differences between `_.debounce` and `_.throttle`.
5194
- *
5195
- * @static
5196
- * @memberOf _
5197
- * @since 0.1.0
5198
- * @category Function
5199
- * @param {Function} func The function to debounce.
5200
- * @param {number} [wait=0] The number of milliseconds to delay.
5201
- * @param {Object} [options={}] The options object.
5202
- * @param {boolean} [options.leading=false]
5203
- *  Specify invoking on the leading edge of the timeout.
5204
- * @param {number} [options.maxWait]
5205
- *  The maximum time `func` is allowed to be delayed before it's invoked.
5206
- * @param {boolean} [options.trailing=true]
5207
- *  Specify invoking on the trailing edge of the timeout.
5208
- * @returns {Function} Returns the new debounced function.
5209
- * @example
5210
- *
5211
- * // Avoid costly calculations while the window size is in flux.
5212
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
5213
- *
5214
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
5215
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
5216
- *   'leading': true,
5217
- *   'trailing': false
5218
- * }));
5219
- *
5220
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
5221
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
5222
- * var source = new EventSource('/stream');
5223
- * jQuery(source).on('message', debounced);
5224
- *
5225
- * // Cancel the trailing debounced invocation.
5226
- * jQuery(window).on('popstate', debounced.cancel);
5227
- */
5228
-function debounce(func, wait, options) {
5229
-  var lastArgs,
5230
-      lastThis,
5231
-      maxWait,
5232
-      result,
5233
-      timerId,
5234
-      lastCallTime,
5235
-      lastInvokeTime = 0,
5236
-      leading = false,
5237
-      maxing = false,
5238
-      trailing = true;
5239
-
5240
-  if (typeof func != 'function') {
5241
-    throw new TypeError(FUNC_ERROR_TEXT);
5242
-  }
5243
-  wait = toNumber(wait) || 0;
5244
-  if (isObject(options)) {
5245
-    leading = !!options.leading;
5246
-    maxing = 'maxWait' in options;
5247
-    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
5248
-    trailing = 'trailing' in options ? !!options.trailing : trailing;
5249
-  }
5250
-
5251
-  function invokeFunc(time) {
5252
-    var args = lastArgs,
5253
-        thisArg = lastThis;
5254
-
5255
-    lastArgs = lastThis = undefined;
5256
-    lastInvokeTime = time;
5257
-    result = func.apply(thisArg, args);
5258
-    return result;
5259
-  }
5260
-
5261
-  function leadingEdge(time) {
5262
-    // Reset any `maxWait` timer.
5263
-    lastInvokeTime = time;
5264
-    // Start the timer for the trailing edge.
5265
-    timerId = setTimeout(timerExpired, wait);
5266
-    // Invoke the leading edge.
5267
-    return leading ? invokeFunc(time) : result;
5268
-  }
5269
-
5270
-  function remainingWait(time) {
5271
-    var timeSinceLastCall = time - lastCallTime,
5272
-        timeSinceLastInvoke = time - lastInvokeTime,
5273
-        timeWaiting = wait - timeSinceLastCall;
5274
-
5275
-    return maxing
5276
-      ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
5277
-      : timeWaiting;
5278
-  }
5279
-
5280
-  function shouldInvoke(time) {
5281
-    var timeSinceLastCall = time - lastCallTime,
5282
-        timeSinceLastInvoke = time - lastInvokeTime;
5283
-
5284
-    // Either this is the first call, activity has stopped and we're at the
5285
-    // trailing edge, the system time has gone backwards and we're treating
5286
-    // it as the trailing edge, or we've hit the `maxWait` limit.
5287
-    return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
5288
-      (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
5289
-  }
5290
-
5291
-  function timerExpired() {
5292
-    var time = now();
5293
-    if (shouldInvoke(time)) {
5294
-      return trailingEdge(time);
5295
-    }
5296
-    // Restart the timer.
5297
-    timerId = setTimeout(timerExpired, remainingWait(time));
5298
-  }
5299
-
5300
-  function trailingEdge(time) {
5301
-    timerId = undefined;
5302
-
5303
-    // Only invoke if we have `lastArgs` which means `func` has been
5304
-    // debounced at least once.
5305
-    if (trailing && lastArgs) {
5306
-      return invokeFunc(time);
5307
-    }
5308
-    lastArgs = lastThis = undefined;
5309
-    return result;
5310
-  }
5311
-
5312
-  function cancel() {
5313
-    if (timerId !== undefined) {
5314
-      clearTimeout(timerId);
5315
-    }
5316
-    lastInvokeTime = 0;
5317
-    lastArgs = lastCallTime = lastThis = timerId = undefined;
5318
-  }
5319
-
5320
-  function flush() {
5321
-    return timerId === undefined ? result : trailingEdge(now());
5322
-  }
5323
-
5324
-  function debounced() {
5325
-    var time = now(),
5326
-        isInvoking = shouldInvoke(time);
5327
-
5328
-    lastArgs = arguments;
5329
-    lastThis = this;
5330
-    lastCallTime = time;
5331
-
5332
-    if (isInvoking) {
5333
-      if (timerId === undefined) {
5334
-        return leadingEdge(lastCallTime);
5335
-      }
5336
-      if (maxing) {
5337
-        // Handle invocations in a tight loop.
5338
-        clearTimeout(timerId);
5339
-        timerId = setTimeout(timerExpired, wait);
5340
-        return invokeFunc(lastCallTime);
5341
-      }
5342
-    }
5343
-    if (timerId === undefined) {
5344
-      timerId = setTimeout(timerExpired, wait);
5345
-    }
5346
-    return result;
5347
-  }
5348
-  debounced.cancel = cancel;
5349
-  debounced.flush = flush;
5350
-  return debounced;
5351
-}
5352
-
5353
-module.exports = debounce;
5354
-
5355
-
5356 5115
 /***/ }),
5357 5116
 
5358 5117
 /***/ "./node_modules/lodash/eq.js":
@@ -6112,39 +5871,6 @@ memoize.Cache = MapCache;
6112 5871
 module.exports = memoize;
6113 5872
 
6114 5873
 
6115
-/***/ }),
6116
-
6117
-/***/ "./node_modules/lodash/now.js":
6118
-/*!************************************!*\
6119
-  !*** ./node_modules/lodash/now.js ***!
6120
-  \************************************/
6121
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6122
-
6123
-var root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");
6124
-
6125
-/**
6126
- * Gets the timestamp of the number of milliseconds that have elapsed since
6127
- * the Unix epoch (1 January 1970 00:00:00 UTC).
6128
- *
6129
- * @static
6130
- * @memberOf _
6131
- * @since 2.4.0
6132
- * @category Date
6133
- * @returns {number} Returns the timestamp.
6134
- * @example
6135
- *
6136
- * _.defer(function(stamp) {
6137
- *   console.log(_.now() - stamp);
6138
- * }, _.now());
6139
- * // => Logs the number of milliseconds it took for the deferred invocation.
6140
- */
6141
-var now = function() {
6142
-  return root.Date.now();
6143
-};
6144
-
6145
-module.exports = now;
6146
-
6147
-
6148 5874
 /***/ }),
6149 5875
 
6150 5876
 /***/ "./node_modules/lodash/pickBy.js":
@@ -6295,159 +6021,6 @@ function stubFalse() {
6295 6021
 module.exports = stubFalse;
6296 6022
 
6297 6023
 
6298
-/***/ }),
6299
-
6300
-/***/ "./node_modules/lodash/throttle.js":
6301
-/*!*****************************************!*\
6302
-  !*** ./node_modules/lodash/throttle.js ***!
6303
-  \*****************************************/
6304
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6305
-
6306
-var debounce = __webpack_require__(/*! ./debounce */ "./node_modules/lodash/debounce.js"),
6307
-    isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js");
6308
-
6309
-/** Error message constants. */
6310
-var FUNC_ERROR_TEXT = 'Expected a function';
6311
-
6312
-/**
6313
- * Creates a throttled function that only invokes `func` at most once per
6314
- * every `wait` milliseconds. The throttled function comes with a `cancel`
6315
- * method to cancel delayed `func` invocations and a `flush` method to
6316
- * immediately invoke them. Provide `options` to indicate whether `func`
6317
- * should be invoked on the leading and/or trailing edge of the `wait`
6318
- * timeout. The `func` is invoked with the last arguments provided to the
6319
- * throttled function. Subsequent calls to the throttled function return the
6320
- * result of the last `func` invocation.
6321
- *
6322
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
6323
- * invoked on the trailing edge of the timeout only if the throttled function
6324
- * is invoked more than once during the `wait` timeout.
6325
- *
6326
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
6327
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
6328
- *
6329
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
6330
- * for details over the differences between `_.throttle` and `_.debounce`.
6331
- *
6332
- * @static
6333
- * @memberOf _
6334
- * @since 0.1.0
6335
- * @category Function
6336
- * @param {Function} func The function to throttle.
6337
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
6338
- * @param {Object} [options={}] The options object.
6339
- * @param {boolean} [options.leading=true]
6340
- *  Specify invoking on the leading edge of the timeout.
6341
- * @param {boolean} [options.trailing=true]
6342
- *  Specify invoking on the trailing edge of the timeout.
6343
- * @returns {Function} Returns the new throttled function.
6344
- * @example
6345
- *
6346
- * // Avoid excessively updating the position while scrolling.
6347
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
6348
- *
6349
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
6350
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
6351
- * jQuery(element).on('click', throttled);
6352
- *
6353
- * // Cancel the trailing throttled invocation.
6354
- * jQuery(window).on('popstate', throttled.cancel);
6355
- */
6356
-function throttle(func, wait, options) {
6357
-  var leading = true,
6358
-      trailing = true;
6359
-
6360
-  if (typeof func != 'function') {
6361
-    throw new TypeError(FUNC_ERROR_TEXT);
6362
-  }
6363
-  if (isObject(options)) {
6364
-    leading = 'leading' in options ? !!options.leading : leading;
6365
-    trailing = 'trailing' in options ? !!options.trailing : trailing;
6366
-  }
6367
-  return debounce(func, wait, {
6368
-    'leading': leading,
6369
-    'maxWait': wait,
6370
-    'trailing': trailing
6371
-  });
6372
-}
6373
-
6374
-module.exports = throttle;
6375
-
6376
-
6377
-/***/ }),
6378
-
6379
-/***/ "./node_modules/lodash/toNumber.js":
6380
-/*!*****************************************!*\
6381
-  !*** ./node_modules/lodash/toNumber.js ***!
6382
-  \*****************************************/
6383
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6384
-
6385
-var baseTrim = __webpack_require__(/*! ./_baseTrim */ "./node_modules/lodash/_baseTrim.js"),
6386
-    isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),
6387
-    isSymbol = __webpack_require__(/*! ./isSymbol */ "./node_modules/lodash/isSymbol.js");
6388
-
6389
-/** Used as references for various `Number` constants. */
6390
-var NAN = 0 / 0;
6391
-
6392
-/** Used to detect bad signed hexadecimal string values. */
6393
-var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
6394
-
6395
-/** Used to detect binary string values. */
6396
-var reIsBinary = /^0b[01]+$/i;
6397
-
6398
-/** Used to detect octal string values. */
6399
-var reIsOctal = /^0o[0-7]+$/i;
6400
-
6401
-/** Built-in method references without a dependency on `root`. */
6402
-var freeParseInt = parseInt;
6403
-
6404
-/**
6405
- * Converts `value` to a number.
6406
- *
6407
- * @static
6408
- * @memberOf _
6409
- * @since 4.0.0
6410
- * @category Lang
6411
- * @param {*} value The value to process.
6412
- * @returns {number} Returns the number.
6413
- * @example
6414
- *
6415
- * _.toNumber(3.2);
6416
- * // => 3.2
6417
- *
6418
- * _.toNumber(Number.MIN_VALUE);
6419
- * // => 5e-324
6420
- *
6421
- * _.toNumber(Infinity);
6422
- * // => Infinity
6423
- *
6424
- * _.toNumber('3.2');
6425
- * // => 3.2
6426
- */
6427
-function toNumber(value) {
6428
-  if (typeof value == 'number') {
6429
-    return value;
6430
-  }
6431
-  if (isSymbol(value)) {
6432
-    return NAN;
6433
-  }
6434
-  if (isObject(value)) {
6435
-    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
6436
-    value = isObject(other) ? (other + '') : other;
6437
-  }
6438
-  if (typeof value != 'string') {
6439
-    return value === 0 ? value : +value;
6440
-  }
6441
-  value = baseTrim(value);
6442
-  var isBinary = reIsBinary.test(value);
6443
-  return (isBinary || reIsOctal.test(value))
6444
-    ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
6445
-    : (reIsBadHex.test(value) ? NAN : +value);
6446
-}
6447
-
6448
-module.exports = toNumber;
6449
-
6450
-
6451 6024
 /***/ }),
6452 6025
 
6453 6026
 /***/ "./node_modules/lodash/toString.js":

+ 1
- 1
public/js/vue.js Voir le fichier

@@ -57778,7 +57778,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
57778 57778
 /******/ 		// This function allow to reference async chunks
57779 57779
 /******/ 		__webpack_require__.u = (chunkId) => {
57780 57780
 /******/ 			// return url for filenames based on template
57781
-/******/ 			return "js/" + chunkId + ".js?id=" + {"resources_js_pages_Access_vue":"a18ed856923fae52","resources_js_pages_auth_ForgotPassword_vue":"c9f401672b6f2423","resources_js_pages_auth_Login_vue":"cb0cb153b976d2c1","resources_js_pages_auth_ResetPassword_vue":"1078df5cebf2e3c6","resources_js_pages_auth_VerifyEmail_vue":"a0ee23b849c826b1","resources_js_pages_customer_Create_vue":"a3cba38b65a678ea","resources_js_pages_customer_Edit_vue":"6529085778080d36","resources_js_pages_customer_Index_vue":"aea07a25c21bfc45","resources_js_pages_customer_TableHeader_js":"71be5afdca048a9c","resources_js_pages_discount_Index_vue":"31e829a87f7e517d","resources_js_pages_expense_Create_vue":"f625b4fbdf8889af","resources_js_pages_expense_Index_vue":"6430d7df81d7f9d0","resources_js_pages_expense_Show_vue":"4801bedc7912088f","resources_js_pages_expense_TableHeader_js":"72e3dee74175b1c0","resources_js_pages_laundry_Create_vue":"17128fbd0e28898d","resources_js_pages_laundry_Edit_vue":"2bd6d1f463c9a9a3","resources_js_pages_laundry_Index_vue":"96eee4afb428456e","resources_js_pages_laundry_TableHeader_js":"494e577855bbcaf6","resources_js_pages_mutation_Report_vue":"c65a8ada6e5952f4","resources_js_pages_mutation_TableHeader_js":"82c2999bd7d098a1","resources_js_pages_outlet_Create_vue":"bdf868378013b7e7","resources_js_pages_outlet_Edit_vue":"77775fdca5fe7621","resources_js_pages_outlet_Index_vue":"2e36a83555378ccb","resources_js_pages_outlet_TableHeader_js":"498bf7e64bc0d0c4","resources_js_pages_product_Create_vue":"0d0dddb2e60ec31c","resources_js_pages_product_Edit_vue":"59d0ee7b5403f776","resources_js_pages_product_Index_vue":"73a854a747e35d21","resources_js_pages_product_TableHeader_js":"b8eaaa9de25a2322","resources_js_pages_transaction_Create_vue":"ea4b3be68403cd31","resources_js_pages_transaction_Index_vue":"271760c84b8b6295","resources_js_pages_transaction_Report_vue":"1a5d0eb3c141f232","resources_js_pages_transaction_Show_vue":"ebd8059da08e93b1","resources_js_pages_transaction_TableHeader_js":"be63e672e103818b","resources_js_pages_user_Create_vue":"da0b02d8fda8f9a0","resources_js_pages_user_Edit_vue":"cf9a306d21f40913","resources_js_pages_user_Index_vue":"badcb54776b8c7e0","resources_js_pages_user_Show_vue":"1474a0ad843dc2d5","resources_js_pages_user_TableHeader_js":"5653ecbcd70fd235"}[chunkId] + "";
57781
+/******/ 			return "js/" + chunkId + ".js?id=" + {"resources_js_pages_Access_vue":"a18ed856923fae52","resources_js_pages_auth_ForgotPassword_vue":"c9f401672b6f2423","resources_js_pages_auth_Login_vue":"cb0cb153b976d2c1","resources_js_pages_auth_ResetPassword_vue":"1078df5cebf2e3c6","resources_js_pages_auth_VerifyEmail_vue":"a0ee23b849c826b1","resources_js_pages_customer_Create_vue":"a3cba38b65a678ea","resources_js_pages_customer_Edit_vue":"6529085778080d36","resources_js_pages_customer_Index_vue":"aea07a25c21bfc45","resources_js_pages_customer_TableHeader_js":"71be5afdca048a9c","resources_js_pages_discount_Index_vue":"31e829a87f7e517d","resources_js_pages_expense_Create_vue":"f625b4fbdf8889af","resources_js_pages_expense_Index_vue":"ad6478718f2fbf90","resources_js_pages_expense_Show_vue":"4801bedc7912088f","resources_js_pages_expense_TableHeader_js":"72e3dee74175b1c0","resources_js_pages_laundry_Create_vue":"17128fbd0e28898d","resources_js_pages_laundry_Edit_vue":"2bd6d1f463c9a9a3","resources_js_pages_laundry_Index_vue":"96eee4afb428456e","resources_js_pages_laundry_TableHeader_js":"494e577855bbcaf6","resources_js_pages_mutation_Report_vue":"aaaf24154a43b9f5","resources_js_pages_mutation_TableHeader_js":"82c2999bd7d098a1","resources_js_pages_outlet_Create_vue":"bdf868378013b7e7","resources_js_pages_outlet_Edit_vue":"77775fdca5fe7621","resources_js_pages_outlet_Index_vue":"2e36a83555378ccb","resources_js_pages_outlet_TableHeader_js":"498bf7e64bc0d0c4","resources_js_pages_product_Create_vue":"0d0dddb2e60ec31c","resources_js_pages_product_Edit_vue":"59d0ee7b5403f776","resources_js_pages_product_Index_vue":"73a854a747e35d21","resources_js_pages_product_TableHeader_js":"b8eaaa9de25a2322","resources_js_pages_transaction_Create_vue":"ea4b3be68403cd31","resources_js_pages_transaction_Index_vue":"1dcdc1cb350a954b","resources_js_pages_transaction_Report_vue":"bd0a1b87dd8a494b","resources_js_pages_transaction_Show_vue":"ebd8059da08e93b1","resources_js_pages_transaction_TableHeader_js":"be63e672e103818b","resources_js_pages_user_Create_vue":"da0b02d8fda8f9a0","resources_js_pages_user_Edit_vue":"cf9a306d21f40913","resources_js_pages_user_Index_vue":"badcb54776b8c7e0","resources_js_pages_user_Show_vue":"1474a0ad843dc2d5","resources_js_pages_user_TableHeader_js":"5653ecbcd70fd235"}[chunkId] + "";
57782 57782
 /******/ 		};
57783 57783
 /******/ 	})();
57784 57784
 /******/ 	

+ 29
- 26
resources/js/pages/expense/Index.vue Voir le fichier

@@ -34,35 +34,36 @@ onMounted(() => {
34 34
   }
35 35
 })
36 36
 
37
-watch(
38
-  filterForm,
39
-  throttle(() => {
40
-    if (filterForm.dates) {
41
-      if (filterForm.dates[1]) {
42
-        filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
43
-        filterForm.endDate = dayjs(filterForm.dates[1]).format('YYYY-MM-DD')
44
-      } else {
45
-        filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
46
-        filterForm.endDate = null
47
-      }
37
+watch(filterForm, () => {
38
+  if (filterForm.dates) {
39
+    if (filterForm.dates[1]) {
40
+      filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
41
+      filterForm.endDate = dayjs(filterForm.dates[1]).format('YYYY-MM-DD')
48 42
     } else {
43
+      filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
49 44
       filterForm.endDate = null
50
-      filterForm.startDate = null
51 45
     }
46
+  } else {
47
+    filterForm.endDate = null
48
+    filterForm.startDate = null
49
+  }
52 50
 
53
-    Inertia.get(
54
-      '/expenses',
55
-      pickBy({
56
-        startDate: filterForm.startDate,
57
-        endDate: filterForm.endDate,
58
-        outlet: filterForm.outlet,
59
-      }),
60
-      {
61
-        preserveState: true,
62
-      }
63
-    )
64
-  }, 300)
65
-)
51
+  Inertia.get(
52
+    '/expenses',
53
+    pickBy({
54
+      startDate: filterForm.startDate,
55
+      endDate: filterForm.endDate,
56
+      outlet: filterForm.outlet,
57
+    }),
58
+    {
59
+      preserveState: true,
60
+    }
61
+  )
62
+})
63
+
64
+const filterReset = () => {
65
+  Inertia.get('/expenses')
66
+}
66 67
 
67 68
 const isAdmin = computed(() => usePage().props.value.isAdmin)
68 69
 </script>
@@ -91,7 +92,6 @@ const isAdmin = computed(() => usePage().props.value.isAdmin)
91 92
                   selection-mode="range"
92 93
                   placeholder="filter waktu..."
93 94
                   date-format="dd/mm/yy"
94
-                  :show-button-bar="true"
95 95
                   :manual-input="false"
96 96
                 />
97 97
               </div>
@@ -106,6 +106,9 @@ const isAdmin = computed(() => usePage().props.value.isAdmin)
106 106
                   :options="outlets"
107 107
                 />
108 108
               </div>
109
+              <div class="col-auto mt-2 ml-2">
110
+                <Button label="reset" class="p-button-link" @click="filterReset" />
111
+              </div>
109 112
             </div>
110 113
           </div>
111 114
           <div class="col-12 md:col-4 flex justify-content-end">

+ 37
- 31
resources/js/pages/mutation/Report.vue Voir le fichier

@@ -3,7 +3,6 @@ import { Inertia } from '@inertiajs/inertia'
3 3
 import { watch, computed, onMounted, ref } from 'vue'
4 4
 import { Head, useForm, usePage } from '@inertiajs/inertia-vue3'
5 5
 import dayjs from 'dayjs'
6
-import throttle from 'lodash/throttle'
7 6
 import pickBy from 'lodash/pickBy'
8 7
 import AppLayout from '@/layouts/AppLayout.vue'
9 8
 import AppPagination from '@/components/AppPagination.vue'
@@ -12,7 +11,14 @@ import AppButton from '@/components/AppButton.vue'
12 11
 import TableHeader from './TableHeader'
13 12
 
14 13
 const props = defineProps({
15
-  mutations: Object,
14
+  mutations: {
15
+    type: Object,
16
+    default: {
17
+      data: [],
18
+      links: [],
19
+      total: 0,
20
+    },
21
+  },
16 22
   filters: Object,
17 23
   outlets: Array,
18 24
 })
@@ -34,38 +40,36 @@ onMounted(() => {
34 40
   }
35 41
 })
36 42
 
37
-watch(
38
-  filterForm,
39
-  throttle(() => {
40
-    if (filterForm.dates) {
41
-      if (filterForm.dates[1]) {
42
-        filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
43
-        filterForm.endDate = dayjs(filterForm.dates[1]).format('YYYY-MM-DD')
44
-      } else {
45
-        filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
46
-        filterForm.endDate = null
47
-      }
43
+watch(filterForm, () => {
44
+  if (filterForm.dates) {
45
+    if (filterForm.dates[1]) {
46
+      filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
47
+      filterForm.endDate = dayjs(filterForm.dates[1]).format('YYYY-MM-DD')
48 48
     } else {
49
+      filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
49 50
       filterForm.endDate = null
50
-      filterForm.startDate = null
51 51
     }
52
+  } else {
53
+    filterForm.endDate = null
54
+    filterForm.startDate = null
55
+  }
56
+
57
+  Inertia.reload({
58
+    data: pickBy({
59
+      startDate: filterForm.startDate,
60
+      endDate: filterForm.endDate,
61
+      outlet: filterForm.outlet,
62
+    }),
63
+    only: ['mutations'],
64
+  })
65
+
66
+  const params = window.location.search
67
+  exportExcelLink.value = `/reports/mutations/export/excel${params}`
68
+})
52 69
 
53
-    Inertia.get(
54
-      '/reports/mutations',
55
-      pickBy({
56
-        startDate: filterForm.startDate,
57
-        endDate: filterForm.endDate,
58
-        outlet: filterForm.outlet,
59
-      }),
60
-      {
61
-        preserveState: true,
62
-      }
63
-    )
64
-
65
-    const params = window.location.search
66
-    exportExcelLink.value = `/reports/mutations/export/excel${params}`
67
-  }, 300)
68
-)
70
+const filterReset = () => {
71
+  Inertia.get('/reports/mutations')
72
+}
69 73
 
70 74
 const linkReference = (data) => {
71 75
   if (data.transactionId) {
@@ -104,7 +108,6 @@ const isAdmin = computed(() => usePage().props.value.isAdmin)
104 108
                   selection-mode="range"
105 109
                   placeholder="filter waktu..."
106 110
                   date-format="dd/mm/yy"
107
-                  :show-button-bar="true"
108 111
                   :manual-input="false"
109 112
                 />
110 113
               </div>
@@ -119,6 +122,9 @@ const isAdmin = computed(() => usePage().props.value.isAdmin)
119 122
                   :options="outlets"
120 123
                 />
121 124
               </div>
125
+              <div class="col-auto mt-2 ml-2">
126
+                <Button label="reset" class="p-button-link" @click="filterReset" />
127
+              </div>
122 128
             </div>
123 129
           </div>
124 130
           <div class="col-12 md:col-4 flex justify-content-end">

+ 33
- 32
resources/js/pages/transaction/Index.vue Voir le fichier

@@ -38,36 +38,37 @@ onMounted(() => {
38 38
   }
39 39
 })
40 40
 
41
-watch(
42
-  filterForm,
43
-  throttle(() => {
44
-    if (filterForm.dates) {
45
-      if (filterForm.dates[1]) {
46
-        filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
47
-        filterForm.endDate = dayjs(filterForm.dates[1]).format('YYYY-MM-DD')
48
-      } else {
49
-        filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
50
-        filterForm.endDate = null
51
-      }
41
+watch(filterForm, () => {
42
+  if (filterForm.dates) {
43
+    if (filterForm.dates[1]) {
44
+      filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
45
+      filterForm.endDate = dayjs(filterForm.dates[1]).format('YYYY-MM-DD')
52 46
     } else {
47
+      filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
53 48
       filterForm.endDate = null
54
-      filterForm.startDate = null
55 49
     }
50
+  } else {
51
+    filterForm.endDate = null
52
+    filterForm.startDate = null
53
+  }
54
+
55
+  Inertia.get(
56
+    '/transactions',
57
+    pickBy({
58
+      search: filterForm.search,
59
+      startDate: filterForm.startDate,
60
+      endDate: filterForm.endDate,
61
+      outlet: filterForm.outlet,
62
+    }),
63
+    {
64
+      preserveState: true,
65
+    }
66
+  )
67
+})
56 68
 
57
-    Inertia.get(
58
-      '/transactions',
59
-      pickBy({
60
-        search: filterForm.search,
61
-        startDate: filterForm.startDate,
62
-        endDate: filterForm.endDate,
63
-        outlet: filterForm.outlet,
64
-      }),
65
-      {
66
-        preserveState: true,
67
-      }
68
-    )
69
-  }, 300)
70
-)
69
+const filterReset = () => {
70
+  Inertia.get('/transactions')
71
+}
71 72
 
72 73
 const transactionId = ref()
73 74
 
@@ -163,23 +164,20 @@ const isAdmin = computed(() => usePage().props.value.isAdmin)
163 164
         <div class="grid">
164 165
           <div class="col-12 md:col-8">
165 166
             <div class="grid">
166
-              <div class="col-12 md:col-4">
167
+              <div class="col-12 md:col-3">
167 168
                 <InputText class="w-full" placeholder="cari..." v-model="filterForm.search" />
168 169
               </div>
169
-
170
-              <div class="col-12 md:col-4">
170
+              <div class="col-12 md:col-3">
171 171
                 <Calendar
172 172
                   class="w-full"
173 173
                   v-model="filterForm.dates"
174 174
                   selection-mode="range"
175 175
                   placeholder="filter waktu..."
176 176
                   date-format="dd/mm/yy"
177
-                  :show-button-bar="true"
178 177
                   :manual-input="false"
179 178
                 />
180 179
               </div>
181
-
182
-              <div class="col-12 md:col-4">
180
+              <div class="col-12 md:col-3">
183 181
                 <Dropdown
184 182
                   v-if="isAdmin"
185 183
                   class="w-full"
@@ -190,6 +188,9 @@ const isAdmin = computed(() => usePage().props.value.isAdmin)
190 188
                   :options="outlets"
191 189
                 />
192 190
               </div>
191
+              <div class="col-auto mt-2 ml-2">
192
+                <Button label="reset" class="p-button-link" @click="filterReset" />
193
+              </div>
193 194
             </div>
194 195
           </div>
195 196
           <div class="col-12 md:col-4 flex justify-content-end">

+ 38
- 32
resources/js/pages/transaction/Report.vue Voir le fichier

@@ -1,9 +1,8 @@
1 1
 <script setup>
2
-import { Inertia } from '@inertiajs/inertia'
3 2
 import { watch, computed, onMounted, ref } from 'vue'
3
+import { Inertia } from '@inertiajs/inertia'
4 4
 import { Head, useForm, usePage } from '@inertiajs/inertia-vue3'
5 5
 import dayjs from 'dayjs'
6
-import throttle from 'lodash/throttle'
7 6
 import pickBy from 'lodash/pickBy'
8 7
 import AppLayout from '@/layouts/AppLayout.vue'
9 8
 import AppPagination from '@/components/AppPagination.vue'
@@ -12,7 +11,14 @@ import AppButton from '@/components/AppButton.vue'
12 11
 import { TransactionReportTable } from './TableHeader'
13 12
 
14 13
 const props = defineProps({
15
-  transactions: Object,
14
+  transactions: {
15
+    type: Object,
16
+    default: {
17
+      data: [],
18
+      links: [],
19
+      total: 0,
20
+    },
21
+  },
16 22
   filters: Object,
17 23
   outlets: Array,
18 24
 })
@@ -34,38 +40,36 @@ onMounted(() => {
34 40
   }
35 41
 })
36 42
 
37
-watch(
38
-  filterForm,
39
-  throttle(() => {
40
-    if (filterForm.dates) {
41
-      if (filterForm.dates[1]) {
42
-        filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
43
-        filterForm.endDate = dayjs(filterForm.dates[1]).format('YYYY-MM-DD')
44
-      } else {
45
-        filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
46
-        filterForm.endDate = null
47
-      }
43
+watch(filterForm, () => {
44
+  if (filterForm.dates) {
45
+    if (filterForm.dates[1]) {
46
+      filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
47
+      filterForm.endDate = dayjs(filterForm.dates[1]).format('YYYY-MM-DD')
48 48
     } else {
49
+      filterForm.startDate = dayjs(filterForm.dates[0]).format('YYYY-MM-DD')
49 50
       filterForm.endDate = null
50
-      filterForm.startDate = null
51 51
     }
52
+  } else {
53
+    filterForm.endDate = null
54
+    filterForm.startDate = null
55
+  }
52 56
 
53
-    Inertia.get(
54
-      '/reports/transactions',
55
-      pickBy({
56
-        startDate: filterForm.startDate,
57
-        endDate: filterForm.endDate,
58
-        outlet: filterForm.outlet,
59
-      }),
60
-      {
61
-        preserveState: true,
62
-      }
63
-    )
64
-
65
-    const params = window.location.search
66
-    exportExcelLink.value = `/reports/transactions/export/excel${params}`
67
-  }, 300)
68
-)
57
+  Inertia.reload({
58
+    data: pickBy({
59
+      startDate: filterForm.startDate,
60
+      endDate: filterForm.endDate,
61
+      outlet: filterForm.outlet,
62
+    }),
63
+    only: ['transactions'],
64
+  })
65
+
66
+  const params = window.location.search
67
+  exportExcelLink.value = `/reports/transactions/export/excel${params}`
68
+})
69
+
70
+const filterReset = () => {
71
+  Inertia.get('/reports/transactions')
72
+}
69 73
 
70 74
 const exportExcelLink = ref('/reports/transactions/export/excel')
71 75
 
@@ -96,7 +100,6 @@ const isAdmin = computed(() => usePage().props.value.isAdmin)
96 100
                   selection-mode="range"
97 101
                   placeholder="filter waktu..."
98 102
                   date-format="dd/mm/yy"
99
-                  :show-button-bar="true"
100 103
                   :manual-input="false"
101 104
                 />
102 105
               </div>
@@ -111,6 +114,9 @@ const isAdmin = computed(() => usePage().props.value.isAdmin)
111 114
                   :options="outlets"
112 115
                 />
113 116
               </div>
117
+              <div class="col-auto mt-2 ml-2">
118
+                <Button label="reset" class="p-button-link" @click="filterReset" />
119
+              </div>
114 120
             </div>
115 121
           </div>
116 122
           <div class="col-12 md:col-4 flex justify-content-end">