<div class="single_radius_item" style="@if($notification->read_at == null) background: #f5f4fd; @else background: #fff; @endif">
    <i class="fa fa-ticket"></i>
    
    @if(Auth::guard('agent')->user())
    <span>
        <a href="{{url('/agent/token-details',$notification['data']['ticket']['id'])}}" onclick="markAsRead('{{$notification->id}}');" class="link_hover">
            Token: 
            @if($notification['data']['action_type'] =='Open')
               #{{$notification['data']['ticket']['ticket_number']}}
            @endif 
            @if($notification['data']['action_type'] =='Start')
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif
            @if($notification['data']['action_type'] =='Finish') 
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif
            @if($notification['data']['action_type'] =='Close') 
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif
            @if($notification['data']['action_type']=='Reopen') 
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif 
            @if($notification['data']['action_type']=="Comment") 
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif
        </a>
        <br>
        @if($notification['data']['action_type'] =='Open')
           Your token has been created by SAMS GLOBAL.
        @endif
        @if($notification['data']['action_type'] =='Start')
            Your token has started.
        @endif
        @if($notification['data']['action_type'] =='Finish') 
            Your token has fixed.
        @endif
        @if($notification['data']['action_type'] =='Close') 
            Your token has close.
        @endif
        @if($notification['data']['action_type']=='Reopen') 
            Your token has reopen.
        @endif
        @if($notification['data']['action_type']=="Comment") 
            A comment in this token.
        @endif
        <br>
        <small>{{ date('d M Y',strtotime($notification->created_at)) }}, {{ date('H:i A',strtotime($notification->created_at)) }}</small>
    </span>
    @elseif(Auth::guard('franchise')->user())
    <span>
        <a href="{{url('/franchise/token-details',$notification['data']['ticket']['id'])}}" onclick="markAsRead('{{$notification->id}}');" class="link_hover">
            Token: 
            @if($notification['data']['action_type'] =='Start')
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif
            @if($notification['data']['action_type'] =='Finish') 
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif
            @if($notification['data']['action_type'] =='Close') 
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif
            @if($notification['data']['action_type']=='Reopen') 
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif 
            @if($notification['data']['action_type']=="Comment") 
                #{{$notification['data']['ticket']['ticket_number']}}
            @endif
        </a>
        <br>
        @if($notification['data']['action_type'] =='Start')
            Your token has started.
        @endif
        @if($notification['data']['action_type'] =='Finish') 
            Your token has fixed.
        @endif
        @if($notification['data']['action_type'] =='Close') 
            Your token has close.
        @endif
        @if($notification['data']['action_type']=='Reopen') 
            Your token has reopen.
        @endif
        @if($notification['data']['action_type']=="Comment") 
            A comment in this token.
        @endif
        <br>
        <small>{{ date('d M Y',strtotime($notification->created_at)) }}, {{ date('H:i A',strtotime($notification->created_at)) }}</small>
    </span>
    @elseif(Auth::guard('admin')->user())
    <span>
        <a href="{{url('/admin/manage-tickets/ticket-details',$notification['data']['ticket']['id'])}}" onclick="markAsRead('{{$notification->id}}');" class="link_hover">
            Token: #{{$notification['data']['ticket']['ticket_number']}}
        </a>
        <br>
        @if($notification['data']['action_type'] =='Open' && $notification['data']['ticket']['creator_franchise_id'] !='')
        @php 
           $company_name = model('Company')::where('id',$notification['data']['ticket']['company_id'])->select('name')->first();
        @endphp
        @if($company_name)
            <b>{{ $notification['data']['addedBy']['name'] }}</b> created this token for {{ $company_name['name'] }}.
        @endif
        @elseif($notification['data']['action_type'] =='Open')
        @php 
           $company_name = model('Company')::where('id',$notification['data']['ticket']['company_id'])->select('name')->first();
        @endphp
        @if($company_name)
            <b>{{ $notification['data']['addedBy']['name'] }}</b> from {{ $company_name['name'] }} has been created this token.</b>
        @else
        <b>{{ $notification['data']['addedBy']['name'] }}</b> has been created this token.
        @endif
        @endif
        @if($notification['data']['action_type'] =='Assigned')
            <b>{{ $notification['data']['addedBy']['name'] }}</b> assigned you in this token.</b>
        @endif
        @if($notification['data']['action_type'] =='Start') 
            <b>{{ $notification['data']['addedBy']['name'] }}</b> started this token.</b>
        @endif
        @if($notification['data']['action_type'] =='Finish') 
            <b>{{ $notification['data']['addedBy']['name'] }}</b> fixed this token.</b>
        @endif
        @if($notification['data']['action_type'] =='Close') 
            <b>{{ $notification['data']['addedBy']['name'] }}</b> closed this token.</b>
        @endif
        @if($notification['data']['action_type']=="Reopen")
            <b>{{ $notification['data']['addedBy']['name'] }}</b> reopened this token.</b>
        @endif 
        @if($notification['data']['action_type']=="Comment") 
            <b>{{ $notification['data']['addedBy']['name'] }}</b> commented on this token.</b>
        @endif
        <br>
        <small>{{ date('d M Y',strtotime($notification->created_at)) }}, {{ date('H:i A',strtotime($notification->created_at)) }}</small>
    </span>
    @endif
    
</div>


<script type="text/javascript">
    function markAsRead(id) {
         $.post('{{url('')}}/agent/notification/mark-as-read', {'_token': '{{ csrf_token() }}','id': id}, function (data) {
            data.success ? (window.location.href = targetHref) : false;
        }, 'json');

        return false;
    }

    function markAdminAsRead(id) {
         $.post('{{url('')}}/admin/notification/mark-as-read', {'_token': '{{ csrf_token() }}','id': id}, function (data) {
            data.success ? (window.location.href = targetHref) : false;
        }, 'json');

        return false;
    }
</script>