DONE: fix error on pagination where it cannot redirect to next pages, add onboarding_completed_at for new registered user, move dashboard page design into modules folder
This commit is contained in:
@@ -56,6 +56,7 @@ class User extends Authenticatable
|
||||
'join_date',
|
||||
'birth_date',
|
||||
'birth_place',
|
||||
'onboarding_completed_at',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -137,6 +138,7 @@ class User extends Authenticatable
|
||||
'join_date' => 'date',
|
||||
'birth_date' => 'date',
|
||||
'birth_place' => 'string',
|
||||
'onboarding_completed_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ class UserResource extends JsonResource
|
||||
'join_date' => $this->join_date,
|
||||
'birth_date' => $this->birth_date,
|
||||
'birth_place' => $this->birth_place,
|
||||
'onboarding_completed_at' => $this->onboarding_completed_at,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
'deleted_at' => $this->deleted_at,
|
||||
|
||||
+8
-5
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\MembershipApplication\Emails;
|
||||
|
||||
use App\Notifications\Concerns\BuildsMailMessage;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
@@ -9,6 +10,7 @@ use Modules\MembershipApplication\Entities\MembershipApplication;
|
||||
|
||||
class MembershipApplicationSubmittedNotification extends Notification
|
||||
{
|
||||
use BuildsMailMessage;
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
@@ -24,9 +26,10 @@ class MembershipApplicationSubmittedNotification extends Notification
|
||||
{
|
||||
$this->application->loadMissing(['applicant', 'heirs', 'documents', 'references.member']);
|
||||
|
||||
return (new MailMessage)
|
||||
->subject('Pengesahan Permohonan Keahlian')
|
||||
->markdown('membershipapplication::emails.submitted', [
|
||||
return $this->mailMessage(
|
||||
subject: 'Pengesahan Permohonan Keahlian',
|
||||
view: 'membershipapplication::emails.submitted',
|
||||
data: [
|
||||
'application' => $this->application,
|
||||
'applicant' => $this->application->applicant,
|
||||
'heirs' => $this->application->heirs,
|
||||
@@ -37,7 +40,7 @@ class MembershipApplicationSubmittedNotification extends Notification
|
||||
'salary_slip' => 'Slip Gaji',
|
||||
'employer_letter' => 'Surat Pengesahan Majikan',
|
||||
],
|
||||
'logoPath' => public_path('images/logo-kopkb.svg'),
|
||||
]);
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
@component('mail::message')
|
||||
@if (! empty($logoPath) && file_exists($logoPath))
|
||||
<div style="text-align: center; margin-bottom: 24px;">
|
||||
<img src="{{ $message->embed($logoPath) }}" alt="{{ config('app.name') }}" style="max-height: 80px; width: auto;">
|
||||
</div>
|
||||
@endif
|
||||
@include('emails.partials.header')
|
||||
|
||||
# Pengesahan Permohonan Keahlian
|
||||
|
||||
@@ -74,6 +70,5 @@ Tiada dokumen.
|
||||
|
||||
Anda akan menerima emel apabila keputusan permohonan tersedia.
|
||||
|
||||
Terima kasih,<br>
|
||||
{{ config('app.name') }}
|
||||
@include('emails.partials.footer')
|
||||
@endcomponent
|
||||
|
||||
@@ -415,13 +415,13 @@ class MembershipApplicationService
|
||||
): array {
|
||||
$applicant = $application->applicant;
|
||||
$isPassed = $application->board_result === BoardResult::Pass->value;
|
||||
// $monthlyShareInstallment = number_format(
|
||||
// MembershipApplication::MINIMUM_SHARE_CAPITAL / MembershipApplication::SHARE_INSTALLMENT_MONTHS,
|
||||
// 2,
|
||||
// '.',
|
||||
// '',
|
||||
// );
|
||||
$monthlyShareInstallment = 84;
|
||||
$stockMonthlyContribution = (float) $applicant->stock_monthly_contribution;
|
||||
$monthlyShareInstallment = number_format(
|
||||
$stockMonthlyContribution < 84 ? 84 : $stockMonthlyContribution,
|
||||
2,
|
||||
'.',
|
||||
'',
|
||||
);
|
||||
|
||||
return [
|
||||
'application' => $application,
|
||||
@@ -434,7 +434,7 @@ class MembershipApplicationService
|
||||
? 'KELULUSAN KEANGGOTAAN KOPERASI PERMODALAN KELANTAN BERHAD'
|
||||
: 'KEPUTUSAN PERMOHONAN KEANGGOTAAN KOPERASI PERMODALAN KELANTAN BERHAD',
|
||||
'monthlyShareInstallment' => $monthlyShareInstallment,
|
||||
'stockMonthlyContribution' => number_format((float) $applicant->stock_monthly_contribution, 2, '.', ''),
|
||||
'stockMonthlyContribution' => number_format($stockMonthlyContribution, 2, '.', ''),
|
||||
'feeMonthlyContribution' => number_format((float) $applicant->fee_monthly_contribution, 2, '.', ''),
|
||||
'shareInstallmentMonths' => MembershipApplication::SHARE_INSTALLMENT_MONTHS,
|
||||
'minimumShareCapital' => number_format(MembershipApplication::MINIMUM_SHARE_CAPITAL, 2, '.', ''),
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->timestamp('onboarding_completed_at')->nullable()->after('birth_place');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('onboarding_completed_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -127,6 +127,17 @@ class UserController extends BaseCrudController
|
||||
]);
|
||||
}
|
||||
|
||||
public function completeOnboarding(Request $request): JsonResponse
|
||||
{
|
||||
$user = $this->userService->completeOnboarding($request->user());
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => new UserResource($user),
|
||||
'message' => 'Onboarding completed.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function updatePassword(Request $request): JsonResponse
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
@@ -35,6 +35,7 @@ Route::middleware(['auth:sanctum', 'single.session'])->prefix('v1')->group(funct
|
||||
|
||||
// User profile management routes
|
||||
Route::post('/profile', [UserController::class, 'updateProfile']);
|
||||
Route::post('/profile/onboarding/complete', [UserController::class, 'completeOnboarding']);
|
||||
Route::put('/profile/password', [UserController::class, 'updatePassword']);
|
||||
Route::get('/profile/digital-card', [MemberDigitalCardController::class, 'download'])
|
||||
->name('profile.digital-card.download');
|
||||
|
||||
@@ -121,6 +121,17 @@ class UserService
|
||||
/**
|
||||
* @return array{}|array{error: string}
|
||||
*/
|
||||
public function completeOnboarding(User $user): User
|
||||
{
|
||||
if ($user->onboarding_completed_at === null) {
|
||||
$user->update(['onboarding_completed_at' => now()]);
|
||||
}
|
||||
|
||||
$user->load(['roles.permissions']);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function updatePassword(User $user, string $currentPassword, string $newPassword): array
|
||||
{
|
||||
if (! Hash::check($currentPassword, $user->password)) {
|
||||
|
||||
Reference in New Issue
Block a user