@extends('layouts.main') @section('customcss') @endsection @section('pagecontent') @php $timeline = [1 => 'bg-success', 2 => 'bg-primary', 3 => 'bg-danger']; $timeline2 = [1 => 'text-success', 2 => 'text-primary', 3 => 'text-danger']; $action = [1 => ['en' => 'Created', 'es' => 'Creado'], 2 => ['en' => 'Updated', 'es' => 'Actualizado'], 3 => ['en' => 'Deleted', 'es' => 'Eliminado']]; function time2str($ts) { if(!ctype_digit($ts)) { $ts = strtotime($ts); } $diff = time() - $ts; if($diff == 0) { return 'now'; } elseif($diff > 0) { $day_diff = floor($diff / 86400); if($day_diff == 0) { if($diff < 60) return 'Just now'; if($diff < 120) return '1 minute ago'; if($diff < 3600) return floor($diff / 60) . ' minutes ago'; if($diff < 7200) return '1 hour ago'; if($diff < 86400) return floor($diff / 3600) . ' hours ago'; } if($day_diff == 1) { return 'Yesterday'; } if($day_diff < 7) { return $day_diff . ' days ago'; } if($day_diff < 31) { return ceil($day_diff / 7) . ' weeks ago'; } if($day_diff < 60) { return 'last month'; } return date('F Y', $ts); } else { $diff = abs($diff); $day_diff = floor($diff / 86400); if($day_diff == 0) { if($diff < 120) { return 'in a minute'; } if($diff < 3600) { return 'in ' . floor($diff / 60) . ' minutes'; } if($diff < 7200) { return 'in an hour'; } if($diff < 86400) { return 'in ' . floor($diff / 3600) . ' hours'; } } if($day_diff == 1) { return 'Tomorrow'; } if($day_diff < 4) { return date('l', $ts); } if($day_diff < 7 + (7 - date('w'))) { return 'next week'; } if(ceil($day_diff / 7) < 4) { return 'in ' . ceil($day_diff / 7) . ' weeks'; } if(date('n', $ts) == date('n') + 1) { return 'next month'; } return date('F Y', $ts); } } @endphp

@lang('sistema.bitacora.bitacora_lbl')

{{ csrf_field() }}
@if(isset($history) && count($history) > 0)
@foreach($history as $history_date => $history) @foreach($history as $history_arr)
@if($history_date == date('d-m-Y'))

{{ time2str($history_arr->created_at->format('Y-m-d H:i:s')) }}

@endif

{{ $history_arr->created_at->format('H:i a') }}

{{ $action[$history_arr->action_type][session('language')] }}: {{ __('sistema.model.' . $history_arr->model_name) }}

@php $json_data = json_decode($history_arr->extra,true); $this_model_name = 'App\\Models\\' . $history_arr->model_name; $this_model = new $this_model_name; @endphp

@foreach($json_data as $keyId => $jd)
@php if(in_array($jd['fieldlabel'], ['status', 'estatus'])) { if($jd['newvalue'] == 1) { $jd['newvalue'] = __('sistema.active'); } else { $jd['newvalue'] = __('sistema.active'); } if($jd['oldvalue'] == 1) { $jd['oldvalue'] = __('sistema.active'); } else { $jd['oldvalue'] = __('sistema.active'); } } @endphp

@if($history_arr->action_type == 2) @if($jd['fk']) @lang('sistema.old_value'): {{ $jd['oldValueLbl_' . session('language')] }} @else @lang('sistema.old_value'): {{ $jd['oldvalue'] }} @endif
@endif @if($history_arr->action_type == 3) @if($jd['fk']) {{ $jd['newValueLbl_' . session('language')] }} @else {{ $jd['newvalue'] }} @endif @elseif($history_arr->action_type == 1) @if($jd['fk']) {{ $jd['newValueLbl_' . session('language')] }} @else Value: {{ $jd['newvalue'] }} @endif @else @if($jd['fk']) @lang('sistema.new_value'): {{ $jd['newValueLbl_' . session('language')] }} @else @lang('sistema.new_value'): {{ $jd['newvalue'] }} @endif @endif

@endforeach
@lang('sistema.model.User'): {{ $history_arr->usuario_name }}
@endforeach @endforeach
@else

@lang('sistema.trade_report.no_data')

@endif
@endsection @section('customjs') @if (session('msg')) @endif @endsection