@php
$one_month_ago = date('m-d');
$total_issue = DB::table('issue_entries')
->where('assign_date', '>', $one_month_ago)
->count();
$issue_complete = DB::table('issue_entries')
->where('issue_status', 'Close')
->where('assign_date', '>', $one_month_ago)
->count();
$issue_pending = DB::table('issue_entries')
->where('issue_status', 'Open')
->where('assign_date', '>', $one_month_ago)
->count();
$issue_vendor = DB::table('issue_entries')
->where('issue_status', 'Open')
->where('issue_handed_over_to_vendor', '!=', null)
->where('assign_date', '>', $one_month_ago)
->count();
@endphp
Total Task
{{ $total_issue ?? 0 }}
Task Complete
{{ $issue_complete ?? 0 }}
Task Pending
{{ $issue_pending ?? 0 }}
Task in Vendor Hand
{{ $issue_vendor ?? 0 }}
@php
$parent = App\Models\User::where('role_id', 3)->where('department_id', auth()->user()->department_id)->first();
// dd($parent);
if ($parent == null) {
return redirect()
->route('home')
->withMessage('You dont have any child');
}
$parent_details = DB::table('users')
->where('id', $parent->id)
->first();
$children = DB::table('users')
->where('role_id', 2)->where('department_id', $parent_details->department_id)
->get()
->toArray();
$children_count = count($children);
$child_details = [];
for ($i = 0; $i < $children_count; $i++) {
$child_details[$children[$i]->id] = DB::table('users')
->where('id', $children[$i]->id)
->first();
}
// Count child issue statistics
$child_issue_count = [];
foreach ($child_details as $child) {
$child_issue_count[$child->id] = [];
$child_issue_count[$child->id]['total_issue'] = 0;
$child_issue_count[$child->id]['issue_complete'] = 0;
$child_issue_count[$child->id]['issue_pending'] = 0;
$child_issue_count[$child->id]['issue_vendor'] = 0;
$one_month_ago = date('Y-m');
$child_issue_count[$child->id]['total_issue'] = DB::table('issue_entries')
->where('issue_assign_to', $child->id)
->where('assign_date', '>', $one_month_ago)
->count();
$child_issue_count[$child->id]['issue_complete'] = DB::table('issue_entries')
->where('issue_assign_to', $child->id)
->where('assign_date', '>', $one_month_ago)
->where('issue_status', 'Close')
->count();
$child_issue_count[$child->id]['issue_pending'] = DB::table('issue_entries')
->where('issue_assign_to', $child->id)
->where('assign_date', '>', $one_month_ago)
->where('issue_status', 'Open')
->count();
$child_issue_count[$child->id]['issue_vendor'] = DB::table('issue_entries')
->where('issue_assign_to', $child->id)
->where('issue_status', 'Open')
->where('assign_date', '>', $one_month_ago)
->where('issue_handed_over_to_vendor', '!=', null)
->count();
}
@endphp
{{--
--}}
{{--
Level 1
--}}
@isset($child_details)
@forelse ($child_details as $child_details)
{{ $child_details->name }}
ID: {{ $child_details->emp_id }}
@php
$designation = App\Models\Designation::where('id', $child_details->designation_id)->first();
$departmrnt = App\Models\Department::where('id', $child_details->department_id)->first();
@endphp
{{ $designation->name ?? 'No Data' }},
{{ $departmrnt->name }}
@foreach ($child_issue_count[$child_details->id] as $key => $value)
{{-- @dd($key) --}}
{{--
--}}
{{ ucwords(str_replace('_', ' ', $key)) }}:
{{ $value }}
{{--
--}}
{{--
--}}
@endforeach
@empty
@endforelse
@endisset
@php
$user = auth()->user();
@endphp
Warning: Undefined variable $user in D:\NTG_App\www\Support_Issue\resources\views\layouts\its\Manager.blade.php on line 242
Warning: Attempt to read property "joining_date" on null in D:\NTG_App\www\Support_Issue\resources\views\layouts\its\Manager.blade.php on line 242
Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in D:\NTG_App\www\Support_Issue\resources\views\layouts\its\Manager.blade.php on line 242
Warning: Undefined variable $user in D:\NTG_App\www\Support_Issue\resources\views\layouts\its\Manager.blade.php on line 243
Warning: Attempt to read property "dob" on null in D:\NTG_App\www\Support_Issue\resources\views\layouts\its\Manager.blade.php on line 243
Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in D:\NTG_App\www\Support_Issue\resources\views\layouts\its\Manager.blade.php on line 243