Procházet zdrojové kódy

fix: master and authorization

Muhammad Iqbal Afandi před 3 roky
rodič
revize
d6f4f51934

+ 2
- 2
app/Http/Controllers/MutationController.php Zobrazit soubor

35
                             'createdAt' => $mutation->created_at,
35
                             'createdAt' => $mutation->created_at,
36
                             'amount' => $mutation->amount,
36
                             'amount' => $mutation->amount,
37
                             'type' => $mutation->type,
37
                             'type' => $mutation->type,
38
-                            'transactionOutId' => $mutation->transaction_out,
38
+                            'outTransactionId' => $mutation->out_transaction_id,
39
                             'expenseId' => $mutation->expense_id,
39
                             'expenseId' => $mutation->expense_id,
40
-                            'topupId' => $mutation->top_up_id,
40
+                            'topUpId' => $mutation->top_up_id,
41
                         ]),
41
                         ]),
42
                 ]
42
                 ]
43
             ),
43
             ),

+ 1
- 1
app/Http/Controllers/ParkingFeeController.php Zobrazit soubor

49
         foreach ($request->id as $key => $id) {
49
         foreach ($request->id as $key => $id) {
50
             ParkingFee::upsert([
50
             ParkingFee::upsert([
51
                 'id' => $id,
51
                 'id' => $id,
52
-                'time_period' => $request->timePeriod[$key],
52
+                'time_period' => $request->time_period[$key],
53
                 'price' => $request->price[$key],
53
                 'price' => $request->price[$key],
54
             ], ['id']);
54
             ], ['id']);
55
         }
55
         }

+ 30
- 0
app/Models/EntryTransaction.php Zobrazit soubor

1
+<?php
2
+
3
+namespace App\Models;
4
+
5
+use Carbon\Carbon;
6
+use Illuminate\Database\Eloquent\Casts\Attribute;
7
+use Illuminate\Database\Eloquent\Factories\HasFactory;
8
+use Illuminate\Database\Eloquent\Model;
9
+
10
+class EntryTransaction extends Model
11
+{
12
+    use HasFactory;
13
+
14
+    protected $fillable = [
15
+        'capture_vehicle',
16
+        'transaction_number',
17
+    ];
18
+
19
+    protected function createdAt(): Attribute
20
+    {
21
+        return Attribute::make(
22
+            get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
23
+        );
24
+    }
25
+
26
+    public function outTransaction()
27
+    {
28
+        return $this->hasOne(OutTransaction::class, 'entry_transaction_id', 'transaction_number');
29
+    }
30
+}

+ 2
- 2
app/Models/Mutation.php Zobrazit soubor

15
     protected $fillable = [
15
     protected $fillable = [
16
         'type',
16
         'type',
17
         'amount',
17
         'amount',
18
-        'transaction_out_id',
18
+        'out_transaction_id',
19
         'expense_id',
19
         'expense_id',
20
-        'topup_id',
20
+        'top_up_id',
21
     ];
21
     ];
22
 
22
 
23
     protected function createdAt(): Attribute
23
     protected function createdAt(): Attribute

+ 28
- 0
app/Models/OutTransaction.php Zobrazit soubor

1
+<?php
2
+
3
+namespace App\Models;
4
+
5
+use Carbon\Carbon;
6
+use Illuminate\Database\Eloquent\Casts\Attribute;
7
+use Illuminate\Database\Eloquent\Factories\HasFactory;
8
+use Illuminate\Database\Eloquent\Model;
9
+
10
+class OutTransaction extends Model
11
+{
12
+    use HasFactory;
13
+
14
+    protected $fillable = [
15
+        'plat_number',
16
+        'price',
17
+        'entry_transaction_id',
18
+        'type_vehicle_id',
19
+        'user_id',
20
+    ];
21
+
22
+    protected function createdAt(): Attribute
23
+    {
24
+        return Attribute::make(
25
+            get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
26
+        );
27
+    }
28
+}

+ 0
- 16
app/Models/TransactionIn.php Zobrazit soubor

