DONE: layout letter with letterhead and footer, notification for newly...
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MembershipApplication\Entities;
|
||||
|
||||
use App\Traits\HasDocuments;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Modules\Auth\Entities\User;
|
||||
use Modules\MembershipApplication\Enums\ApplicationStatus;
|
||||
|
||||
class MembershipApplication extends Model
|
||||
{
|
||||
use HasDocuments, HasUuids;
|
||||
|
||||
protected $table = 'membership_applications';
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'application_number',
|
||||
'user_id',
|
||||
'status',
|
||||
'board_result',
|
||||
'submitted_at',
|
||||
'completed_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => ApplicationStatus::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function applicant(): HasOne
|
||||
{
|
||||
return $this->hasOne(MembershipApplicationApplicant::class);
|
||||
}
|
||||
|
||||
public function heirs(): HasMany
|
||||
{
|
||||
return $this->hasMany(MembershipApplicationHeir::class);
|
||||
}
|
||||
|
||||
public function references(): HasMany
|
||||
{
|
||||
return $this->hasMany(MembershipApplicationReference::class);
|
||||
}
|
||||
|
||||
public function reviews(): HasMany
|
||||
{
|
||||
return $this->hasMany(MembershipApplicationReview::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MembershipApplication\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class MembershipApplicationApplicant extends Model
|
||||
{
|
||||
use HasUuids;
|
||||
|
||||
protected $table = 'membership_application_applicants';
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'membership_application_id',
|
||||
'name',
|
||||
'email',
|
||||
'ic_number',
|
||||
'birth_date',
|
||||
'birth_place',
|
||||
'gender',
|
||||
'marriage_status',
|
||||
'address',
|
||||
'phone_number',
|
||||
'office_number',
|
||||
'postcode',
|
||||
'employer_name',
|
||||
'employer_address',
|
||||
'current_position',
|
||||
'start_work_date',
|
||||
'stock_monthly_contribution',
|
||||
'fee_monthly_contribution',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'start_work_date' => 'date',
|
||||
'stock_monthly_contribution' => 'decimal:2',
|
||||
'fee_monthly_contribution' => 'decimal:2',
|
||||
];
|
||||
}
|
||||
|
||||
public function membershipApplication(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MembershipApplication::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MembershipApplication\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class MembershipApplicationHeir extends Model
|
||||
{
|
||||
use HasUuids;
|
||||
|
||||
protected $table = 'membership_application_heirs';
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'membership_application_id',
|
||||
'name',
|
||||
'ic_number',
|
||||
'relationship',
|
||||
'phone_number',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'string',
|
||||
'ic_number' => 'string',
|
||||
'relationship' => 'string',
|
||||
'phone_number' => 'string',
|
||||
];
|
||||
}
|
||||
|
||||
public function membershipApplication(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MembershipApplication::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MembershipApplication\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\Auth\Entities\User;
|
||||
use Modules\MembershipApplication\Enums\ReferenceType;
|
||||
|
||||
class MembershipApplicationReference extends Model
|
||||
{
|
||||
use HasUuids;
|
||||
|
||||
protected $table = 'membership_application_references';
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'membership_application_id',
|
||||
'reference_type',
|
||||
'user_id',
|
||||
'assigned_by',
|
||||
'assigned_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'reference_type' => ReferenceType::class,
|
||||
'assigned_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function membershipApplication(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MembershipApplication::class);
|
||||
}
|
||||
|
||||
public function member(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function assignedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'assigned_by');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MembershipApplication\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\Auth\Entities\User;
|
||||
use Modules\MembershipApplication\Enums\BoardDecision;
|
||||
use Modules\MembershipApplication\Enums\ManagementDecision;
|
||||
use Modules\MembershipApplication\Enums\ReviewStage;
|
||||
|
||||
class MembershipApplicationReview extends Model
|
||||
{
|
||||
use HasUuids;
|
||||
|
||||
protected $table = 'membership_application_reviews';
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'membership_application_id',
|
||||
'stage',
|
||||
'decision',
|
||||
'remarks',
|
||||
'reviewer_id',
|
||||
'reviewed_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'stage' => ReviewStage::class,
|
||||
'reviewed_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function membershipApplication(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MembershipApplication::class);
|
||||
}
|
||||
|
||||
public function reviewer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'reviewer_id');
|
||||
}
|
||||
|
||||
public function managementDecision(): ?ManagementDecision
|
||||
{
|
||||
if ($this->stage !== ReviewStage::Management) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ManagementDecision::tryFrom($this->decision);
|
||||
}
|
||||
|
||||
public function boardDecision(): ?BoardDecision
|
||||
{
|
||||
if ($this->stage !== ReviewStage::Board) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return BoardDecision::tryFrom($this->decision);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user