Muhammad Iqbal Afandi 3 лет назад
Родитель
Сommit
ab6de9fe4d

+ 3
- 2
app/Http/Controllers/TestTransactionController.php Просмотреть файл

@@ -3,6 +3,7 @@
3 3
 namespace App\Http\Controllers;
4 4
 
5 5
 use App\Http\Controllers\Controller;
6
+use App\Http\Requests\TestTransaction\StoreTestTransactionRequest;
6 7
 use App\Models\EntryTransaction;
7 8
 use App\Models\OutTransaction;
8 9
 use App\Models\ParkingFee;
@@ -73,12 +74,12 @@ class TestTransactionController extends Controller
73 74
      * @param  \Illuminate\Http\Request  $request
74 75
      * @return \Illuminate\Http\Response
75 76
      */
76
-    public function store(Request $request)
77
+    public function store(StoreTestTransactionRequest $request)
77 78
     {
78 79
         if ($request->id === 2) {
79 80
             $entryTransactions = EntryTransaction::where('transaction_number', $request->entry_transaction_id)->first();
80 81
             $vehicleEntryTime = $entryTransactions->getRawOriginal('created_at');
81
-            $longParkingPerMinutes = Carbon::parse($vehicleEntryTime)->diffInRealMinutes(now());
82
+            $longParkingPerHours = Carbon::parse($vehicleEntryTime)->floatDiffInRealHours(now());
82 83
 
83 84
             $parkingFee = ParkingFee::get();
84 85
 

+ 38
- 0
app/Http/Requests/TestTransaction/StoreTestTransactionRequest.php Просмотреть файл

@@ -0,0 +1,38 @@
1
+<?php
2
+
3
+namespace App\Http\Requests\TestTransaction;
4
+
5
+use Illuminate\Foundation\Http\FormRequest;
6
+
7
+class StoreTestTransactionRequest extends FormRequest
8
+{
9
+    /**
10
+     * Determine if the user is authorized to make this request.
11
+     *
12
+     * @return bool
13
+     */
14
+    public function authorize()
15
+    {
16
+        return true;
17
+    }
18
+
19
+    /**
20
+     * Get the validation rules that apply to the request.
21
+     *
22
+     * @return array<string, mixed>
23
+     */
24
+    public function rules()
25
+    {
26
+        if ($this->id === 2) {
27
+            return [
28
+                'plat_number' => 'required',
29
+                'entry_transaction_id' => 'required',
30
+                'type_vehicle_id' => 'required',
31
+            ];
32
+        } else {
33
+            return [
34
+                //
35
+            ];
36
+        }
37
+    }
38
+}

+ 3
- 5
public/js/resources_js_pages_test-transaction_Create_vue.js Просмотреть файл

@@ -661,12 +661,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
661 661
       return props.entryTransactionData;
662 662
     }, function () {
663 663
       setLocalEntryTransaction();
664
+      form.reset();
664 665
     });
665 666
     (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function () {
666 667
       setLocalEntryTransaction();
667 668
     });
668 669
     var localEntryTransactions = (0,vue__WEBPACK_IMPORTED_MODULE_0__.reactive)([]);
669
-    var localEntryTransactionDeleted = (0,vue__WEBPACK_IMPORTED_MODULE_0__.reactive)([]);
670 670
 
671 671
     var setLocalEntryTransaction = function setLocalEntryTransaction() {
672 672
       localEntryTransactions.splice(0);
@@ -676,8 +676,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
676 676
     var copy = function copy(data) {
677 677
       form.entry_transaction_id = data.transactionNumber;
678 678
       var filterLocalEntryTransactions = props.entryTransactionData.data.filter(function (val) {
679
-        localEntryTransactionDeleted.push(data.transactionNumber);
680
-        return val.entryTransactionId !== data.transactionNumber;
679
+        return val.transactionNumber !== data.transactionNumber;
681 680
       });
682 681
       localEntryTransactions.splice(0);
683 682
       localEntryTransactions.push.apply(localEntryTransactions, _toConsumableArray(filterLocalEntryTransactions));
@@ -697,7 +696,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
697 696
     var __returned__ = {
698 697
       props: props,
699 698
       localEntryTransactions: localEntryTransactions,
700
-      localEntryTransactionDeleted: localEntryTransactionDeleted,
701 699
       setLocalEntryTransaction: setLocalEntryTransaction,
702 700
       copy: copy,
703 701
       form: form,
@@ -1522,7 +1520,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1522 1520
     }),
1523 1521
     footer: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1524 1522
       return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_3, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
1525
-        label: "Car In",
1523
+        label: "Car Entry",
1526 1524
         icon: "pi pi-check",
1527 1525
         "class": "p-button-outlined",
1528 1526
         disabled: $setup.form.processing,

+ 1
- 1
public/js/resources_js_pages_test-transaction_Entry_vue.js Просмотреть файл

@@ -209,7 +209,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
209 209
     }),
