Merge remote-tracking branch 'origin/staging' into origin/production

This commit is contained in:
Linksehat Staging Server
2024-01-06 15:05:32 +07:00
4 changed files with 97 additions and 12 deletions

View File

@@ -71,6 +71,9 @@ class Member extends Model
'full_name',
'age',
'gender_code',
'relations',
'status_marital'
// 'relation_with_principal'
];
protected $hidden = [
@@ -238,7 +241,7 @@ class Member extends Model
protected function genderCode(): Attribute
{
return Attribute::make(
get: fn () => $this->gender ? ($this->gender == 'female' ? 'F' : 'M') : $this->gender
get: fn () => $this->gender ? ($this->gender == 'Female' ? 'F' : 'M') : $this->gender
);
}
@@ -286,13 +289,67 @@ class Member extends Model
);
}
protected function status(): Attribute
protected function relations(): Attribute
{
$relation = '-';
if ($this->relation_with_principal == 'H'){
$relation = 'Husbund';
} else if ($this->relation_with_principal == 'W'){
$relation = 'Wife';
} else if ($this->relation_with_principal == 'S'){
$relation = 'Son';
} else if ($this->relation_with_principal == 'D'){
$relation = 'Daughter';
}
return Attribute::make(
get: fn () => $this->active ? ($this->active == 1 ? 'Active' : 'Inactive') : null
get: fn () => $relation
);
}
protected function statusMarital(): Attribute
{
$maritalStatus = '-';
if ($this->marital_status == 'M'){
$maritalStatus = 'Married';
} else if ($this->relation_with_principal == 'D'){
$maritalStatus = 'Divorced';
} else if ($this->relation_with_principal == 'S'){
$maritalStatus = 'Sungle';
}
return Attribute::make(
get: fn () => $maritalStatus
);
}
// protected function birthDate(): Attribute
// {
// // $date = $this->person->birth_date ?? ($this->birth_date ?? null);
// $date = $this->birth_date ?? ($this->person->birth_date ?? null);
// return Attribute::make(
// get: fn () => !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null
// );
// }
protected function birthDateeCard(): Attribute
{
// $date = $this->person->birth_date ?? ($this->birth_date ?? null);
if ($this->birth_date){
$date = $this->birth_date;
return Attribute::make(
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
);
} else if ($this->person->birth_date){
return Attribute::make(
get: fn () => !empty($date) ? Carbon::parse($date)->format('d / M / Y') : null
);
} else {
return Attribute::make(
get: fn () => '-'
);
}
}
protected function birthDateCard(): Attribute
{
$date = $this->birth_date;
@@ -329,6 +386,32 @@ class Member extends Model
);
}
// protected function relationWithPrincipal(): Attribute
// {
// $relation = null;
// if ($this->relation_with_principal === 'S') {
// $relation = 'Son';
// } elseif ($this->relation_with_principal === 'H') {
// $relation = 'Husband';
// } elseif ($this->relation_with_principal === 'D') {
// $relation = 'Daughter';
// } elseif ($this->relation_with_principal === 'Wife') {
// $relation = 'Wife';
// }
// return Attribute::make(
// get: fn () => $relation
// );
// }
// protected function gender(): Attribute
// {
// return Attribute::make(
// get: fn () => ucfirst($this->person->gender) ?? null
// );
// }
protected function corporateLogo(): Attribute
{
$avatar = null;