1
-<?php
2
-
3
-namespace App\Models;
4
-
5
-use Illuminate\Database\Eloquent\Factories\HasFactory;
6
-use Illuminate\Database\Eloquent\Model;
7
-
8
-class TransactionIn extends Model
9
-{
10
-    use HasFactory;
11
-
12
-    protected $fillable = [
13
-        'capture_vehicle',
14
-        'transaction_number',
15
-    ];
16
-}

+ 0
- 20
app/Models/TransactionOut.php Zobrazit soubor

1
-<?php
2
-
3
-namespace App\Models;
4
-
5
-use Illuminate\Database\Eloquent\Factories\HasFactory;
6
-use Illuminate\Database\Eloquent\Model;
7
-
8
-class TransactionOut extends Model
9
-{
10
-    use HasFactory;
11
-
12
-    protected $fillable = [
13
-        'plat_number',
14
-        'price',
15
-        'transaction_in_id',
16
-        'parking_fee_id',
17
-        'type_vehicle_id',
18
-        'user_id',
19
-    ];
20
-}

+ 5
- 2
app/Models/TypeVehicle.php Zobrazit soubor

2
 
2
 
3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
+use App\Models\MaxVehicle;
6
+use App\Models\OutTransaction;
7
+use App\Models\Vehicle;
5
 use Carbon\Carbon;
8
 use Carbon\Carbon;
6
 use Illuminate\Database\Eloquent\Casts\Attribute;
9
 use Illuminate\Database\Eloquent\Casts\Attribute;
7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
10
 use Illuminate\Database\Eloquent\Factories\HasFactory;
39
         return $this->hasMany(MaxVehicle::class);
42
         return $this->hasMany(MaxVehicle::class);
40
     }
43
     }
41
 
44
 
42
-    public function parkingFee()
45
+    public function outTransaction()
43
     {
46
     {
44
-        return $this->hasOne(ParkingFee::class);
47
+        return $this->hasOne(OutTransaction::class);
45
     }
48
     }
46
 }
49
 }

+ 2
- 1
app/Providers/AuthServiceProvider.php Zobrazit soubor

16
 use App\Policies\ParkingFeePolicy;
16
 use App\Policies\ParkingFeePolicy;
17
 use App\Policies\TopUpPolicy;
17
 use App\Policies\TopUpPolicy;
18
 use App\Policies\TypeMemberPolicy;
18
 use App\Policies\TypeMemberPolicy;
19
+use App\Policies\TypeVehiclePolicy;
19
 use App\Policies\UserPolicy;
20
 use App\Policies\UserPolicy;
20
 use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
21
 use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
21
 
22
 
35
         ParkingFee::class => ParkingFeePolicy::class,
36
         ParkingFee::class => ParkingFeePolicy::class,
36
         TopUp::class => TopUpPolicy::class,
37
         TopUp::class => TopUpPolicy::class,
37
         TypeMember::class => TypeMemberPolicy::class,
38
         TypeMember::class => TypeMemberPolicy::class,
38
-        TypeVehicle::class => TypeVehicle::class,
39
+        TypeVehicle::class => TypeVehiclePolicy::class,
39
     ];
40
     ];
40
 
41
 
41
     /**
42
     /**

+ 1
- 1
app/Services/TypeVehicleService.php Zobrazit soubor

8
 {
8
 {
9
     public function isUsed(TypeVehicle $typeVehicle)
9
     public function isUsed(TypeVehicle $typeVehicle)
10
     {
10
     {
11
-        return $typeVehicle->vehicles()->exists() || $typeVehicle->maxVehicles()->exists() || $typeVehicle->parkingFee()->exists();
11
+        return $typeVehicle->vehicles()->exists() || $typeVehicle->maxVehicles()->exists() || $typeVehicle->outTransaction()->exists();
12
     }
12
     }
13
 }
13
 }

database/migrations/2022_04_23_122416_create_transaction_ins_table.php → database/migrations/2022_04_23_122416_create_entry_transactions_table.php Zobrazit soubor

13
      */
13
      */
14
     public function up()
14
     public function up()
