Server 103 Commit

This commit is contained in:
Server D3 Linksehat
2024-07-18 16:05:33 +07:00
parent 18732053a1
commit 1bf608b1ed
2380 changed files with 2007 additions and 717 deletions

75
Modules/Internal/Services/MemberEnrollmentService.php Normal file → Executable file
View File

@@ -952,8 +952,6 @@ class MemberEnrollmentService
}
break;
case "2": // Member Information Update (Without Replacement Card)
$this->validateRow($row);
$member = Member::query()
->where('member_id', $row['member_id'])
@@ -1188,6 +1186,79 @@ class MemberEnrollmentService
'sKTP' => $row['nric'] ?? null,
]
);
} else {
$name = explode(" ", $row['name']);
// First name
$first_name = isset($name[0]) ? $name[0] : '';
// Middle name
$middle_name = isset($name[1]) ? $name[1] : '';
// Last name
$last_name = '';
if (count($name) > 2) {
$last_name = implode(" ", array_slice($name, 2));
}
if ($row['relationship_with_principal'] == 'H') {
$sMartialStatus = 6;
$nIDHubunganKeluarga = 3;
} else if ($row['relationship_with_principal'] == 'W') {
$sMartialStatus = 7;
$nIDHubunganKeluarga = 4;
} else if ($row['relationship_with_principal'] == 'S') {
$sMartialStatus = 4;
$nIDHubunganKeluarga = 5;
} else if ($row['relationship_with_principal'] == 'D') {
$sMartialStatus = 5;
$nIDHubunganKeluarga = 5;
} else {
$sMartialStatus = 0;
$nIDHubunganKeluarga = 0;
}
if ($row['sex'] == 'M') {
$nIDJenisKelamin = 1;
} else {
$nIDJenisKelamin = 2;
};
$userLms = User::create(
[
'sFirstName' => $first_name,
'sLastName' => $middle_name . ' ' . $last_name, // Ubah ini dengan variabel yang sesuai dengan nama belakang (last name)
'sPhone' => $row['telephone_mobile'],
'sEmail' => str_replace(' ', '', $row['email']),
'nIDHubunganKeluarga' => $nIDHubunganKeluarga !== 0 ? $nIDHubunganKeluarga : null,
'dUpdateOn' => date('Y-m-d H:i:s'),
]
);
$nIDUser = $userLms->nID;
$userLmsDetail = UserDetail::create(
[
'nIDUser' => $nIDUser,
// 'dTanggalLahir' => $row['date_of_birth'],
'dTanggalLahir' => $this->dateParser($row['date_of_birth']),
'dCreateOn' => date('Y-m-d H:i:s'),
'sMartialStatus' => $sMartialStatus != 0 ? $sMartialStatus : null,
'nIDJenisKelamin' => $nIDJenisKelamin,
'sCreateBy' => $nIDUser,
'sKTP' => $row['nric'] ?? null,
]
);
UserInsurance::updateOrCreate(
['nIDUser' => $nIDUser],
[
'nIDInsurance' => 106,
'sNamaPeserta' => $row['name'],
'dStartDate' => $row['member_effective_date'],
'dExpireDate' => $row['member_expiry_date'],
'dTanggalLahir' => $row['date_of_birth'] ? $this->dateParser($row['date_of_birth']) : null,
'sNoPolis' => $row['member_id'],
'sVerificationCode' => (string) Uuid::uuid5(Uuid::NAMESPACE_DNS, $row['member_id'])
]
);
}