@extends('layouts.app')
@section('content')
<div class="page_wrapper">
    <div class="main_section">

        <div class="breadcrum">
            <button class="report_tab">Reports Settings</button>
            @if(!empty($from_check))
            <button class="email_tab">Email Settings</button>
            @endif
        </div>
        <div class="navs_tabs">
            <ul class="nav nav-pills" id="myTab">
                <li class="active report_hideshow" ><a data-toggle="pill" href="#enable_reports">Enabling Report</a></li>
                <li class="items_hideshow" ><a data-toggle="pill" href="#enable_books">Enabling Books</a></li>
                <li class="email_hideshow"  style="display:none;"><a data-toggle="pill" href="#manage_emails">Manage Emails</a></li>
                <li class="email_send"  style="display:none;"><a data-toggle="pill" href="#send_emails">Email History</a></li>
                <div class="sale_button">
                    <div class="dropdown add_button_2 book_hideshow2">
                    <button type="button" data-toggle="dropdown" aria-expanded="true" class="buttn"></button>
                    <span  data-target="#new_status" data-toggle="modal" class="green_link" style="color:white;cursor: pointer" ><i class="fa fa-plus" aria-hidden="true"></i> New Status</span>
                    </div>

                    <div class="dropdown add_button_2 book_hideshow"   style="display:none;">
                    <button type="button" data-toggle="dropdown" aria-expanded="true" class="buttn"> <i class="fa fa-envelope-o" aria-hidden="true"></i> Email<span class="caret"></span></button>
                    <ul class="dropdown-menu">
                        <li>
                            <span  data-target="#new_content" data-toggle="modal"><i class="fa fa-plus" aria-hidden="true"></i> New Template</span>
                        </li>
                        @if(!$email_send_data->isEmpty())
                        <li>
                           <span data-target="#pop_email" data-toggle="modal"><i class="fa fa-paper-plane-o" aria-hidden="true"></i> Send Email</span>
                        </li>
                        @endif
                    </ul>
                    <!-- <span  data-target="#new_content" data-toggle="modal" style="color:white" class="green_link"><i class="fa fa-plus" aria-hidden="true"></i> New Content</span> -->
                    </div>

                </div>

            </ul>
        </div>

        @if(session()->has('mysuccess'))
        <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="alert alert alert-success alert-dismissable fade in">
        <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>{{session()->get('mysuccess')}}</div>
        </div>
        @endif

        @if(session()->has('myerror'))
        <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="alert alert alert-danger alert-dismissable fade in">
        <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>{{session()->get('myerror')}}</div>
        @endif

        
        <div class="tab-content">
            <!-- FIRST TAB -->
            <div id="enable_reports" class="tab-pane fade in active">
                <div class="inner_section"> 
                    <div class="heading_area">
                        <div class="heading_left">
                            <h1>Report Status</h1>
                        </div>
                        <div class="heading_right">
                        </div>
                    </div>
                    @if($reports_status->isEmpty())
                        <div class="empty_state" >
                            <img src="images/upload.png">
                            <h4>No Status Found</h4>
                            <h5>Please enter reports status</h5>
                        </div>
                        <style>
                            .enable_r_status{display:none;}
                        </style>
                    @endif

                    <div class="table_custom enable_r_status">
                        <table>
                            <thead>
                                <tr>
                                    <th>Year</th>
                                    <th>Quarters Enabled</th>
                                    <th>Updated on</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                
                                @foreach($reports_status as $data)
                                <tr>
                                <td>{{$data->year}}</td>
                                <?php 
                               
                                $numeric_qtr = ["1", "2", "3" , "4"];
                                $string_qtr = ["1st Quarter", "2nd Quarter", "3rd Quarter","4th Quarter"];

                                $newPhrase = str_replace($numeric_qtr, $string_qtr, $data->quarters);
                                ?>
                                <td>{{$newPhrase}}</td>
                                <td>{{date("M d, Y", strtotime($data->updated_at))}}</td>
                                <td>
                                    <a  class="green_link up_status" data-type="report_status"  data-id="{{$data->id}}" >
                                        <i class="fa fa-pencil" aria-hidden="true"></i>
                                    </a>

                                    <a href="{{action('SettingsController@delete_status',['del_id'=>$data->id])}}" class="green_link del_status" data-id="{{$data->id}}"><i class="fa fa-trash" aria-hidden="true"></i></a>
                                </td>
                                </tr>
                                @endforeach
                                
                            </tbody>
                        </table>
                    </div>
                </div>

                <div class="pagination_custom paginate_title">
                
                  @if ($reports_status->appends(request()->except('page'))->hasPages())
                        <ul class="pagination">
                        {{-- Previous Page Link --}}
                        @if ($reports_status->appends(request()->except('page'))->onFirstPage())
                            <li class="disabled"><span>&laquo;</span></li>
                        @else
                            <li><a href="{{ $reports_status->appends(request()->except('page'))->previousPageUrl() }}#enable_reports" rel="prev">&laquo;</a></li>
                        @endif

                        @if($reports_status->appends(request()->except('page'))->currentPage() > 3)
                            <li class="hidden-xs"><a href="{{ $reports_status->appends(request()->except('page'))->url(1) }}#enable_reports">1</a></li>
                        @endif
                        @if($reports_status->appends(request()->except('page'))->currentPage() > 4)
                            <li class="disabled hidden-xs"><span>...</span></li>
                        @endif
                        @foreach(range(1, $reports_status->appends(request()->except('page'))->lastPage()) as $i)
                            @if($i >= $reports_status->appends(request()->except('page'))->currentPage() - 2 && $i <= $reports_status->appends(request()->except('page'))->currentPage() + 2)
                                @if ($i == $reports_status->appends(request()->except('page'))->currentPage())
                                    <li class="active"><span>{{ $i }}</span></li>
                                @else
                                    <li><a href="{{ $reports_status->appends(request()->except('page'))->url($i) }}#enable_reports">{{ $i }}</a></li>
                                @endif
                            @endif
                        @endforeach
                        @if($reports_status->appends(request()->except('page'))->currentPage() < $reports_status->appends(request()->except('page'))->lastPage() - 3)
                            <li class="disabled hidden-xs"><span>...</span></li>
                        @endif
                        @if($reports_status->appends(request()->except('page'))->currentPage() < $reports_status->appends(request()->except('page'))->lastPage() - 2)
                            <li class="hidden-xs"><a href="{{ $reports_status->appends(request()->except('page'))->url($reports_status->appends(request()->except('page'))->lastPage()) }}#enable_reports">{{ $reports_status->appends(request()->except('page'))->lastPage() }}</a></li>
                        @endif

                        {{-- Next Page Link --}}
                        @if ($reports_status->appends(request()->except('page'))->hasMorePages())
                            <li><a href="{{ $reports_status->appends(request()->except('page'))->nextPageUrl() }}#enable_reports" rel="next">&raquo;</a></li>
                        @else
                            <li class="disabled"><span>&raquo;</span></li>
                        @endif
                        </ul>
                    @endif
                    <!--  <ul>
                    </ul> -->
                </div>
            </div>

            <!-- FIRST TAB SUB BOOK-->
            <div id="enable_books" class="tab-pane fade in active">
                <div class="inner_section"> 
                    <div class="heading_area">
                        <div class="heading_left">
                            <h1>Enabling books</h1>
                        </div>
                        <div class="heading_right">
                            <!-- search -->
                            <div class="search_section bookreport_search">

                                <!-- reset button -->
                                <div class="resetbutton resetbtn_class"><span  data-toggle="tooltip" data-placement="top" data-title='Reset Search' data-html="true"><i class="fa fa-refresh" aria-hidden="true"></i></span></div>

                                <div class="resetbutton_empty resetbtn_class" style="display:none"><a href="javascript:window.location.reload(true)"><span  data-toggle="tooltip" data-placement="top" data-title='Reset Search' data-html="true"><i class="fa fa-refresh" aria-hidden="true"></i></span></a></div>

                                <input placeholder="Press Enter to Search.." type="search" name="search" id="booksearch"  value="<?php if(isset($_GET['searched_val'])){echo $_GET['searched_val'];} if(isset($searched_item3)){echo $searched_item3;} if(session()->has('searched_item3')){echo session()->get('searched_item3');}?>"/>
                                
                                <input type="submit" value="Search" name="seachbook"/>
                                <span class="search_btn"></span>
                                <div class="input_container search_container">
                                    <span class="search_span">Please add an entry</span>
                                </div>
                            </div>
                            <!--end search-->
                        </div>
                    </div>
                    @if($reports_status->isEmpty())
                        <div class="empty_state" >
                            <img src="images/upload.png">
                            <h4>No Status Found</h4>
                            <h5>Please enter reports status</h5>
                        </div>
                        <style>
                            .book_table{display:none;}
                        </style>
                    @endif
                    @if(session()->has('nothingfound_book'))
                    <div class="empty_state" >
                        <img src="images/upload.png">
                        <h4>No Data Found</h4>
                        <h5>{{ session()->get('nothingfound_book') }}</h5>
                    </div>
                    <style>
                        .paginate_book,.book_table{display:none;}
                        .resetbutton_empty{display:inline-block !important;}
                        .resetbutton{display:none!important;}
                        
                    </style>
                    @endif

                    <div class="table_custom book_table">
                        <table>
                            <thead>
                                <tr>
                                    <th>S.No.</th>
                                    <th>Book Title</th>
                                    <th>Status</th>
                                    <th>Disabled On</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $i = $bookdata->perPage() * ($bookdata->currentPage() - 1); 
                                ?>
                                @foreach($bookdata as $data)
                                <tr>
                                    <td><?php $i++;?>{{$i}}.</td>

                                    <!-- Book title -->
                                    <td>
                                    <?php

                                    $link_book =  $data->book_title;

                                    if(strpos($link_book, '#') !== false && strpos($link_book, '&') !== false) {
                                       $link_book =  str_replace("#", "%23", $link_book);
                                       $link_book =  str_replace("&", "%26", $link_book);
                                    }

                                    elseif(strpos($link_book, '#') !== false && strpos($link_book, '&') === false ) {

                                        $link_book =  str_replace("#", "%23", $link_book);

                                    }elseif(strpos($link_book, '&') !== false  && strpos($link_book,  '#') === false ){
                                       $link_book =  str_replace("&", "%26", $link_book);
                                    }

                                    $total_length = strlen($data->book_title);

                                    if($total_length > 30){ 
                                    $booktitl = substr($data->book_title, 0, 30);

                                    ?>

                                    <a class="blue_link" href="<?php echo url('/'); ?>/booklist?searched_val=<?php echo $link_book; ?>&con=1&opr=1" target="_blank" data-toggle="tooltip" data-title="{{ $data->book_title}}" data-html="true">{{$booktitl}}...
                                    </a>

                                    <?php }else{?>

                                    <a class="blue_link" href="<?php echo url('/'); ?>/booklist?searched_val=<?php echo $link_book; ?>&con=1&opr=1" target="_blank">{{$data->book_title}}
                                    </a>

                                    <?php } ?>
                                    </td>

                                    <!-- book title ends here-->

                                    <td>

                                    <?php 

                                    if(!empty($data->disabled_Book)) {?>

                                        <input type="checkbox" id="check_box_{{$data->id}}" class="disable_check" data-b_id="{{$data->id}}" />

                                    <?php
                                    }else{?>

                                        <input type="checkbox" id="check_box_{{$data->id}}" class="disable_check" data-b_id="{{$data->id}}" checked="checked" />

                                    <?php } ?>

                                    </td>
                                    <td id="update_{{$data->id}}">
                                        
                                        @if(!empty($data->updated_disabled))
                                        
                                        {{date("d M, Y", strtotime($data->updated_disabled))}}
                                        @else
                                        -
                                        @endif
                                    </td>
                                </tr>
                                @endforeach

                            </tbody>
                        </table>
                    </div>
                </div>

                <div class="pagination_custom paginate_book">
                
                  @if ($bookdata->appends(request()->except('page'))->hasPages())
                        <ul class="pagination">
                        {{-- Previous Page Link --}}
                        @if ($bookdata->appends(request()->except('page'))->onFirstPage())
                            <li class="disabled"><span>&laquo;</span></li>
                        @else
                            <li><a href="{{ $bookdata->appends(request()->except('page'))->previousPageUrl() }}#enable_books" rel="prev">&laquo;</a></li>
                        @endif

                        @if($bookdata->appends(request()->except('page'))->currentPage() > 3)
                            <li class="hidden-xs"><a href="{{ $bookdata->appends(request()->except('page'))->url(1) }}#enable_books">1</a></li>
                        @endif
                        @if($bookdata->appends(request()->except('page'))->currentPage() > 4)
                            <li class="disabled hidden-xs"><span>...</span></li>
                        @endif
                        @foreach(range(1, $bookdata->appends(request()->except('page'))->lastPage()) as $i)
                            @if($i >= $bookdata->appends(request()->except('page'))->currentPage() - 2 && $i <= $bookdata->appends(request()->except('page'))->currentPage() + 2)
                                @if ($i == $bookdata->appends(request()->except('page'))->currentPage())
                                    <li class="active"><span>{{ $i }}</span></li>
                                @else
                                    <li><a href="{{ $bookdata->appends(request()->except('page'))->url($i) }}#enable_books">{{ $i }}</a></li>
                                @endif
                            @endif
                        @endforeach
                        @if($bookdata->appends(request()->except('page'))->currentPage() < $bookdata->appends(request()->except('page'))->lastPage() - 3)
                            <li class="disabled hidden-xs"><span>...</span></li>
                        @endif
                        @if($bookdata->appends(request()->except('page'))->currentPage() < $bookdata->appends(request()->except('page'))->lastPage() - 2)
                            <li class="hidden-xs"><a href="{{ $bookdata->appends(request()->except('page'))->url($bookdata->appends(request()->except('page'))->lastPage()) }}#enable_books">{{ $bookdata->appends(request()->except('page'))->lastPage() }}</a></li>
                        @endif

                        {{-- Next Page Link --}}
                        @if ($bookdata->appends(request()->except('page'))->hasMorePages())
                            <li><a href="{{ $bookdata->appends(request()->except('page'))->nextPageUrl() }}#enable_books" rel="next">&raquo;</a></li>
                        @else
                            <li class="disabled"><span>&raquo;</span></li>
                        @endif
                        </ul>
                    @endif
                    <!--  <ul>
                    </ul> -->
                </div>
            </div>

            <!--SECOND TAB-->
            
            <div id="manage_emails" class="tab-pane fade">
                
                <div class="inner_section"> 
                    <div class="heading_area">
                        <div class="heading_left">
                            <h1>Email Content</h1>
                        </div>
                        <div class="heading_right">
                        </div>
                    </div>
                    @if($email_content->isEmpty())
                        <div class="empty_state" >
                            <img src="images/upload.png">
                            <h4>No Templates Found</h4>
                            <h5>Please add email templates</h5>
                        </div>
                        <style>
                            .show_templates_table{display:none;}
                        </style>
                    @endif
                    
                    <div class="table_custom show_templates_table">
                        <table>
                            <thead>
                                <tr>
                                    <th>Email Type</th>
                                    <th>Subject</th>
                                    <th>Email Content</th>
                                    <th>Added on</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                
                                @foreach($email_content as $ec)
                                <tr>
                                    <td>{{$ec->type_name}}</td>
                                    <td>{{$ec->email_title}}</td>
                                    <?php 
                                    $content = preg_replace('/<br\s?\/?>/ius', "\n", str_replace("\n","",str_replace("\r","", htmlspecialchars_decode($ec->email_content))));
                                    ?>

                                    <td>
                                        <span class="blue_link tooltip_content" data-toggle="tooltip" data-placement="top" data-html="true" data-title="" title="{{$ec->email_content}}">
                                        @if (strlen($content) > 25)
                                        {{substr($content, 0,25)}}...
                                        @else
                                        {{$content}}
                                        @endif
                                        </span>
                                    </td>
                                    <td>
                                    {{date_format(date_create($ec->updated_at),"d M, Y")}}
                                    </td>
                                    <td>
                                        <a  class="green_link up_status"  data-id="{{$ec->id}}" data-type="email_content" ><i class="fa fa-pencil" aria-hidden="true"></i>
                                        </a>
                                        <a href="{{action('SettingsController@delete_content',['del_id'=>$ec->id])}}" class="green_link del_content" data-id="{{$ec->id}}"><i class="fa fa-trash" aria-hidden="true"></i></a>
                                    </td>
                                </tr>
                                @endforeach
                                <style>
                                .tooltip_content.tooltip{width:200px;}
                                </style>
                                
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="pagination_custom paginate_title">
                
                  @if ($email_content->appends(request()->except('page'))->hasPages())
                        <ul class="pagination">
                        {{-- Previous Page Link --}}
                        @if ($email_content->appends(request()->except('page'))->onFirstPage())
                            <li class="disabled"><span>&laquo;</span></li>
                        @else
                            <li><a href="{{ $email_content->appends(request()->except('page'))->previousPageUrl() }}#manage_emails" rel="prev">&laquo;</a></li>
                        @endif

                        @if($email_content->appends(request()->except('page'))->currentPage() > 3)
                            <li class="hidden-xs"><a href="{{ $email_content->appends(request()->except('page'))->url(1) }}#manage_emails">1</a></li>
                        @endif
                        @if($email_content->appends(request()->except('page'))->currentPage() > 4)
                            <li class="disabled hidden-xs"><span>...</span></li>
                        @endif
                        @foreach(range(1, $email_content->appends(request()->except('page'))->lastPage()) as $i)
                            @if($i >= $email_content->appends(request()->except('page'))->currentPage() - 2 && $i <= $email_content->appends(request()->except('page'))->currentPage() + 2)
                                @if ($i == $email_content->appends(request()->except('page'))->currentPage())
                                    <li class="active"><span>{{ $i }}</span></li>
                                @else
                                    <li><a href="{{ $email_content->appends(request()->except('page'))->url($i) }}#manage_emails">{{ $i }}</a></li>
                                @endif
                            @endif
                        @endforeach
                        @if($email_content->appends(request()->except('page'))->currentPage() < $email_content->appends(request()->except('page'))->lastPage() - 3)
                            <li class="disabled hidden-xs"><span>...</span></li>
                        @endif
                        @if($email_content->appends(request()->except('page'))->currentPage() < $email_content->appends(request()->except('page'))->lastPage() - 2)
                            <li class="hidden-xs"><a href="{{ $email_content->appends(request()->except('page'))->url($email_content->appends(request()->except('page'))->lastPage()) }}#manage_emails">{{ $email_content->appends(request()->except('page'))->lastPage() }}</a></li>
                        @endif

                        {{-- Next Page Link --}}
                        @if ($email_content->appends(request()->except('page'))->hasMorePages())
                            <li><a href="{{ $email_content->appends(request()->except('page'))->nextPageUrl() }}#manage_emails" rel="next">&raquo;</a></li>
                        @else
                            <li class="disabled"><span>&raquo;</span></li>
                        @endif
                        </ul>
                    @endif
                    <!--  <ul>
                    </ul> -->
                </div>
            </div>

            <!-- SECOND PART OF SECOND TAB -->
            <div id="send_emails" class="tab-pane fade">
                <div class="inner_section"> 
                    <div class="heading_area">
                        <div class="heading_left">
                            <h1>Email History</h1>
                        </div>
                        <div class="heading_right">
                        <!-- form data -->
                        </div>
                    </div>
                    @if($email_history->isEmpty())
                        <div class="empty_state" >
                            <img src="images/upload.png">
                            <h4>No Emails Sent</h4>
                            <h5>Could not find any sent email.</h5>
                        </div>
                        <style>
                            .show_hist_table{display:none;}
                        </style>
                    @endif
                    <div class="table_custom show_hist_table">
                        <table>
                            <thead>
                                <tr>
                                    <th>Email Type</th>
                                    <th>Subject</th>
                                    <th>Recipients</th>
                                    <th>Email Content</th>
                                    <th>Sent On</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach($email_history as $eh)
                                <tr>
                                    <td>{{$eh->email_type}}</td>
                                    <td>{{$eh->email_title}}</td>
                                    <?php 
                                    $contri_id = array();
                                    if (strpos($eh->contributor_id, ',') !== false) {
                                        $contri_id = explode(",",$eh->contributor_id);
                                    }else{
                                        $contri_id[] = $eh->contributor_id;
                                    }

                                    ?>
                                    <td>{{count($contri_id)}}</td>
                                    <?php 
                                    $content = preg_replace('/<br\s?\/?>/ius', "\n", str_replace("\n","",str_replace("\r","", htmlspecialchars_decode($eh->email_content))));
                                    ?>

                                    <td>
                                    <span class="blue_link" data-toggle="tooltip" data-placement="top" data-html="true" data-title="" title="{{$eh->email_content}}">
                                     @if (strlen($content) > 25)
                                    {{substr($content, 0,25)}}...
                                    @else
                                    {{$content}}
                                    @endif
                                    </span>

                                    </td>
                                    <td>
                                        <?php
                                        $date = $eh->created_at;
                                        $dt = new DateTime($date);
                                        echo $dt->format('d M, Y');
                                        ?>
                                    </td>
                                    <td>
                                        <a class="green_link up_status" data-id="{{$eh->id}}" data-type="view_email" ><i data-toggle="tooltip" data-placement="top" data-html="true" data-title='View Email' class="fa fa-eye" aria-hidden="true"></i></a>
                                        

                                        <a href="{{action('SettingsController@delete_status',['del_id_history'=>$eh->id])}}" class="green_link del_status" data-id="{{$eh->id}}"><i data-toggle="tooltip" data-placement="top" data-html="true" data-title='Remove from list'  class="fa fa-trash" aria-hidden="true"></i></a>
                                    </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="pagination_custom paginate_title">
                
                  @if ($email_history->appends(request()->except('page'))->hasPages())
                        <ul class="pagination">
                        {{-- Previous Page Link --}}
                        @if ($email_history->appends(request()->except('page'))->onFirstPage())
                            <li class="disabled"><span>&laquo;</span></li>
                        @else
                            <li><a href="{{ $email_history->appends(request()->except('page'))->previousPageUrl() }}#send_emails" rel="prev">&laquo;</a></li>
                        @endif

                        @if($email_history->appends(request()->except('page'))->currentPage() > 3)
                            <li class="hidden-xs"><a href="{{ $email_history->appends(request()->except('page'))->url(1) }}#send_emails">1</a></li>
                        @endif
                        @if($email_history->appends(request()->except('page'))->currentPage() > 4)
                            <li class="disabled hidden-xs"><span>...</span></li>
                        @endif
                        @foreach(range(1, $email_history->appends(request()->except('page'))->lastPage()) as $i)
                            @if($i >= $email_history->appends(request()->except('page'))->currentPage() - 2 && $i <= $email_history->appends(request()->except('page'))->currentPage() + 2)
                                @if ($i == $email_history->appends(request()->except('page'))->currentPage())
                                    <li class="active"><span>{{ $i }}</span></li>
                                @else
                                    <li><a href="{{ $email_history->appends(request()->except('page'))->url($i) }}#send_emails">{{ $i }}</a></li>
                                @endif
                            @endif
                        @endforeach
                        @if($email_history->appends(request()->except('page'))->currentPage() < $email_history->appends(request()->except('page'))->lastPage() - 3)
                            <li class="disabled hidden-xs"><span>...</span></li>
                        @endif
                        @if($email_history->appends(request()->except('page'))->currentPage() < $email_history->appends(request()->except('page'))->lastPage() - 2)
                            <li class="hidden-xs"><a href="{{ $email_history->appends(request()->except('page'))->url($email_history->appends(request()->except('page'))->lastPage()) }}#send_emails">{{ $email_history->appends(request()->except('page'))->lastPage() }}</a></li>
                        @endif

                        {{-- Next Page Link --}}
                        @if ($email_history->appends(request()->except('page'))->hasMorePages())
                            <li><a href="{{ $email_history->appends(request()->except('page'))->nextPageUrl() }}#send_emails" rel="next">&raquo;</a></li>
                        @else
                            <li class="disabled"><span>&raquo;</span></li>
                        @endif
                        </ul>
                    @endif
                    <!--  <ul>
                    </ul> -->
                </div>
            </div>
        </div>
    </div>
