diff --git a/app/Http/Controllers/API/v1/Voter/AttendanceController.php b/app/Http/Controllers/API/v1/Voter/AttendanceController.php new file mode 100644 index 0000000..c36b913 --- /dev/null +++ b/app/Http/Controllers/API/v1/Voter/AttendanceController.php @@ -0,0 +1,60 @@ +validateRequest($request, $id); + $this->updateAttendance($request, $id); + return response()->json([ + 'status' => 'success', + 'message' => 'Kehadiran anda telah disahkan.' + ]); + } + + private function validateRequest($request, $id) + { + $this->validate($request, [ + 'name' => [ + 'required', + Rule::unique('voter')->ignore($id)->where(function($query){ + $query->where('election_id', Util::getCurrentElection()); + }) + ], + 'no_kp' => [ + 'required', + Rule::unique('voter')->ignore($id)->where(function($query){ + $query->where('election_id', Util::getCurrentElection()); + }) + ], + + 'unit' => 'required', + + 'no_anggota' => [ + 'required', + Rule::unique('voter')->ignore($id)->where(function($query){ + $query->where('election_id', Util::getCurrentElection()); + }) + ], + + 'kehadiran' => 'required' + + ]); + } + + private function updateAttendance($request, $id) + { + $voter = $request->all(); + Voter::find($id)->update($voter); + } + +} diff --git a/config/onewaysms.php b/config/onewaysms.php index 58d7008..5678388 100644 --- a/config/onewaysms.php +++ b/config/onewaysms.php @@ -1,7 +1,7 @@ 'KoPKB : %s is your TAC to log in to your myKoPKB Member account. It will expire in 5 minutes.', + 'message' => 'KoPKB : %s is your TAC to log in to your myKoPKB Member account. It will expire in 3 minutes.', 'minutes' => 3 ]; diff --git a/database/migrations/2024_04_15_120701_add_kehadiran_to_voter_table.php b/database/migrations/2024_04_15_120701_add_kehadiran_to_voter_table.php new file mode 100644 index 0000000..a25c4e8 --- /dev/null +++ b/database/migrations/2024_04_15_120701_add_kehadiran_to_voter_table.php @@ -0,0 +1,35 @@ +integer('kehadiran'); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('voter', function (Blueprint $table) { + // + $table->dropColumn('kehadiran'); + }); + } +} diff --git a/resources/assets/js/components/demo/admin/index.vue b/resources/assets/js/components/demo/admin/index.vue index c062dbd..0705ea2 100644 --- a/resources/assets/js/components/demo/admin/index.vue +++ b/resources/assets/js/components/demo/admin/index.vue @@ -21,9 +21,9 @@ Jawatan - + Anggota Koperasi @@ -33,6 +33,10 @@ Calon + + Kehadiran + +