15
     {
15
     {
16
-        Schema::create('transaction_ins', function (Blueprint $table) {
16
+        Schema::create('entry_transactions', function (Blueprint $table) {
17
             $table->id();
17
             $table->id();
18
-            $table->string('capture_vehicle');
19
             $table->string('transaction_number');
18
             $table->string('transaction_number');
19
+            $table->string('capture_vehicle')->nullable()->default(null);
20
             $table->timestamps();
20
             $table->timestamps();
21
         });
21
         });
22
     }
22
     }
28
      */
28
      */
29
     public function down()
29
     public function down()
30
     {
30
     {
31
-        Schema::dropIfExists('transaction_ins');
31
+        Schema::dropIfExists('entry_transactions');
32
     }
32
     }
33
 };
33
 };

database/migrations/2022_04_23_122428_create_transaction_outs_table.php → database/migrations/2022_04_23_122428_create_out_transactions_table.php Zobrazit soubor

13
      */
13
      */
14
     public function up()
14
     public function up()
15
     {
15
     {
16
-        Schema::create('transaction_outs', function (Blueprint $table) {
16
+        Schema::create('out_transactions', function (Blueprint $table) {
17
             $table->id();
17
             $table->id();
18
             $table->string('plat_number');
18
             $table->string('plat_number');
19
             $table->unsignedInteger('price');
19
             $table->unsignedInteger('price');
20
-            $table->foreignId('transaction_in_id')->constrained();
20
+            $table->foreignId('entry_transaction_id')->constrained();
21
             $table->foreignId('type_vehicle_id')->constrained();
21
             $table->foreignId('type_vehicle_id')->constrained();
22
-            $table->foreignId('parking_fee_id')->constrained();
23
             $table->foreignId('user_id')->constrained();
22
             $table->foreignId('user_id')->constrained();
24
             $table->timestamps();
23
             $table->timestamps();
25
         });
24
         });
32
      */
31
      */
33
     public function down()
32
     public function down()
34
     {
33
     {
35
-        Schema::dropIfExists('transaction_outs');
34
+        Schema::dropIfExists('out_transactions');
36
     }
35
     }
37
 };
36
 };

+ 1
- 1
database/migrations/2022_04_23_130215_create_vehicles_table.php Zobrazit soubor

17
             $table->id();
17
             $table->id();
18
             $table->string('plat_number');
18
             $table->string('plat_number');
19
             $table->foreignId('member_id')->constrained();
19
             $table->foreignId('member_id')->constrained();
20
-            $table->foreignId('transaction_out_id')->nullable()->default(null)->constrained();
20
+            $table->foreignId('out_transaction_id')->nullable()->default(null)->constrained();
21
             $table->foreignId('type_vehicle_id')->nullable()->default(null)->constrained();
21
             $table->foreignId('type_vehicle_id')->nullable()->default(null)->constrained();
22
             $table->timestamps();
22
             $table->timestamps();
23
         });
23
         });

+ 1
- 1
database/migrations/2022_04_23_130216_create_mutations_table.php Zobrazit soubor

17
             $table->id();
17
             $table->id();
18
             $table->enum('type', [1, 2]); // 1(income) 2(expense)
18
             $table->enum('type', [1, 2]); // 1(income) 2(expense)
19
             $table->unsignedInteger('amount');
19
             $table->unsignedInteger('amount');
20
-            $table->foreignId('transaction_out_id')->nullable()->default(null)->constrained();
20
+            $table->foreignId('out_transaction_id')->nullable()->default(null)->constrained();
21
             $table->foreignId('expense_id')->nullable()->default(null)->constrained();
21
             $table->foreignId('expense_id')->nullable()->default(null)->constrained();
22
             $table->foreignId('top_up_id')->nullable()->default(null)->constrained();
22
             $table->foreignId('top_up_id')->nullable()->default(null)->constrained();
23
             $table->timestamps();
23
             $table->timestamps();

+ 13
- 14
designs/diagrams/database.puml Zobrazit soubor

1
 @startuml Database
1
 @startuml Database
2
 
2
 
3
-entity TransactionIn {
3
+entity EntryTransaction {
4
   * id
4
   * id
5
   __
5
   __
6
-  * capture_vehicle
7
   * transaction_number
6
   * transaction_number
7
+  capture_vehicle
8
 }
8
 }
9
 
9
 