</div>

<!-- add new entry -->
<div class="modal fade custom_modal" id="new_status" role="dialog">
    <div class="modal-dialog modal-lg modal_custom_width_xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><img src="images/cross.png" /></button>
                <h4 class="modal-title">Add Reports Status</h4>
            </div>
            <form action="{{action('SettingsController@update_status')}}" id="update_status" method="POST"> 
            <div class="modal-body">
                

                <table class="contributor_assign_table append__contri_table" style="width:100%">
                    <tbody>
                    <tr>
                        <th>Year</th>
                        <th>Quarters</th>
                    </tr>
                    <tr>
                        <td> 
                            <div class="input_container">
                                <input name="up_year" type="number" min="2017" max="<?php echo date("Y");?>" step="1" value="" placeholder="Enter Year" required/>
                            </div>
                        </td>
                        <td id="append_select"  class="append_qtr">
                            
                        </td>
                    </tr>
                    </tbody>
                </table>               
            </div>
            <div class="modal-footer">
                <input class="popup_btn " type="submit" name="up_st_submit" value="Save">
            </div>
            </form>
        </div> 
    </div>
</div>

<!-- add new entry ends here -->

<!-- update report status pop-up starts-->
<div class="modal fade custom_modal" id="up_status" role="dialog">
    <div class="modal-dialog modal-lg modal_custom_width_xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><img src="images/cross.png" /></button>
                <h4 class="modal-title">Update Reports Status</h4>
            </div>
            <form action="{{action('SettingsController@update_status')}}" id="update_status_exist" method="POST"> 
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <input class="popup_btn " type="submit" name="up_st_submit" value="Update">
            </div>
            </form>
        </div> 
    </div>