210 210
     footer: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
211 211
       return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_3, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
212
-        label: "Car In",
212
+        label: "Car Entry",
213 213
         icon: "pi pi-check",
214 214
         "class": "p-button-outlined",
215 215
         disabled: $setup.form.processing,

+ 2
- 4
public/js/resources_js_pages_test-transaction_Out_vue.js Просмотреть файл

@@ -241,12 +241,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
241 241
       return props.entryTransactionData;
242 242
     }, function () {
243 243
       setLocalEntryTransaction();
244
+      form.reset();
244 245
     });
245 246
     (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function () {
246 247
       setLocalEntryTransaction();
247 248
     });
248 249
     var localEntryTransactions = (0,vue__WEBPACK_IMPORTED_MODULE_0__.reactive)([]);
249
-    var localEntryTransactionDeleted = (0,vue__WEBPACK_IMPORTED_MODULE_0__.reactive)([]);
250 250
 
251 251
     var setLocalEntryTransaction = function setLocalEntryTransaction() {
252 252
       localEntryTransactions.splice(0);
@@ -256,8 +256,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
256 256
     var copy = function copy(data) {
257 257
       form.entry_transaction_id = data.transactionNumber;
258 258
       var filterLocalEntryTransactions = props.entryTransactionData.data.filter(function (val) {
259
-        localEntryTransactionDeleted.push(data.transactionNumber);
260
-        return val.entryTransactionId !== data.transactionNumber;
259
+        return val.transactionNumber !== data.transactionNumber;
261 260
       });
262 261
       localEntryTransactions.splice(0);
263 262
       localEntryTransactions.push.apply(localEntryTransactions, _toConsumableArray(filterLocalEntryTransactions));
@@ -277,7 +276,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
277 276
     var __returned__ = {
278 277
       props: props,
279 278
       localEntryTransactions: localEntryTransactions,
280
-      localEntryTransactionDeleted: localEntryTransactionDeleted,
281 279
       setLocalEntryTransaction: setLocalEntryTransaction,
282 280
       copy: copy,
283 281
       form: form,

+ 1
- 1
resources/js/pages/test-transaction/Entry.vue Просмотреть файл

@@ -36,7 +36,7 @@ const submit = () => {
36 36
     <template #footer>
37 37
       <div class="flex flex-column md:flex-row justify-content-end">
38 38
         <Button
39
-          label="Car In"
39
+          label="Car Entry"
40 40
           icon="pi pi-check"
41 41
           class="p-button-outlined"
42 42
           :disabled="form.processing"

+ 5
- 7
resources/js/pages/test-transaction/Out.vue Просмотреть файл

@@ -19,6 +19,8 @@ watch(
19 19
   () => props.entryTransactionData,
20 20
   () => {
21 21
     setLocalEntryTransaction()
22
+
23
+    form.reset()
22 24
   }
23 25
 )
24 26
 
@@ -28,8 +30,6 @@ onMounted(() => {
28 30
 
29 31
 const localEntryTransactions = reactive([])
30 32
 
31
-const localEntryTransactionDeleted = reactive([])
32
-
33 33
 const setLocalEntryTransaction = () => {
34 34
   localEntryTransactions.splice(0)
35 35
   localEntryTransactions.push(...props.entryTransactionData.data)
@@ -38,11 +38,9 @@ const setLocalEntryTransaction = () => {
38 38
 const copy = (data) => {
39 39
   form.entry_transaction_id = data.transactionNumber
40 40
 
41
-  const filterLocalEntryTransactions = props.entryTransactionData.data.filter((val) => {
42
-    localEntryTransactionDeleted.push(data.transactionNumber)
43
-
44
-    return val.entryTransactionId !== data.transactionNumber
45
-  })
41
+  const filterLocalEntryTransactions = props.entryTransactionData.data.filter(
42
+    (val) => val.transactionNumber !== data.transactionNumber
43
+  )
46 44
 
47 45
   localEntryTransactions.splice(0)
48 46
   localEntryTransactions.push(...filterLocalEntryTransactions)