where('status', '=', '1')->get()); ?>
                            
                            
                                {!! Form::open(['route'=>'select_all','method'=>'post']) !!}
                                
                                
                                    Loading...
                                    
                                    
                                        
                                        |  | {!! Lang::get('lang.subject') !!} | {!! Lang::get('lang.ticket_id') !!} | {!! Lang::get('lang.priority') !!} | {!! Lang::get('lang.last_replier') !!} | {!! Lang::get('lang.assigned_to') !!} | {!! Lang::get('lang.last_activity') !!}where('status', '=', '1')->orderBy('id', 'DESC')->paginate(20); ?>
                                            @foreach ($tickets  as $ticket) | seen_by == null) { ?> style="color:green;"  >
                                                | id)->get();
                                                $collab = count($collaborators);
                                                //  title
                                                $title = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->first();
                                                $string = strip_tags($title->title);
                                                // check atatchments
                                                $attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('thread_id', '=', $title->id)->count();
                                                $attach = $attachments;
                                                if (strlen($string) > 40) {
                                                    $stringCut = substr($string, 0, 40);
                                                    $string = substr($stringCut, 0, strrpos($stringCut, ' ')) . ' ...';
                                                }
                                                $TicketData = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
                                                $TicketDatarow = App\Model\helpdesk\Ticket\Ticket_Thread::where('id', '=', $TicketData)->first();
                                                $LastResponse = App\User::where('id', '=', $TicketDatarow->user_id)->first();
                                                if ($LastResponse->role == "user") {
                                                    $rep = "#F39C12";
                                                    $username = $LastResponse->user_name;
                                                } else {
                                                    $rep = "#000";
                                                    $username = $LastResponse->first_name . " " . $LastResponse->last_name;
                                                    if ($LastResponse->first_name == null || $LastResponse->last_name == null) {
                                                        $username = $LastResponse->user_name;
                                                    }
                                                }
                                                $titles = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->get();
                                                $count = count($titles);
                                                foreach ($titles as $title) {
                                                    $title = $title;
                                                }
                                                $assigned_to = App\User::where('id', '=', $ticket->assigned_to)->first();
                                                if ($assigned_to == null) {
                                                    $assigned = "Unassigned";
                                                } else {
                                                    $assigned = $assigned_to->first_name . " " . $assigned_to->last_name;
                                                }
                                                ?> | {{$string}}    ({!! $count!!}) 
                                                    @if($collab > 0) @endif 
                                                    @if($attach > 0) @endif | #{!! $ticket->ticket_number !!}priority_id)->first(); ?> | @if($priority != null){{$priority->priority}}@endifuser_id)->first(); ?> | {!! $username !!} | {!! $assigned !!} | {!! UTC::usertimezone($title->updated_at) !!} | 
                                        @endforeach
                                        
                                    
                                    
                                        setPath(url('/organizations/' . $orgs->id))->render(); ?> 
                                    
                                 
                                {!! Form::close() !!}
                                {{-- end deleted tickets --}}
                            
                            {{-- open tab --}}
                            where('status', 2)->get()); ?>
                            
                            
                                {!! Form::open(['route'=>'select_all','method'=>'post']) !!}
                                
                                
                                    Loading...
                                    
                                    
                                        
                                        |  | {!! Lang::get('lang.subject') !!} | {!! Lang::get('lang.ticket_id') !!} | {!! Lang::get('lang.priority') !!} | {!! Lang::get('lang.last_replier') !!} | {!! Lang::get('lang.assigned_to') !!} | {!! Lang::get('lang.last_activity') !!}where('status', '=', '2')->orderBy('id', 'DESC')->paginate(20); ?>
                                            @foreach ($tickets  as $ticket) | seen_by == null) { ?> style="color:green;"  >
                                                | id)->get();
                                                $collab = count($collaborators);
                                                //  title
                                                $title = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->first();
                                                $string = strip_tags($title->title);
                                                // check atatchments
                                                $attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('thread_id', '=', $title->id)->first();
                                                // dd($attachments);
                                                $attach = ($attachments) ? count($attachments->toArray()): 0;
                                                if (strlen($string) > 40) {
                                                    $stringCut = substr($string, 0, 40);
                                                    $string = substr($stringCut, 0, strrpos($stringCut, ' ')) . ' ...';
                                                }
                                                $TicketData = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
                                                $TicketDatarow = App\Model\helpdesk\Ticket\Ticket_Thread::where('id', '=', $TicketData)->first();
                                                $LastResponse = App\User::where('id', '=', $TicketDatarow->user_id)->first();
                                                if ($LastResponse->role == "user") {
                                                    $rep = "#F39C12";
                                                    $username = $LastResponse->user_name;
                                                } else {
                                                    $rep = "#000";
                                                    $username = $LastResponse->first_name . " " . $LastResponse->last_name;
                                                    if ($LastResponse->first_name == null || $LastResponse->last_name == null) {
                                                        $username = $LastResponse->user_name;
                                                    }
                                                }
                                                $titles = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->get();
                                                $count = count($titles);
                                                foreach ($titles as $title) {
                                                    $title = $title;
                                                }
                                                $assigned_to = App\User::where('id', '=', $ticket->assigned_to)->first();
                                                if ($assigned_to == null) {
                                                    $assigned = "Unassigned";
                                                } else {
                                                    $assigned = $assigned_to->first_name . " " . $assigned_to->last_name;
                                                }
                                                ?> | {{$string}}    ({!! $count!!}) 
                                                    @if($collab > 0) @endif 
                                                    @if($attach > 0) @endif | #{!! $ticket->ticket_number !!}priority_id)->first(); ?> | @if($priority != null){{$priority->priority}}@endifuser_id)->first(); ?> | {!! $username !!} | {!! $assigned !!} | {!! UTC::usertimezone($title->updated_at) !!} | 
                                        @endforeach
                                        
                                    
                                    
                                        setPath(url('/organizations/' . $orgs->id))->render(); ?> 
                                    
                                 
                                {!! Form::close() !!}
                                {{-- end deleted tickets --}}
                            
                            {{-- open tab --}}
                            where('status', '=', '5')->get()); ?>
                            
                                {!! Form::open(['route'=>'select_all','method'=>'post']) !!}
                                
                                
                                    Loading...
                                    
                                    
                                        
                                        |  | {!! Lang::get('lang.subject') !!} | {!! Lang::get('lang.ticket_id') !!} | {!! Lang::get('lang.priority') !!} | {!! Lang::get('lang.last_replier') !!} | {!! Lang::get('lang.assigned_to') !!} | {!! Lang::get('lang.last_activity') !!}where('status', '=', '5')->orderBy('id', 'DESC')->paginate(20); ?>
                                            @foreach ($tickets  as $ticket) | seen_by == null) { ?> style="color:green;"  >
                                                | id)->get();
                                                $collab = count($collaborators);
                                                //  title
                                                $title = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->first();
                                                $string = strip_tags($title->title);
                                                // check atatchments
                                                $attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('thread_id', '=', $title->id)->count();
                                                $attach = $attachments;
                                                if (strlen($string) > 40) {
                                                    $stringCut = substr($string, 0, 40);
                                                    $string = substr($stringCut, 0, strrpos($stringCut, ' ')) . ' ...';
                                                }
                                                $TicketData = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
                                                $TicketDatarow = App\Model\helpdesk\Ticket\Ticket_Thread::where('id', '=', $TicketData)->first();
                                                $LastResponse = App\User::where('id', '=', $TicketDatarow->user_id)->first();
                                                if ($LastResponse->role == "user") {
                                                    $rep = "#F39C12";
                                                    $username = $LastResponse->user_name;
                                                } else {
                                                    $rep = "#000";
                                                    $username = $LastResponse->first_name . " " . $LastResponse->last_name;
                                                    if ($LastResponse->first_name == null || $LastResponse->last_name == null) {
                                                        $username = $LastResponse->user_name;
                                                    }
                                                }
                                                $titles = App\Model\helpdesk\Ticket\Ticket_Thread::where('ticket_id', '=', $ticket->id)->get();
                                                $count = count($titles);
                                                foreach ($titles as $title) {
                                                    $title = $title;
                                                }
                                                $assigned_to = App\User::where('id', '=', $ticket->assigned_to)->first();
                                                if ($assigned_to == null) {
                                                    $assigned = "Unassigned";
                                                } else {
                                                    $assigned = $assigned_to->first_name . " " . $assigned_to->last_name;
                                                }
                                                ?> | {{$string}}    ({!! $count!!}) 
                                                    @if($collab > 0) @endif 
                                                    @if($attach > 0) @endif | #{!! $ticket->ticket_number !!}priority_id)->first(); ?> | @if($priority != null){{$priority->priority}}@endifuser_id)->first(); ?> | {!! $username !!} | {!! $assigned !!} | {!! UTC::usertimezone($title->updated_at) !!} | 
                                        @endforeach
                                        
                                    
                                    
                                        setPath(url('/organizations/' . $orgs->id))->render(); ?> 
                                    
                                 
                                {!! Form::close() !!}