@extends('layouts.users_app') @section('title', 'user shared cases') @section('content')

Expires within

Days

Hours

Minutes

Seconds

@php use Carbon\Carbon; @endphp @if ($shared_case->removed_by_user) Cancelled @elseif ($shared_case->is_revoked || $shared_case->duration_of_access < Carbon::now()) @if ($shared_case->share_case_extension->where('status', 0)->last()) Extension Requested @elseif ($shared_case->share_case_extension->where('status', 2)->last() && $shared_case->share_case_extension->where('status', 2)->last()->status == $shared_case->share_case_extension->last()->status) Extension Rejected, Requested Again @else Extend @endif @include('user.request_access', ['share' => $shared_case]) @endif
headoffice logo

Case Shared by {{ $shared_case->case->case_head_office->company_name }} on {{ $shared_case->case->created_at->format('D d/m/Y \a\t h:ia') }}

{{ $shared_case->note }}

{{-- @dd($shared_case->documents) --}}
@if (isset($shared_case)) @foreach ($shared_case->documents as $doc)
  •  {{ $doc->document->original_file_name() }}
  • @endforeach @endif
    {{--
    Head Office: {{ $shared_case->case->case_head_office->company_name }} at
    Case ID: {{ $shared_case->case->id }}
    Date of incident: {{ $shared_case->case->created_at }}
    Date of incident: {{ $shared_case->case->created_at->format('D d/m/Y \a\t h:ia') }}
    Shared By: {{ $shared_case->sharedBy->first_name }} {{ $shared_case->sharedBy->surname }}
    --}}
    @foreach ($shared_case->case->link_case_with_form->form->stages as $key => $stage)
    {{ $stage->stage_name }}
    @foreach ($stage->groups as $gk => $group)
     {{ $group->group_name }}
    @foreach ($group->questions as $question)
    @if ($shared_case->case->link_case_with_form->data->where('question_id', $question->id)->first()) @php$value = $shared_case->case->link_case_with_form->data ->where( 'question_id', $question->id, ) ->first(); @endphp ?> @if (isset($shared_case) && $shared_case->share_case_data_radact()->where('data_id', $value->id)->first())
    : {{ $value->question_value }}
    @endif @endif
    @endforeach
    @endforeach
    @endforeach {{-- @foreach ($case->link_case_with_form->data as $data) @if ($data->question)

    {{$data->question->question_name}}: {{$data->question_value}}


    @endif @endforeach --}}
    @foreach ($shared_case->logs()->orderBy('id', 'desc')->get() as $key => $log)
    {{ $log->log }} {{ $log->created_at->diffForHumans() }} {{ $log->created_at->format(config('app.dateFormat')) }} {{ $log->created_at->format(config('app.timeFormat')) }}
    @endforeach
    @php $questionsJson = [ 'pages' => [ [ 'items' => [ [ 'label' => 'Question 1', 'input' => [ 'type' => 'text', 'value' => 'Sample answer', ], 'id' => 1, ], [ 'label' => 'Question 2', 'input' => [ 'type' => 'email', 'value' => 'example@example.com', ], 'id' => 2, ], ], ], ], ]; @endphp
    @php $record = $shared_case->case->link_case_with_form; $updated_records = $record->all_linked_records()->last(); if (isset($updated_records->raw_form)) { $questionsJson = json_decode($updated_records->raw_form, true); } else { $questionsJson = json_decode($record->raw_form, true); } $data_objects = []; if ($record->raw_form) { $questionIds = json_decode($shared_case->question_ids, true); if (is_array($questionIds)) { foreach ($questionsJson['pages'] as $page) { if (isset($page['items']) && count($page['items']) > 0) { foreach ($page['items'] as $item) { if ( isset( $item['label'], $item['input'], $item['input']['type'], $item['input']['value'] ) && in_array($item['id'], $questionIds) ) { $type = $item['input']['type']; $value = $item['input']['value']; switch ($type) { case 'text': case 'email': case 'phone': case 'textarea': $data_objects[] = [ 'label' => $item['label'], 'value' => $value, ]; break; case 'number': $data_objects[] = [ 'label' => $item['label'], 'value' => $value, ]; break; case 'date': $date = date('Y-m-d', strtotime($value)); $data_objects[] = [ 'label' => $item['label'], 'value' => $date, ]; break; case 'time': $time = date('H:i', strtotime($value)); $data_objects[] = [ 'label' => $item['label'], 'value' => $time, ]; break; case 'radio': $data_objects[] = [ 'label' => $item['label'], 'value' => $value, ]; break; case 'checkbox': $data_objects[] = [ 'label' => $item['label'], 'value' => implode(', ', $value), ]; break; case 'select': if (is_array($value)) { $data_objects[] = [ 'label' => $item['label'], 'value' => isset($value['val']) ? $value['val'] : (isset($value['text']) ? $value['text'] : ' '), ]; } else { $data_objects[] = [ 'label' => $item['label'], 'value' => $value, ]; } break; case 'dmd': $records = $item['input']['records'] ?? []; $dmd_values = []; foreach ($records as $record2) { $vtm = $record2['vtm']['vtm_string'] ?? ''; $vmp = $record2['vmp']['vp_string'] ?? ''; $other = $record2['other'] ?? ''; $dmd_values[] = implode( ', ', array_filter([$vtm, $vmp, $other]), ); } if (!empty($dmd_values)) { $data_objects[] = [ 'label' => $item['label'], 'value' => implode('; ', $dmd_values), ]; } break; } } } } } } } @endphp
    @foreach ($data_objects as $data)

    {{ $data['label'] }}

    {{ $data['value'] }}

    @endforeach
    @if(count($shared_case->extension))
    @php $extension = $shared_case->extension->last(); @endphp {{$extension->requested_by_user->name}} requested extension {{$extension->created_at->diffForHumans()}} {{$extension->created_at->format(config('app.dateFormat'))}} {{$extension->created_at->format(config('app.timeFormat'))}}
    Extension Request until {{$extension->extension_time->format(config('app.dateFormat'))}} {{$extension->extension_time->format(config('app.timeFormat'))}} (additional {{$extension->extension_time->diffForHumans()}})
    {!! $extension->note !!}
    @endif @if (!count($shared_case->communications))

    No comments are found!

    @else @endif @foreach ($shared_case->communications as $key => $comment) @include( 'user.view_comments', compact('comment')) @endforeach
    @include('user.form_comment', [ 'shared_case' => $shared_case, ])
    @if ($shared_case->is_log_viewable)
    @foreach($shared_case->case->comments->reverse() as $key=> $comment) @include('head_office.case_manager.notes.view_comments',compact('comment')) @endforeach
    @endif
    @endsection @section('scripts') @endsection