bugs fix livechat
This commit is contained in:
@@ -99,11 +99,11 @@ class HomeResource extends JsonResource
|
||||
};
|
||||
|
||||
if (count($memberProfile) > 0){
|
||||
|
||||
|
||||
$urlAvatarDefault = $this->detail->nIDJenisKelamin == 1 ? 'https://linksehat.dev/assets/img/users/male-avatar.png' : 'https://linksehat.dev/assets/img/users/female-avatar.png';
|
||||
$avatarMember = $this->detail->sImage ?? $urlAvatarDefault;
|
||||
$relationship = DB::connection('oldlms')->table('tm_hubungan_keluarga')->where('nID', $this->nIDHubunganKeluarga)->first('sHubunganKeluarga');
|
||||
|
||||
|
||||
$dataUser = [
|
||||
'id' => $this->nID,
|
||||
'name' => $this->sFirstName . ' ' . $this->sLastName,
|
||||
@@ -117,7 +117,7 @@ class HomeResource extends JsonResource
|
||||
$urlAvatarDefault = $m['detail']['nIDJenisKelamin'] == 1 ? 'https://linksehat.dev/assets/img/users/male-avatar.png' : 'https://linksehat.dev/assets/img/users/female-avatar.png';
|
||||
$avatarMember = $m['detail']['sImage'] ?? $urlAvatarDefault;
|
||||
$relationship = DB::connection('oldlms')->table('tm_hubungan_keluarga')->where('nID', $m['nIDHubunganKeluarga'])->first('sHubunganKeluarga');
|
||||
|
||||
|
||||
$data = [
|
||||
'id' => $m['nID'],
|
||||
'name' => $m['full_name'],
|
||||
@@ -135,17 +135,17 @@ class HomeResource extends JsonResource
|
||||
$memberProfile = User::with('detail')->where('nIDUser', $nID)->get()->toArray();
|
||||
|
||||
$dataMember = User::with('detail')->where('nID', $nID)->get()->first();
|
||||
|
||||
|
||||
if ($this->detail){
|
||||
$urlAvatarDefault = $this->detail->nIDJenisKelamin == 1 ? 'https://linksehat.dev/assets/img/users/male-avatar.png' : 'https://linksehat.dev/assets/img/users/female-avatar.png';
|
||||
} else {
|
||||
$urlAvatarDefault = 'https://linksehat.dev/assets/img/users/male-avatar.png';
|
||||
}
|
||||
$avatar = $this->detail->sImage ?? $urlAvatarDefault;
|
||||
|
||||
|
||||
$avatarMember = $dataMember->detail->sImage ?? $urlAvatarDefault;
|
||||
$relationship = DB::connection('oldlms')->table('tm_hubungan_keluarga')->where('nID', $this->nIDHubunganKeluarga)->first('sHubunganKeluarga');
|
||||
|
||||
|
||||
$dataUser = [
|
||||
'id' => $dataMember->nID,
|
||||
'name' => $dataMember->sFirstName . ' ' . $dataMember->sLastName,
|
||||
@@ -159,14 +159,14 @@ class HomeResource extends JsonResource
|
||||
$urlAvatarDefault = $m['detail']['nIDJenisKelamin'] == 1 ? 'https://linksehat.dev/assets/img/users/male-avatar.png' : 'https://linksehat.dev/assets/img/users/female-avatar.png';
|
||||
$avatarMember = $m['detail']['sImage'] ?? $urlAvatarDefault;
|
||||
$relationship = DB::connection('oldlms')->table('tm_hubungan_keluarga')->where('nID', $m['nIDHubunganKeluarga'])->first('sHubunganKeluarga');
|
||||
|
||||
|
||||
$data = [
|
||||
'id' => $m['nID'],
|
||||
'name' => $m['full_name'],
|
||||
'relationship' => $relationship->sHubunganKeluarga,
|
||||
'avatar' => $avatarMember,
|
||||
];
|
||||
|
||||
|
||||
array_push( $dataMemberProfile, $data);
|
||||
}
|
||||
}
|
||||
@@ -195,6 +195,7 @@ class HomeResource extends JsonResource
|
||||
$specialist = 'Umum';
|
||||
$year = 0;
|
||||
$price = 0;
|
||||
$organizationId = 0;
|
||||
if (!empty($doctor['person']['start_date_work'])) {
|
||||
$starExperience = Carbon::parse($doctor['person']['start_date_work'])->format('Y-m-d');
|
||||
$experience = Carbon::createFromFormat('Y-m-d', $starExperience);
|
||||
@@ -203,15 +204,19 @@ class HomeResource extends JsonResource
|
||||
if ($doctor['practitioner_roles']) {
|
||||
if ($doctor['practitioner_roles'][0]['speciality']){
|
||||
$specialist = $doctor['practitioner_roles'][0]['speciality']['name'];
|
||||
}
|
||||
}
|
||||
if ($doctor['practitioner_roles'][0]['price']){
|
||||
$price = $doctor['practitioner_roles'][0]['price'];
|
||||
}
|
||||
}
|
||||
if ($doctor['practitioner_roles'][0]['organization_id']){
|
||||
$organizationId = $doctor['practitioner_roles'][0]['organization_id'];
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'id' => $doctor['id'],
|
||||
'id' => $doctor['person']['id'],
|
||||
'full_name' => $doctor['person']['name'],
|
||||
'specialist' => $specialist,
|
||||
'organization_id' => $organizationId,
|
||||
'experience' => $year,
|
||||
'review' => $doctor['person']['review'],
|
||||
'price' => $price,
|
||||
@@ -224,8 +229,8 @@ class HomeResource extends JsonResource
|
||||
$hospitalList = [];
|
||||
|
||||
$hospitals = Organization::where([
|
||||
'type' => 'hospital',
|
||||
'status' => 'active',
|
||||
'type' => 'hospital',
|
||||
'status' => 'active',
|
||||
])
|
||||
->with('currentAddress')
|
||||
->get()->toArray();
|
||||
@@ -248,7 +253,7 @@ class HomeResource extends JsonResource
|
||||
if ($lat && $lang && $request->longitude && $request->latitude){
|
||||
$radius = round(Helper::calculateDistance($lat, $lang, $request->latitude, $request->longitude), 2);
|
||||
}
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => $hospital['name'],
|
||||
'radius' => $radius,
|
||||
@@ -259,7 +264,7 @@ class HomeResource extends JsonResource
|
||||
array_push($hospitalList, $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
usort($hospitalList, function($a, $b) {
|
||||
return $a['radius'] <=> $b['radius'];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user