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

@@ -340,8 +340,10 @@ class MemberEnrollmentService
if ($date_from_row instanceof DateTime) { if ($date_from_row instanceof DateTime) {
return $date_from_row->format('Y-m-d'); return $date_from_row->format('Y-m-d');
} else { } else if ($date_from_row != null) {
return date('Y-m-d', strtotime($date_from_row)); return date('Y-m-d', strtotime($date_from_row));
} else {
return null;
} }
} }
@@ -728,7 +730,7 @@ class MemberEnrollmentService
], ],
[ [
'name' => $row['name'] ?? null, 'name' => $row['name'] ?? null,
'birth_date' => $this->dateParser($row['date_of_birth']), 'birth_date' => $this->dateParser($row['date_of_birth']) ?? null,
'gender' => Helper::genderNormalization($row['sex']), 'gender' => Helper::genderNormalization($row['sex']),
'language' => $row['language'] ?? null, 'language' => $row['language'] ?? null,
'race' => $row['race'] ?? null, 'race' => $row['race'] ?? null,
@@ -785,7 +787,7 @@ class MemberEnrollmentService
if ($member->save()) { if ($member->save()) {
$person = Person::create([ $person = Person::create([
'name' => $row['name'], 'name' => $row['name'],
'birth_date' => $this->dateParser($row['date_of_birth']), 'birth_date' => $this->dateParser($row['date_of_birth']) ?? null,
'gender' => Helper::genderNormalization($row['sex']) ?? '-', 'gender' => Helper::genderNormalization($row['sex']) ?? '-',
'language' => $row['language'] ?? null, 'language' => $row['language'] ?? null,
'race' => $row['race'] ?? null, 'race' => $row['race'] ?? null,
@@ -906,6 +908,7 @@ class MemberEnrollmentService
$member->gender = Helper::genderPerson($row['sex']); $member->gender = Helper::genderPerson($row['sex']);
$member->relation_with_principal = $row['relationship_with_principal']; $member->relation_with_principal = $row['relationship_with_principal'];
$member->marital_status = $row['marital_status']; $member->marital_status = $row['marital_status'];
$member->birth_date = $this->dateParser($row['date_of_birth']);
$member->save(); $member->save();
try { try {
@@ -999,7 +1002,7 @@ class MemberEnrollmentService
'sNamaPeserta' => $row['name'], 'sNamaPeserta' => $row['name'],
'dStartDate' => $row['member_effective_date'], 'dStartDate' => $row['member_effective_date'],
'dExpireDate' => $row['member_expiry_date'], 'dExpireDate' => $row['member_expiry_date'],
'dTanggalLahir' => $row['date_of_birth'], 'dTanggalLahir' => $row['date_of_birth'] ? $this->dateParser($row['date_of_birth']) : null,
// 'nNoKTP' => $row['nric'] ?? , // 'nNoKTP' => $row['nric'] ?? ,
] ]
); );

View File

@@ -71,6 +71,9 @@ class Member extends Model
'full_name', 'full_name',
'age', 'age',
'gender_code', 'gender_code',
'relations',
'status_marital'
// 'relation_with_principal'
]; ];
protected $hidden = [ protected $hidden = [
@@ -238,7 +241,7 @@ class Member extends Model
protected function genderCode(): Attribute protected function genderCode(): Attribute
{ {
return Attribute::make( 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( 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 protected function birthDateCard(): Attribute
{ {
$date = $this->birth_date; $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 protected function corporateLogo(): Attribute
{ {
$avatar = null; $avatar = null;

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={{color: style1.color, width: '25%'}}>NRIC:</Typography>
<Typography variant='body2' sx={{width: '25%'}}>{row.nric ? row.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={{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>
<Stack direction='row' spacing={1}> <Stack direction='row' spacing={1}>
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>NIK:</Typography> <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={{color: style1.color, width: '25%'}}>Email:</Typography>
<Typography variant='body2' sx={{width: '25%'}}>{row.email ? row.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={{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>
<Stack direction='row' spacing={1}> <Stack direction='row' spacing={1}>
<Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Phone Number:</Typography> <Typography variant='body2' sx={{color: style1.color, width: '25%'}}>Phone Number:</Typography>

View File

@@ -77,10 +77,9 @@
</style> </style>
</head> </head>
<body> <body>
<br><br><br><br> <br><br>
@if($member->currentCorporate->files && count($member->currentCorporate->files) > 0) @if($member->currentCorporate->files && count($member->currentCorporate->files) > 0)
<div> <div>
{{ asset($member->currentCorporate->files[0]->path)}}
<img src="{{ public_path('images/logo-default.png') }}" height="30px"> <img src="{{ public_path('images/logo-default.png') }}" height="30px">
</div> </div>
@endif @endif