@php
$getefile = DB::table('efileshares')->where('id', $getfileshare->id)->first();
@endphp
@php
$draftremarks = DB::table('draftremarks')->where('draft_id' , $getefile->draft_id)->get();
@endphp
@php
$getname = DB::table('users')->where('id', $efile->sharefrom)->first();
$getsection = DB::table('departments')->where('id', $getname->department_id)->first();
@endphp
@php
$draftre = DB::table('draftremarks')->where('draft_id' , $efile->draft_id)->orderBy('id', 'DESC')->first();
@endphp
@if(isset($draftre->user_id))
@php
$getuname = DB::table('users')->where('id', $draftre->user_id)->first();
@endphp
@endif
@if(isset($getuname, $draftre))
{{$getuname->name}} ({{$getuname->jobtitle}})
@endif
@php
$geteattachments = DB::table('draft_attachments')->where('draft_id', $getefile->id)->get();
@endphp
@foreach ($geteattachments as $geteattachment)
@if (str_contains($geteattachment->path, '.pdf'))
Attachment
@else

@endif
@endforeach
Notings
@php
$getnottingsname = DB::table('users')->where('id', $getefile->sharefrom)->first();
@endphp
@if(isset($getnottingsname->name))
@if(isset($getefile->nottings))
{{$getnottingsname->name}} ({{$getnottingsname->jobtitle}}):({{ \Carbon\Carbon::parse($getefile->created_at)->format('d/m/y H:i') }}) (1): {!!$getefile->nottings!!}
@endif
@endif
@php
$counter = 2;
@endphp
@foreach ($draftremarks as $draftremark)
@php
$getname = DB::table('users')->where('id', $draftremark->user_id)->first();
@endphp
@if(isset($draftremark->scale_id))
@if(Auth::user()->scale_level < 6)
@if(isset($draftremark->remark))
@if(str_contains($draftremark->remark, '.pdf'))
@if(isset($getname->name))
{{$getname->name}} ({{$draftremark->job_title}}): View Attachment{{ \Carbon\Carbon::parse($draftremark->created_at)->format('d/m/y H:i') }}
@endif
@else
@if(isset($getname->name))
{{$getname->name}} ({{$draftremark->job_title}}): @php echo $counter @endphp: {!! nl2br($draftremark->remark) !!} {{ \Carbon\Carbon::parse($draftremark->created_at)->format('d/m/y H:i') }}
@php
$counter++;
@endphp
@endif
@endif
@endif
@if(isset($draftremark->notify))
@if(isset($getname->name))
{{$getname->name}} ({{$draftremark->job_title}}): {{$draftremark->notify}}
@endif
@endif
@endif
@endif
@endforeach
@if(Auth::user()->jobtitle == 'Secretary')
@endif
@php
$notifycheck = DB::table('draftremarks')->where('draft_id' , $getefile->draft_id)->where('job_title' , "Secretary")->where('notify' , "Notify")->get();
@endphp
@if($notifycheck->count()>0 AND Auth::user()->jobtitle == 'Draftsman')
@endif
@php
$notifycheckAS = DB::table('draftremarks')->where('draft_id' , $getefile->draft_id)->where('job_title' , "Draftsman")->where('notify' , "Notify")->get();
$getSecretary = DB::table('users')->where('jobtitle', 'Draftsman')->where('odep_id', Auth::user()->odep_id)->first();
$getexistanceSecretary = DB::table('draftshares')->where('draft_id', $getefile->id)->where('touser', $getSecretary->id)->first();
@endphp
@if($notifycheckAS->count()>0 AND Auth::user()->jobtitle == 'AS')
@elseif(isset($getexistanceSecretary) AND Auth::user()->jobtitle == 'AS')
@endif
@php
$notifycheckDS = DB::table('draftremarks')->where('draft_id' , $getefile->draft_id)->where('job_title' , "AS")->where('notify' , "Notify")->get();
$getDraftsman = DB::table('users')->where('jobtitle', 'Draftsman')->where('odep_id', Auth::user()->odep_id)->first();
$getexistanceDraftsman = DB::table('draftshares')->where('draft_id', $getefile->id)->where('touser', $getDraftsman->id)->first();
$getSecretary = DB::table('users')->where('jobtitle', 'Draftsman')->where('odep_id', Auth::user()->odep_id)->first();
$getexistanceSecretary = DB::table('draftshares')->where('draft_id', $getefile->id)->where('touser', $getSecretary->id)->first();
@endphp
@if($notifycheckDS->count()>0 AND Auth::user()->jobtitle == 'DS')
@elseif(isset($getexistanceDraftsman) AND Auth::user()->jobtitle == 'DS')
@elseif(isset($getexistanceSecretary) AND Auth::user()->jobtitle == 'DS')
@endif
@php
$notifycheckSO = DB::table('draftremarks')->where('draft_id' , $getefile->draft_id)->where('job_title' , "DS")->where('notify' , "Notify")->get();
$getAS = DB::table('users')->where('jobtitle', 'AS')->where('odep_id', Auth::user()->odep_id)->first();
$getexistanceAS = DB::table('draftshares')->where('draft_id', $getefile->id)->where('touser', $getAS->id)->first();
$getDraftsman = DB::table('users')->where('jobtitle', 'Draftsman')->where('odep_id', Auth::user()->odep_id)->first();
$getexistanceDraftsman = DB::table('draftshares')->where('draft_id', $getefile->id)->where('touser', $getDraftsman->id)->first();
$getSecretary = DB::table('users')->where('jobtitle', 'Draftsman')->where('odep_id', Auth::user()->odep_id)->first();
$getexistanceSecretary = DB::table('draftshares')->where('draft_id', $getefile->id)->where('touser', $getSecretary->id)->first();
@endphp
@if($notifycheckSO->count()>0 AND Auth::user()->jobtitle == 'SO')
@elseif(isset($getexistanceAS) AND Auth::user()->jobtitle == 'SO')
@elseif(isset($getexistanceDraftsman) AND Auth::user()->jobtitle == 'SO')
@elseif(isset($getexistanceSecretary) AND Auth::user()->jobtitle == 'SO')
@endif
@if(Auth::user()->jobtitle == 'SO')
@php
$quickreplies = DB::table('quickreplies')->get();
@endphp
@foreach ($quickreplies as $quickreply)
{{ $quickreply->name }}
@endforeach
@endif
@php
$getefile = DB::table('efileshares')->where('id', $getfileshare->id)->first();
@endphp