</div>
<!-- update report status pop-up ends-->


<!-- new email content pop-up starts-->
<div class="modal fade custom_modal" id="new_content" role="dialog">
    <div class="modal-dialog modal-lg modal_custom_width_xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><img src="images/cross.png" /></button>
                <h4 class="modal-title">Add new email content</h4>
            </div>
            <form action="{{action('SettingsController@save_email_content')}}" id="add_email_content" method="POST" >
                <div class="modal-body">

                <div class="label_field">
                    <label>Email Type</label>
                    <div class="input_container">
                    <select name="email_type" class="email_type" required>  
                        <option value="">Select</option>
                        @foreach($email_types as $e)
                        <option value="{{$e->id}}">{{$e->email_type}}</option>
                        @endforeach
                    </select>
                    </div>
                </div>
                <div class="label_field">
                <label>Subject</label>
                <div class="input_container">
                    <input type="text" name="email_title" class="e_title" required>
                </div>
                </div>
            
                <div class="label_field">
                <label>Email Content</label>
                <div class="input_container">
                    Keywords : 
                    <input type="button" value="creator name" class="new_text_btn" id="new_text" data-keyword="@creator_name">
                    <input type="button" value="email" class="new_text_btn" id="new_emailid" data-keyword="@creator_email" style="display: none">
                    <input type="button" value="password" class="new_text_btn" id="new_pswd" data-keyword="@creator_password" style="display: none">
                    <input type="button" value="link" class="new_text_btn" id="new_link" data-keyword="@login_link" style="display: none">
                    <textarea contenteditable name="email_content" id="new_text_id" class="email_content_txt" required placeholder="Hello Aaron, Your report is ready."></textarea>
                </div>
                </div>
                </div>
                <div class="modal-footer"><input type="submit" value="Save Content" class="save_form_edit_book">
                </div>
            </form>
        </div> 
    </div>
