@include('layouts.partials.single-page-header-schedule', [
'userData' => $user,
'mySchdule' => 0,
])
@include('layouts.partials.excelModal')
@include('layouts.partials.excelModalSendEmail')
@include('timetracker::schedules.duplicatSchedule', [
'user' => $user,
'edit' => false
])
@if (isset($error) && $error != "")
{{$error}}
@php
$i = 0; $prev= null; $xleft = []; $xright = [];
$dtFormat = config('settings.date_format').' '.config('settings.time_format');
$workstation_time_labels = [];
foreach($workstations as $ekey => $workstation) {
$total_workinghours = 1;
$workinghours = [];
$isHideRowForAdmin = 0;
$extraClass = '';
if ($workstation->is_hide == 1) {
if ($workstation->isHiddenForUser($user)) {
$isHideRowForAdmin = 1;
} else {
$extraClass = 'hiddenForUser';
$isHideRowForAdmin = 2;
}
}
if ($isHideRowForAdmin == 2) {
continue;
}
$blur = $isHideRowForAdmin == 1 ? 'linear-gradient(rgba(0,0,0,.8), rgba(0,0,0,.8))' : 'linear-gradient(rgba(0,0,0,.4), rgba(0,0,0,.4))';
if($workstation->workinghours) {
$workinghours = array_map(function($value) use($dtFormat) {
$hours = explode(";", $value);
if(config('settings.time_format') == "h:i a") {
$hours[0] = explode(" ", Carbon\Carbon::createFromTimestamp(intval($hours[0] / 1000))->format($dtFormat));
$hours[1] = explode(" ", Carbon\Carbon::createFromTimestamp(intval($hours[1] / 1000))->format($dtFormat));
$hours = array_merge($hours, ['from' => $hours[0][1].' '. $hours[0][2], "to" => $hours[1][1].' '. $hours[1][2]]);
$hours[0] = Carbon\Carbon::createFromFormat($dtFormat, Carbon\Carbon::today()->format(config('settings.date_format')).' '. $hours[0][1].' '. $hours[0][2])->diffInMinutes(Carbon\Carbon::now()->startOfDay());
$hours[1] = Carbon\Carbon::createFromFormat($dtFormat, Carbon\Carbon::today()->format(config('settings.date_format')).' '. $hours[1][1].' '. $hours[1][2])->diffInMinutes(Carbon\Carbon::now()->startOfDay());
} else {
$hours[0] = explode(" ", Carbon\Carbon::createFromTimestamp(intval($hours[0] / 1000))->format($dtFormat));
$hours[1] = explode(" ", Carbon\Carbon::createFromTimestamp(intval($hours[1] / 1000))->format($dtFormat));
$hours = array_merge($hours, ['from' => $hours[0][1], "to" => $hours[1][1]]);
$hours[0] = Carbon\Carbon::createFromFormat($dtFormat, Carbon\Carbon::today()->format(config('settings.date_format')).' '. $hours[0][1])->diffInMinutes(Carbon\Carbon::now()->startOfDay());
$hours[1] = Carbon\Carbon::createFromFormat($dtFormat, Carbon\Carbon::today()->format(config('settings.date_format')).' '. $hours[1][1])->diffInMinutes(Carbon\Carbon::now()->startOfDay());
}
//$workinghours[$key] = implode(";", $hours);
return $hours;
}, json_decode($workstation->workinghours, true));
$workstation_time_labels = $workinghours[strtolower($date->format('D'))];
$workinghours = range($workinghours[strtolower(now()->format('D'))][0], $workinghours[strtolower(now()->format('D'))][1]);
$total_workinghours = count($workinghours);
}
$check =0; $common = '';
$capacity_usage = 0;
$capacity_html = "";
$gotVacation = 0;$gotLeave = 0;
$employee_time_segment = [];
$healthcare = 0;
foreach( $workstation->schedules as $skey => $schedule ) {
$usersData = $schedule->user;
$parent_id = ( $schedule->parent_id > 0 ) ? $schedule->parent_id : $schedule->id;
echo view('layouts.partials.userModal', [
'usersData' => $usersData,
'user' => $user
])->render();
$photo = getMediaUrl($schedule->user, 'photograph', 'thumb');
//$departments = $schedule->user->departments->pluck('name')->implode(', ');
if ($user->can('access_employee_files', $usersData)) {
$username = ($user->id === $schedule->user_id || $user->hasPermissionTo('view profile employee'))
? "" . $schedule->user->display_name . ""
: $schedule->user->display_name;
}else{
$username = ($user->id === $schedule->user_id || $user->hasPermissionTo('view profile employee')) ? "user->id)."'>".$schedule->user->display_name."" : $schedule->user->display_name;
}
if($schedule->position->healthcare) {
$start = Carbon\Carbon::createFromFormat($dtFormat, Carbon\Carbon::today()->format(config('settings.date_format')).' '. $schedule->start_time)->diffInMinutes(Carbon\Carbon::now()->startOfDay());
$end = Carbon\Carbon::createFromFormat($dtFormat, Carbon\Carbon::today()->format(config('settings.date_format')).' '. $schedule->end_time)->diffInMinutes(Carbon\Carbon::now()->startOfDay());
$employee_time_segment = range( $start, $end);
$workinghours = array_diff($workinghours, $employee_time_segment);
$healthcare = 1;
}
$common .= "
';
if(!empty($workstation_time_labels)) {
// dd($workstation_time_labels[strtolower(now()->format('D'))]);
$capacity_html .= '';
}
$capacity_html .= '';
}else{
$class = "";
}
if( $check == 0 ) {
$common .= '
@endif
";
$common .= "
';
$check = 1;
if( !$employees->contains('id', $schedule->user->id) ) {
$employees->add( $schedule->user );
}
}
if (isset($maintences[$workstation->id])) {
foreach ($maintences[$workstation->id] as $key => $value) {
$common .= "";
//$common .= "";
//rgba(60, 60, 60, .8)
$common .= "
";
$bgColor = $isHideRowForAdmin == 1 ? 'background: #e5e7eb;' : 'background: #ffffff;';
$common .= "
{$username}
";
if( $user->can('update', $schedule) && $isHideRowForAdmin == 0) {
$common .= "
id)."'>
";
}
$common .= '
{$username}
{$schedule->position->name}
{$schedule->start_time} - {$schedule->end_time}";
$breaks = @unserialize($schedule->break_time);
$breakPopover = '';
if (!empty($breaks) && is_array($breaks)) {
$breakDetails = '';
$breakDetails = "" . trans('forms.break_time') . "";
foreach ($breaks as $break) {
$breakDetails .= "" . ($break['start_time_break'] ?? '') . " - " . ($break['end_time_break'] ?? '') . "";
}
$breakPopover = "data-content='".htmlspecialchars($breakDetails, ENT_QUOTES)."'";
}
if (!empty($breakPopover)) {
$common .= "
";
}
$common .= "
";
$common .= "
";
}
}
$current_workinghours_count = count($workinghours);
if($current_workinghours_count == 0) {
$capacity_usage = 100;
} else {
if($healthcare == 0) {
$workinghours = [];
}
$capacity_usage = number_format((($total_workinghours - $current_workinghours_count) / $total_workinghours) * 100);
}
if(($workstation->workinghours && $workstation->is_operation_room == 1) && $user->can('view_capacity_usage', App\User::class)) {
$class = "mb-6";
$capacity_html = '";
$common .= "";
$common .= "" . $value->subject . "
";
$common .= "";
$common .= "
";
$common .= "" . $value->subject . "
";
if ($value->start_time || $value->end_time) {
$timeParts = [];
if ($value->start_time) {
$timeParts[] = parseFromFormat($value->start_time)->format(config('settings.time_format'));
}
if ($value->end_time) {
$timeParts[] = parseFromFormat($value->end_time)->format(config('settings.time_format'));
}
$common .= "" . implode(' - ', $timeParts) . "
";
}
$common .= "" . trans('label.mainenance') . "";
$common .= "
'.$workstation_time_labels['from'].'
'.$capacity_usage .'%
'.$workstation_time_labels['to'].'
'.trans("schedules.lbl_not_scheduled").'
'; } $xbox = "
$capacity_html
$common
";
if( $workstation->column == 0 ) {
$xleft[] = $xbox;
} else {
$xright[] = $xbox;
}
$i++;
}
$maxLength = (count($xleft) > count($xright)) ? count($xleft) : count($xright);
@endphp
@for ($i=0; $i < $maxLength; $i++)
@if(isset($xleft[$i]))
@endif
@if(isset($xright[$i]))
@endif
@endfor
".$workstation->name."
"; $show_note_icon = $user->hasPermissionTo("create schedules") || !$workstation->comments->isEmpty(); if ($show_note_icon) { $xbox .= "
id) . "'
data-title='" . trans('schedules.notes') . "'
href='javascript:;'>";
if ($workstation->comments->count() > 0) {
$xbox .= "
" . $workstation->comments->count() . "
";
}
$xbox .= "
";
}
if( $user->hasPermissionTo("create schedules") && $isHideRowForAdmin == 0) {
$xbox .= "
";
}
if($show_note_icon) {
$xbox .= '
';
}
$bgColor = $isHideRowForAdmin == 1 ? 'background: #e5e7eb;' : '';
$xbox .= "