@extends('panel.layouts.master') @section('content')
گپ تایم ها
@can('admin') سینک مشاوران @endcan
@csrf
@php $i = 0; @endphp @foreach($data as $key => $item) @php $i++; $newMsg = 0; $lastChild = $item->childs()->orderByDesc('id')->first(); if(\Illuminate\Support\Facades\Gate::allows('adviser')){ $newMsg = $item->childs()->whereNot('send_id', $authUser->id)->whereNull('read_at')->count(); }else{ if($lastChild){ if($lastChild->sender->role != 'adviser'){ $newMsg = $item->childs()->whereNull('read_at')->count(); } } } if($lastChild){ $userNewMsg = $lastChild->sender->role == 'user' && is_null($lastChild->read_at); $adviserNewMsg = $lastChild->sender->role == 'adviser' && is_null($lastChild->read_at); } $stauts = ''; $bgColor = ''; if($lastChild && $adviserNewMsg){ $stauts = 'پاسخ داده شده '; $bgColor = 'info'; }elseif($lastChild && $userNewMsg){ $stauts = 'پیام جدید'; $bgColor = 'danger'; }else{ $stauts = 'آماده گفتگو '; $bgColor = 'warning'; } @endphp @endforeach
ردیف فرستنده گیرنده کد تاریخ ایجاد تاریخ آخرین پیام وضعیت عملیات
{{ $i }} @if($newMsg > 0)
{{ $newMsg }}
@endif {{ $item->sender->full_name }}
{{ $item->receiver->full_name }} {{ $item->code }}
{{ verta($item->created_at)->format('H:i Y/m/d') }}
{{ $lastChild ? verta($lastChild->created_at)->format('H:i Y/m/d') : '-' }}
{{ $stauts }}
{{ $data->appends(Request::all())->links() }}
@endsection @section('script') @endsection