</div>
<!-- new email content pop-up ends-->

<!-- send email pop-up starts-->
<div class="modal fade custom_modal" id="pop_email" role="dialog">
    <div class="modal-dialog modal-lg modal_custom_width_xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><img src="images/cross.png" /></button>
                <h4 class="modal-title">Send Email</h4>
            </div>
           
            <form action="{{action('SettingsController@send_email')}}" id="form_email" method="POST" >
                <div class="modal-body">
                    <div class="label_field">
                        <label>Email Type</label>
                        <div class="input_container select_box max_width100">
                        <select name="email_type_send" id="email_type_send" required>  
                            <option value="" disabled="disabled" selected="selected">Select</option>
                            @foreach($email_send_data as $e)
                            <option value="{{$e->type_id}}">{{$e->type_name}}</option>
                            @endforeach
                        </select>
                        </div>
                    </div>
                    <div class="label_field">
                        <label>Email Template</label>
                        <div class="input_container select_box max_width100">
                        <select name="email_template" id="email_template" required></select>
                        </div>
                    </div>
                    <div class="label_field">
                        <label>Recipient</label>
                        <div class="input_container">
                            <select name="recipient[]" id="recipient" data-live-search="true" multiple ></select>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <input type="submit" name="send_email" value="Send Email" class="save_form_edit_book">
                </div>
            </form>
        </div> 
    </div>
</div>
<!-- send email pop-up ends-->


<input type="hidden" class="home_url" value="<?php echo url('/');?>">
<style>
.report_tab.active, .email_tab.active {
    background-color: #1fb6ff;
    border: 1px solid #1fb6ff;
    color: #fff;
}

.report_tab, .email_tab{
    background-color: #fff;
    color: #414141;
    width: 185px;
    height: 40px;
    border-radius: 5px;
    border: 1px solid rgb(215, 224, 241);
    margin-right: 10px;
    font-weight: 500;
}

.report_tab, .email_tab{
    margin-top: 9px;
    height: 43px !important;
    border-radius: 3px !important;
}

.dropdown-menu>li>span {
    display: block;
    padding: 3px 20px;
    clear: both;
    font-weight: 400;
    line-height: 1.42857143;
    color: #333;
    white-space: nowrap;
}
.book_hideshow span {
    cursor: pointer;
}
.green_link i.fa.fa-eye {
    color: #1FB6FF;
    font-size: 15px;
    margin-right: 10px;
    cursor: pointer;
}
</style>
@endsection
