@if (in_array('contract_date', $activeWidgets) && in_array('contracts', user_modules())) @php $currentDay = \Carbon\Carbon::parse(now(company()->timezone)->toDateTimeString()) ->startOfDay() ->setTimezone('UTC'); @endphp
@if (in_array('admin', user_roles())) @forelse ($contracts as $contract) @php $contractDate = Carbon\carbon::parse($contract->contract_end_date); $diffInDays = $contractDate->copy()->diffForHumans($currentDay); @endphp @if ($contractDate->setTimezone(company()->timezone)->isToday()) @lang('app.today') @elseif($contractDate->diffInDays($currentDay) <= 7) {{ $diffInDays }} @else {{ $diffInDays }} @endif
@if ($contractDate->setTimezone(company()->timezone)->isToday()) @lang('messages.contractMessage') {{ $contractDate->translatedFormat($company->date_format) }} @elseif($contractDate->diffInDays($currentDay) <= 7) @lang('messages.contractMessage') {{ $contractDate->translatedFormat($company->date_format) }} @else @lang('messages.contractMessage') {{ $contractDate->translatedFormat($company->date_format) }} @endif @empty @endforelse
@else @if ($contract) @php $contractDate = Carbon\carbon::parse($contract->contract_end_date); $diffInDays = $contractDate->copy()->diffForHumans($currentDay); @endphp $contractDate->setTimezone(company()->timezone)->isToday(), 'text-warning' => $contractDate->diffInDays($currentDay) <= 7, ])>{{ $contractDate->translatedFormat($company->date_format) }} @if ($contractDate->setTimezone(company()->timezone)->isToday()) @lang('app.today') @elseif($contractDate->diffInDays($currentDay) <= 7) {{ $diffInDays }} @else {{ $diffInDays }} @endif @endif @endif
@endif