10
-entity TransactionOut {
10
+entity OutTransaction {
11
   * id
11
   * id
12
   __
12
   __
13
   * plat_number
13
   * plat_number
14
   price
14
   price
15
-  * transaction_in_id
16
-  * parking_fee_id
15
+  * entry_transaction_id
17
   * type_vehicle_id
16
   * type_vehicle_id
18
   * user_id
17
   * user_id
19
 }
18
 }
62
   __
61
   __
63
   * plat_number
62
   * plat_number
64
   * member_id
63
   * member_id
65
-  * transaction_out_id
64
+  * out_transaction_id
66
   * type_vehicle_id
65
   * type_vehicle_id
67
 }
66
 }
68
 
67
 
104
   __
103
   __
105
   * type
104
   * type
106
   * amount
105
   * amount
107
-  transaction_out_id
106
+  out_transaction_id
108
   expense_id
107
   expense_id
109
-  topup_id
108
+  top_up_id
110
 }
109
 }
111
 
110
 
112
-TransactionIn ||--|| TransactionOut
113
-TransactionOut ||--|| Mutation
114
-TransactionOut ||--|{ Vehicle
115
-TransactionOut ||--|{ ParkingFee
116
-TransactionOut ||--|{ User
117
-TransactionOut ||--|{ TypeVehicle
111
+EntryTransaction ||--|| OutTransaction
112
+OutTransaction ||--|| Mutation
113
+OutTransaction ||--|{ Vehicle
114
+OutTransaction ||--|{ ParkingFee
115
+OutTransaction ||--|{ User
116
+OutTransaction ||--|{ TypeVehicle
118
 TypeVehicle }|--|| Vehicle
117
 TypeVehicle }|--|| Vehicle
119
 TypeVehicle }|--|| MaxVehicle
118
 TypeVehicle }|--|| MaxVehicle
120
 User ||--|{ Role
119
 User ||--|{ Role

binární
designs/diagrams/database/Database.png Zobrazit soubor


+ 2
- 2
public/js/resources_js_pages_mutation_Report_vue.js Zobrazit soubor

502
 
502
 
503
     var linkReference = function linkReference(data) {
503
     var linkReference = function linkReference(data) {
504
       if (data.topupId) {
504
       if (data.topupId) {
505
-        return route('top-ups.show', data.topupId);
505
+        return route('top-ups.show', data.topUpId);
506
       } else if (data.expenseId) {
506
       } else if (data.expenseId) {
507
         return route('expenses.show', data.expenseId);
507
         return route('expenses.show', data.expenseId);
508
       } else {
508
       } else {
509
-        console.info('under construction'); // return route('expenses.show', data.expenseId)
509
+        console.info('under construction'); //  return route('out-transactions.show', data.outTransactionId)
510
       }
510
       }
511
     };
511
     };
512
 
512
 

+ 1
- 1
public/js/resources_js_pages_parkingfee_Create_vue.js Zobrazit soubor

525
       form.transform(function (data) {
525
       form.transform(function (data) {
526
         return {
526
         return {
527
           id: [data.id1, data.id2, data.id3, data.id4, data.idNext],
527
           id: [data.id1, data.id2, data.id3, data.id4, data.idNext],
528
-          timePeriod: [data.timePeriod1, data.timePeriod2, data.timePeriod3, data.timePeriod4, data.timePeriodNext],
528
+          time_period: [data.timePeriod1, data.timePeriod2, data.timePeriod3, data.timePeriod4, data.timePeriodNext],
529
           price: [data.price1, data.price2, data.price3, data.price4, data.priceNext]
529
           price: [data.price1, data.price2, data.price3, data.price4, data.priceNext]
530
         };
530
         };
531
       }).post(route('parking-fees.store'), {
531
       }).post(route('parking-fees.store'), {

+ 1
- 1
public/js/vue.js Zobrazit soubor

58396
 /******/ 		// This function allow to reference async chunks
58396
 /******/ 		// This function allow to reference async chunks
58397
 /******/ 		__webpack_require__.u = (chunkId) => {
58397
 /******/ 		__webpack_require__.u = (chunkId) => {
58398
 /******/ 			// return url for filenames based on template
58398
 /******/ 			// return url for filenames based on template
58399
-/******/ 			return "js/" + chunkId + ".js?id=" + {"node_modules_chart_js_auto_auto_esm_js":"10c6b388645ceb22","resources_js_pages_auth_ForgotPassword_vue":"5b9f0529bda25a9b","resources_js_pages_auth_Login_vue":"61b9c9ae1ae9da32","resources_js_pages_auth_ResetPassword_vue":"b091193a1e114ce8","resources_js_pages_auth_VerifyEmail_vue":"d9853eae0a0235f2","resources_js_pages_expense_Create_vue":"24ce2fe5d7bc72c8","resources_js_pages_expense_Index_vue":"798dbf6d69320567","resources_js_pages_expense_Show_vue":"d5681c75fde77308","resources_js_pages_expense_TableHeader_js":"eed3f0613f167cfd","resources_js_pages_home_Index_vue":"b922dc090509ea08","resources_js_pages_member_Create_vue":"fc1cd382141d2c70","resources_js_pages_member_Edit_vue":"33eee7f2667de50d","resources_js_pages_member_Index_vue":"cf14eae2779192d8","resources_js_pages_member_TableHeader_js":"51dbf053f7ddd45c","resources_js_pages_mutation_Report_vue":"6569326149c7e8b3","resources_js_pages_mutation_TableHeader_js":"7822e888aa3c52fc","resources_js_pages_parkingfee_Create_vue":"2d28f6b526f6f602","resources_js_pages_topup_Create_vue":"d4b2fe633c0691f2","resources_js_pages_topup_Index_vue":"b2565eb99363b9ba","resources_js_pages_topup_Show_vue":"cd5e15ada76e9fbe","resources_js_pages_topup_TableHeader_js":"601b7c0a855ce64e","resources_js_pages_typemember_Create_vue":"06b9f61209ca7651","resources_js_pages_typemember_Edit_vue":"4d8a32f046a9a08b","resources_js_pages_typemember_Index_vue":"73b3a8ec31100c62","resources_js_pages_typemember_TableHeader_js":"ac1d31a59f8d464e","resources_js_pages_typevehicle_Create_vue":"75389ee20755d74a","resources_js_pages_typevehicle_Edit_vue":"09a18fe1169d4335","resources_js_pages_typevehicle_Index_vue":"d15b150b4fdee4ad","resources_js_pages_typevehicle_TableHeader_js":"a40378918fbe74e1","resources_js_pages_user_Create_vue":"9b13f9080e20bf2d","resources_js_pages_user_Edit_vue":"4edf8db4d7073eac","resources_js_pages_user_Index_vue":"9c791e4ceac6a483","resources_js_pages_user_Show_vue":"2431556dd033ddb2","resources_js_pages_user_TableHeader_js":"0d87fd422fe40491"}[chunkId] + "";
58399
+/******/ 			return "js/" + chunkId + ".js?id=" + {"node_modules_chart_js_auto_auto_esm_js":"10c6b388645ceb22","resources_js_pages_auth_ForgotPassword_vue":"5b9f0529bda25a9b","resources_js_pages_auth_Login_vue":"61b9c9ae1ae9da32","resources_js_pages_auth_ResetPassword_vue":"b091193a1e114ce8","resources_js_pages_auth_VerifyEmail_vue":"d9853eae0a0235f2","resources_js_pages_expense_Create_vue":"24ce2fe5d7bc72c8","resources_js_pages_expense_Index_vue":"798dbf6d69320567","resources_js_pages_expense_Show_vue":"d5681c75fde77308","resources_js_pages_expense_TableHeader_js":"eed3f0613f167cfd","resources_js_pages_home_Index_vue":"b922dc090509ea08","resources_js_pages_member_Create_vue":"fc1cd382141d2c70","resources_js_pages_member_Edit_vue":"33eee7f2667de50d","resources_js_pages_member_Index_vue":"cf14eae2779192d8","resources_js_pages_member_TableHeader_js":"51dbf053f7ddd45c","resources_js_pages_mutation_Report_vue":"0c0abe807726ddb5","resources_js_pages_mutation_TableHeader_js":"7822e888aa3c52fc","resources_js_pages_parkingfee_Create_vue":"4d1d60defdf2c684","resources_js_pages_topup_Create_vue":"d4b2fe633c0691f2","resources_js_pages_topup_Index_vue":"b2565eb99363b9ba","resources_js_pages_topup_Show_vue":"cd5e15ada76e9fbe","resources_js_pages_topup_TableHeader_js":"601b7c0a855ce64e","resources_js_pages_typemember_Create_vue":"06b9f61209ca7651","resources_js_pages_typemember_Edit_vue":"4d8a32f046a9a08b","resources_js_pages_typemember_Index_vue":"73b3a8ec31100c62","resources_js_pages_typemember_TableHeader_js":"ac1d31a59f8d464e","resources_js_pages_typevehicle_Create_vue":"75389ee20755d74a","resources_js_pages_typevehicle_Edit_vue":"09a18fe1169d4335","resources_js_pages_typevehicle_Index_vue":"d15b150b4fdee4ad","resources_js_pages_typevehicle_TableHeader_js":"a40378918fbe74e1","resources_js_pages_user_Create_vue":"9b13f9080e20bf2d","resources_js_pages_user_Edit_vue":"4edf8db4d7073eac","resources_js_pages_user_Index_vue":"9c791e4ceac6a483","resources_js_pages_user_Show_vue":"2431556dd033ddb2","resources_js_pages_user_TableHeader_js":"0d87fd422fe40491"}[chunkId] + "";
58400
 /******/ 		};
58400
 /******/ 		};
58401
 /******/ 	})();
58401
 /******/ 	})();
58402
 /******/ 	
58402
 /******/ 	

+ 2
- 2
resources/js/pages/mutation/Report.vue Zobrazit soubor

72
 
72
 
73
 const linkReference = (data) => {
73
 const linkReference = (data) => {
74
   if (data.topupId) {
74
   if (data.topupId) {
75
-    return route('top-ups.show', data.topupId)
75
+    return route('top-ups.show', data.topUpId)
76
   } else if (data.expenseId) {
76
   } else if (data.expenseId) {
77
     return route('expenses.show', data.expenseId)
77
     return route('expenses.show', data.expenseId)
78
   } else {
78
   } else {
79
     console.info('under construction')
79
     console.info('under construction')
80
-    // return route('expenses.show', data.expenseId)
80
+    //  return route('out-transactions.show', data.outTransactionId)
81
   }
81
   }
82
 }
82
 }
83
 
83
 

+ 1
- 1
resources/js/pages/parkingfee/Create.vue Zobrazit soubor

42
   form
42
   form
43
     .transform((data) => ({
43
     .transform((data) => ({
44
       id: [data.id1, data.id2, data.id3, data.id4, data.idNext],
44
       id: [data.id1, data.id2, data.id3, data.id4, data.idNext],
45
-      timePeriod: [data.timePeriod1, data.timePeriod2, data.timePeriod3, data.timePeriod4, data.timePeriodNext],
45
+      time_period: [data.timePeriod1, data.timePeriod2, data.timePeriod3, data.timePeriod4, data.timePeriodNext],
46
       price: [data.price1, data.price2, data.price3, data.price4, data.priceNext],
46
       price: [data.price1, data.price2, data.price3, data.price4, data.priceNext],
47
     }))
47
     }))
48
     .post(route('parking-fees.store'), { onSuccess: () => (disabled.value = true) })
48
     .post(route('parking-fees.store'), { onSuccess: () => (disabled.value = true) })

+ 1
- 1
webpack.mix.js Zobrazit soubor

15
   .js('resources/js/vue.js', 'public/js')
15
   .js('resources/js/vue.js', 'public/js')
16
   .webpackConfig(require('./webpack.config'))
16
   .webpackConfig(require('./webpack.config'))
17
   .vue()
17
   .vue()
18
-  .browserSync('http://parkirin.test/')
18
+  .browserSync('http://127.0.0.1:8000')
19
   .disableNotifications()
19
   .disableNotifications()
20
 
20
 
21
 if (mix.inProduction()) {
21
 if (mix.inProduction()) {