fix sort order sidebar menu and percentage bigdata resume
This commit is contained in:
@@ -76,19 +76,19 @@ class BigDataResumeController extends Controller
|
||||
$total_potensi_percentage = $big_data_resume->potention_sum > 0 && $target_pad > 0
|
||||
? round(($big_data_resume->potention_sum / $target_pad) * 100, 2) : 0;
|
||||
|
||||
// percentage verified document (verified_sum / potention_sum) - by value/amount
|
||||
$verified_percentage = $big_data_resume->potention_sum > 0 && $big_data_resume->verified_sum >= 0
|
||||
? round(($big_data_resume->verified_sum / $big_data_resume->potention_sum) * 100, 2) : 0;
|
||||
// // percentage verified document (verified_sum / potention_sum) - by value/amount
|
||||
// $verified_percentage = $big_data_resume->potention_sum > 0 && $big_data_resume->verified_sum >= 0
|
||||
// ? round(($big_data_resume->verified_sum / $big_data_resume->potention_sum) * 100, 2) : 0;
|
||||
|
||||
// percentage non-verified document (non_verified_sum / potention_sum) - by value/amount
|
||||
$non_verified_percentage = $big_data_resume->potention_sum > 0 && $big_data_resume->non_verified_sum >= 0
|
||||
? round(($big_data_resume->non_verified_sum / $big_data_resume->potention_sum) * 100, 2) : 0;
|
||||
// // percentage non-verified document (non_verified_sum / potention_sum) - by value/amount
|
||||
// $non_verified_percentage = $big_data_resume->potention_sum > 0 && $big_data_resume->non_verified_sum >= 0
|
||||
// ? round(($big_data_resume->non_verified_sum / $big_data_resume->potention_sum) * 100, 2) : 0;
|
||||
|
||||
// Alternative: percentage by count (if needed)
|
||||
// $verified_count_percentage = $big_data_resume->potention_count > 0
|
||||
// ? round(($big_data_resume->verified_count / $big_data_resume->potention_count) * 100, 2) : 0;
|
||||
// $non_verified_count_percentage = $big_data_resume->potention_count > 0
|
||||
// ? round(($big_data_resume->non_verified_count / $big_data_resume->potention_count) * 100, 2) : 0;
|
||||
$verified_count_percentage = $big_data_resume->potention_count > 0 && $big_data_resume->verified_count > 0
|
||||
? round(($big_data_resume->verified_count / $big_data_resume->potention_count) * 100, 2) : 0;
|
||||
$non_verified_count_percentage = $big_data_resume->potention_count > 0 && $big_data_resume->non_verified_count > 0
|
||||
? round(($big_data_resume->non_verified_count / $big_data_resume->potention_count) * 100, 2) : 0;
|
||||
|
||||
// percentage business document (business / non_verified)
|
||||
$business_percentage = $big_data_resume->non_verified_sum > 0 && $big_data_resume->business_sum >= 0
|
||||
@@ -146,12 +146,12 @@ class BigDataResumeController extends Controller
|
||||
'verified_document' => [
|
||||
'sum' => (float) $big_data_resume->verified_sum,
|
||||
'count' => $big_data_resume->verified_count,
|
||||
'percentage' => $verified_percentage
|
||||
'percentage' => $verified_count_percentage
|
||||
],
|
||||
'non_verified_document' => [
|
||||
'sum' => (float) $big_data_resume->non_verified_sum,
|
||||
'count' => $big_data_resume->non_verified_count,
|
||||
'percentage' => $non_verified_percentage
|
||||
'percentage' => $non_verified_count_percentage
|
||||
],
|
||||
'business_document' => [
|
||||
'sum' => (float) $big_data_resume->business_sum,
|
||||
|
||||
@@ -22,6 +22,11 @@ class MenuResource extends JsonResource
|
||||
'url' => $this->url,
|
||||
'sort_order' => $this->sort_order,
|
||||
'parent' => $this->parent ? new MenuResource($this->parent) : null,
|
||||
'children' => $this->when($this->relationLoaded('children'), function () {
|
||||
return $this->children->sortBy('sort_order')->map(function ($child) {
|
||||
return new MenuResource($child);
|
||||
});
|
||||
}),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at
|
||||
];
|
||||
|
||||
@@ -64,7 +64,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
$query->whereHas('roles', function ($subQuery) use ($user) {
|
||||
$subQuery->whereIn('roles.id', $user->roles->pluck('id'))
|
||||
->where('role_menu.allow_show', 1);
|
||||
});
|
||||
})
|
||||
->orderBy('sort_order', 'asc');
|
||||
}])
|
||||
->whereNull('parent_id') // Ambil hanya menu utama
|
||||
->orderBy('sort_order', 'asc')
|
||||
|
||||
Reference in New Issue
Block a user