update fix member detail

This commit is contained in:
2024-01-06 14:13:13 +07:00
parent 5c5ad8bae7
commit 7db0af3bef
2 changed files with 64 additions and 9 deletions

View File

@@ -71,6 +71,9 @@ class Member extends Model
'full_name',
'age',
'gender_code',
'relations',
'status_marital'
// 'relation_with_principal'
];
protected $hidden = [
@@ -245,7 +248,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
);
}
@@ -256,6 +259,39 @@ class Member extends Model
);
}
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 () => $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);
@@ -302,12 +338,31 @@ class Member extends Model
);
}
protected function gender(): Attribute
{
return Attribute::make(
get: fn () => ucfirst($this->person->gender) ?? null
);
}
// 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
{

View File

@@ -603,7 +603,7 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>NRIC:</Typography>
<Typography variant='body2' sx={{width: '25%'}}>{row.nric ? row.nric : '-'}</Typography>
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Marital Status:</Typography>
<Typography variant='body2' sx={{width: '25%'}}>{row.marital_status ? row.marital_status : '-'}</Typography>
<Typography variant='body2' sx={{width: '25%'}}>{row.status_marital ? row.status_marital : '-'}</Typography>
</Stack>
<Stack direction='row' spacing={1}>
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>NIK:</Typography>
@@ -622,7 +622,7 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Email:</Typography>
<Typography variant='body2' sx={{width: '25%'}}>{row.email ? row.email : '-'}</Typography>
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Relationship:</Typography>
<Typography variant='body2' sx={{width: '25%'}}>{row.relation_with_principal ? row.relation_with_principal : '-'}</Typography>
<Typography variant='body2' sx={{width: '25%'}}>{row.relations ? row.relations : '-'}</Typography>
</Stack>
<Stack direction='row' spacing={1}>
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Phone Number:</Typography>