<?php

$username = $this->request->session()->read('Auth.User.username');
$auth_member_id = $this->request->session()->read('Auth.User.id');
$img_path = $this->request->session()->read('Auth.User.img_path');
$member_logo = $this->request->session()->read('Auth.User.logo');
$profile_picture = (empty($img_path)) ? $this->request->webroot . "media/companies/default.jpg" : $this->request->webroot . $img_path;

$isRemovedDropDown = true;
if ($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity'] || $_SESSION['hasLS_Fax_Rtg_user']) {
    $isRemovedDropDown = false;
}

if (isset($member_notification['client_note'][$note_client_id]) && $note_client_id > 0) {
    unset($member_notification['client_note'][$note_client_id]);
}
$total_client_message = count($member_notification['client_message']);


$total_client_note = count($member_notification['client_note']);

$total_affiliate_message = count($affiliate_message['affiliate_messages']);


$total_affiliate_note_against_client = count($affiliate_note_against_client);

$remainders = $member_remainder['others']["due"];
$total_unread_remainders = $member_remainder['due_today']["total_unread"] + $member_remainder['others']["total_unread"];
$total_remainders = $member_remainder['due_today']["total_remainder"] + $member_remainder['others']["total_remainder"];
$today_reminders = [];
if (!empty($member_remainder['due_today']["today"])) {
    $today_reminders = $member_remainder['due_today']["today"];
}

if (!empty($member_remainder['due_today']["over"])) {
    $today_reminders += $member_remainder['due_today']["over"];
}

$notes = $member_note['others']["due"];
$total_unread_notes = $member_note['due_today']["total_unread"] + $member_note['others']["total_unread"];
$total_notes = $member_note['due_today']["total_remainder"] + $member_note['others']["total_remainder"];
$today_notes = [];
if (!empty($member_note['due_today']["today"])) {
    $today_notes = $member_note['due_today']["today"];
}

if (!empty($member_note['due_today']["over"])) {
    $today_notes += $member_note['due_today']["over"];
}

?>

<style type="text/css">
    .reminder-part {
        max-height: 200px;
        overflow-y: scroll;
    }

    .name-part {
        color: green;
        position: relative;
        top: 0;
        z-index: 1000;
        background: white;
        padding-top: 0 !important;
    }

    .pkgForm {
        border-bottom: 1px solid #008de1;
    }

    .pkgFormBtn {
        color: #fff;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
        padding: 3px 20px;
        line-height: 24px;

    }

    .pkgFormBtn:hover {
        background: #008de1 none repeat scroll 0 0;
    }

    .dropdown-content-body {
        max-height: 340px;
        overflow-y: auto;
    }

    .dropdown-content-footer {
        display: block;
        padding: 7px;
        text-align: center;
        color: #333333;
    }

    #media-heading-new {
        padding-left: 0;
        color: #009cf9;
        font-weight: bold;
    }

    .width-350.dropdown-menu {
        min-width: 350px;
    }

    .yellow-alert .alert {
        padding-right: 35px !important;
        margin-top: 10px;
        margin-bottom: 0;
        background: #ffb347 !important;
        border-color: #faebcc !important;
        color: white !important;
    }

    .yellow-alert .close {
        font-size: 21px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        color: #000 !important;
        text-shadow: 0 1px 0 #fff !important;
    }

    .yellow-alert .clear {
        line-height: 1 !important;
        color: #000 !important;
        text-shadow: 0 1px 0 #fff !important;
    }

    .ka-main-content {
        overflow: auto;
    }

    .agreement-dropdown-toggle {
        position: relative;
    }

    .agreement-dropdown {
        position: absolute;
        right: 0;
        top: 100%;
        display: none
    }

    .agreement-dropdown-toggle:hover+.agreement-dropdown {
        display: block !important;
    }

    .agreement-dropdown:hover {
        display: block !important;
    }

    .top-title p {
        margin: 0 0 2px;
    }

    #client-contact-loading-img {
        position: absolute;
    }

    .ka-header {
        background: white;
    }

    .bell-notification.dropdown-menu {
        left: -50px !important;
        right: auto !important;
    }

    @media only screen and (max-width: 600px) {
        .bell-notification.dropdown-menu {
            left: auto !important;
            right: -10px !important;
        }

        .bell-notification.width-350 {
            min-width: 250px;
        }
    }

    @media only screen and (max-width: 280px) {
        .bell-notification.dropdown-menu {
            left: 0 !important;
            right: auto !important;
        }

        .bell-notification.width-350 {
            min-width: 200px;
        }
    }
</style>
<style>
    .client-files-modal {}

    #form-table th {
        padding: 0px 20px !important;
        font-size: inherit !important;
    }

    #form-table.table.dataTable tbody th,
    table.dataTable tbody td {
        padding: 8px 10px !important;
        font-weight: 400;
        font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    }

    #from-table.table tbody tr td {
        font-weight: unset !important;
        font-size: unset !important;
        font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
        font-weight: 400 !important;
    }

    .flagstrap button.btn.btn-flat,
    .flagstrap button.btn.btn-flat:hover {
        padding: 0px !important;
        background: #FF440A;
    }

    .flagstrap ul li {
        display: block;
        cursor: pointer;
    }
</style>
<style>
    .direct-chat-msg .direct-chat-text {
        text-align: right;
    }

    .direct-chat-msg.right .direct-chat-text {
        text-align: left;
    }
</style>
<?php
if (!empty($setting['logo_path'])) {
    $logo_path = $setting['logo_path'];
} else {
    $logo_path = 'images/logo/favicon.ico';
}

$client_logo_path = $logo_path;
if (!empty($member_logo)) {
    $client_logo_path = $member_logo;
}
if ((APP_SERVER_HOST_URL == CLIENT_PORTAL_DOMAIN) || (strpos(CLIENT_PORTAL_DOMAIN, $_SERVER['REDIRECT_REDIRECT_SSL_TLS_SNI']) !== false)) {
    //$client_logo_path = "";
    $logo_path = ltrim(CLIENT_PORTAL_LOGO, '/');
    if (isset($_SESSION['client_logo_path'])) {
        $client_logo_path = $_SESSION['client_logo_path'];
    }
}
$client_logo = (file_exists('cmsuser_logo/' . $client_logo_path)) ? $this->request->webroot . 'cmsuser_logo/' . $client_logo_path : $this->request->webroot . $logo_path;

$user_type_name = $this->Common->getCurrentUserType();
$affiliate_user_type = $this->request->session()->read('Auth.User.type');
if($affiliate_user_type == AFFILIATE_USER_TYPE || $affiliate_user_type == 1 || $user_type_name == "EMPLOYEE"){
    $current_member_logo = $this->request->session()->read('Auth.User.member_logo');
    $logo_path_member = "cmsuser_logo/".$current_member_logo;
    if(file_exists( WWW_ROOT.$logo_path_member)){
        $logo_path = $logo_path_member;
    }
    //dd($logo_path_member);exit;
    if(empty($current_member_logo) && APP_SERVER_HOST_URL == CLIENT_PORTAL_DOMAIN){
        $logo_path = CLIENT_PORTAL_LOGO;
    }

    $client_logo = $this->Url->build("/".$logo_path);
}
?>
<div class="container-fluid ka-header">
    <div class="col-sm-2 col-xs-12">
        <img class="img-responsive ka-logo center-block" alt="Login Logo" src="<?php echo $client_logo; ?>" style="max-height:70px;">
    </div>
    <div class="col-sm-9 col-xs-12 text-right">
        <ul class="ka-nav">
            <li class="dropdown svpdf save-pdf-notification-li">
                <?php echo $this->element('common/save_pdf_letter', compact('pdf_letters', 'total_save_letter')); ?>
            </li>
            <li class="dropdown" id="employee-notification">
                <?php echo $this->element('teammessage/employee_notification', compact('total_employee_message', 'employee_info_for_message', 'employee_message')); ?>
            </li>
            <li class="dropdown">
                <a title="Affiliate Note" href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration:none;">
                    <i class="fa fa-folder-o" aria-hidden="true"></i>
                    <span class="badge badge-light" id="affiliate-note-notification-count" style="background-color:#e94b35;position: absolute;"><?php if ($total_affiliate_note_against_client > 0) {
                                                                                                                                                    echo $total_affiliate_note_against_client;
                                                                                                                                                } ?></span>
                    <i style="position: absolute;display:none;" id="reminder-msg-noti" class="fa fa-spinner fa-spin"></i>
                </a>
                <?php if ($total_affiliate_note_against_client > 0) { ?>
                    <div class="dropdown-menu dropdown-content width-350">
                        <div class="dropdown-content-heading">Affliliate Note</div>
                        <ul class="media-list dropdown-content-body">
                            <?php if (!empty($affiliate_note_against_client)) {
                                    foreach ($affiliate_note_against_client as $affiliate_note_id =>  $affiliate_note) {

                                        if ($affiliate_note['client_id'] == $client_id_from_dashboard) {
                                            continue;
                                        }
                                        ?>
                                    <li class="media" id="reminder-list-<?php echo $affiliate_note_id; ?>">
                                        <div class="media-left">
                                            <img src="<?php echo $this->request->webroot; ?>rtgv3/images/placeholder.jpg" class="img-circle img-sm" alt="">
                                            <span class="badge bg-danger-400 media-badge">4</span>
                                        </div>

                                        <div class="media-body">
                                            <a href="<?php echo $this->Url->build('/Client/clientdashboard/' . $affiliate_note['client_id']); ?>#affiliate-note" class="media-heading" id="media-heading-new">
                                                <span class="text-semibold"><?php echo $affiliate_note['title']; ?> </span>
                                            </a>
                                            <span class="text-muted"><?php echo substr(strip_tags($affiliate_note['message']), 0, 15) . " ..."; ?></span>
                                        </div>
                                    </li>
                            <?php
                                    }
                                } ?>
                        </ul>


                    </div>
                <?php } ?>
            </li>
            <li class="dropdown rem reminder-notification-li">
                <?php echo $this->element('reminder/reminder_notification_list', compact('remainders', 'total_unread_remainders', 'total_remainders', 'today_reminders')); ?>
            </li>

            <li class="dropdown rem note-notification-li">
                <?php echo $this->element('note/note_notification_list', compact('notes', 'total_unread_notes', 'total_notes', 'today_notes')); ?>
            </li>


            <li class="dropdown">
                <a title="Notes" href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration:none;">
                    <i class="fa fa-sticky-note-o"></i>
                    <span class="badge badge-light" style="background-color:#e94b35;position: absolute;"><?php if ($total_client_note > 0) {
                                                                                                                echo $total_client_note;
                                                                                                            } ?></span>
                </a>
                <?php if ($total_client_note > 0) { ?>
                    <div class="dropdown-menu dropdown-content width-350">

                        <div class="dropdown-content-heading">Notes</div>
                        <ul class="media-list dropdown-content-body">
                            <?php if (!empty($member_notification['client_note'])) {
                                    foreach ($member_notification['client_note'] as $client_id => $client_message) {
                                        ?>
                                    <li class="media">
                                        <div class="media-left">
                                            <img src="<?php echo $this->request->webroot; ?>rtgv3/images/placeholder.jpg" class="img-circle img-sm" alt="">
                                            <span class="badge bg-danger-400 media-badge">4</span>
                                        </div>
                                        <div class="media-body">
                                            <a href="<?php echo $this->Url->build('/client/clientChat/' . $client_id); ?>" class="media-heading" id="media-heading-new">
                                                <span class="text-semibold"><?php echo $client_message['name']; ?> </span>
                                            </a>
                                            <span class="text-muted"><?php echo $client_message['email']; ?> </span>
                                        </div>
                                    </li>
                            <?php
                                    }
                                } ?>
                        </ul>
                    </div>
                <?php } ?>
            </li>
            <li class="dropdown">
                <a title="Message" href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration:none;">
                    <i class="fa fa-envelope-o"></i>
                    <span id="bage-noti-count" class="badge badge-light total-client_message" style="background-color:#e94b35;position: absolute;"><?php if ($total_client_message > 0) {
                                                                                                                                                        echo $total_client_message;
                                                                                                                                                    } ?></span>
                    <i style="position: absolute;display:none;" id="member-client-msg-noti" class="fa fa-spinner fa-spin"></i>
                </a>
                <?php if ($total_client_message > 0) { ?>
                    <div class="dropdown-menu dropdown-content width-350" id="total_client_message">
                        <div class="dropdown-content-heading">Client Messages</div>
                        <ul class="media-list dropdown-content-body">
                            <?php if (!empty($member_notification['client_message'])) {
                                    foreach ($member_notification['client_message'] as $client_id => $client_message) {
                                        ?>
                                    <li class="media" id="noti-message-<?php echo $client_id; ?>">
                                        <div class="media-left">
                                            <img src="<?php echo $this->request->webroot; ?>rtgv3/images/placeholder.jpg" class="img-circle img-sm" alt="">
                                            <span class="badge bg-danger-400 media-badge">4</span>
                                        </div>
                                        <div class="media-body">
                                            <a onclick="sendClientMemberMessage(<?php echo $client_id; ?>,<?php echo $_SESSION['Auth']['User']['id']; ?>,'modalloading','member-client-msg-noti')" href="#" class="media-heading" id="media-heading-new">
                                                <span class="text-semibold"><?php echo $client_message['name']; ?> </span>
                                            </a>
                                            <span class="text-muted"><?php echo $client_message['email']; ?> </span>
                                        </div>
                                    </li>
                            <?php
                                    }
                                } ?>
                        </ul>


                    </div>
                <?php } ?>

            </li>
            <li class="dropdown" id="affiliate-notification">
                <a title="Affliliate Message" href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration:none;">
                    <i class="fa fa-send-o"></i>
                    <span id="bage-noti-count-affiliate" class="badge badge-light total-affiliate_message" style="background-color:#e94b35;position: absolute;"><?php if ($total_affiliate_message > 0) {
                                                                                                                                                                    echo $total_affiliate_message;
                                                                                                                                                                } ?></span>
                    <i style="position: absolute;display:none;" id="member-affiliate_messagent-msg-noti" class="fa fa-spinner fa-spin"></i>
                </a>
                <?php if ($total_affiliate_message > 0) { ?>
                    <div class="dropdown-menu dropdown-content width-350" id="total_affiliate_message">
                        <div class="dropdown-content-heading">Messages</div>
                        <ul class="media-list dropdown-content-body">
                            <?php if (!empty($affiliate_message['affiliate_info'])) {
                                    foreach ($affiliate_message['affiliate_info'] as $affiliate_id => $affiliate_per_message) {
                                        ?>
                                    <li class="media" id="noti-message-<?php echo $affiliate_id; ?>">
                                        <div class="media-left">
                                            <img src="<?php echo $this->Url->build($affiliate_per_message['image_path']); ?>" class="img-circle img-sm" alt="">
                                            <span class="badge bg-danger-400 media-badge">4</span>
                                        </div>
                                        <div class="media-body">
                                            <a onclick="sendAffiliateMemberMessage(<?php echo $affiliate_id; ?>,<?php echo $this->request->session()->read('Auth.User.id'); ?>,'modalloading','per-affiliate-loader-<?php echo $affiliate_id; ?>')" href="#" class="media-heading" id="media-heading-new">
                                                <span class="text-semibold"><?php echo $affiliate_per_message['name']; ?> </span>
                                            </a>
                                            <span class="text-muted"><?php echo $affiliate_per_message['email']; ?> </span>
                                        </div>
                                    </li>
                            <?php
                                    }
                                } ?>
                        </ul>


                    </div>
                <?php } ?>

            </li>
            <?php
            $checkSupport = 0;

            foreach ($supports as $support) :
                $checkSupport = $checkSupport + 1;
            endforeach;
            if (isset($_SESSION['no_of_yellow']) && $_SESSION['no_of_yellow'] > 0) {
                $supportMsg = $supportMsg + $_SESSION['no_of_yellow'];
            }

            ?>
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration:none;">
                    <i class="fa fa-bell-o"></i>

                    <span class="badge badge-light" style="background-color:#e94b35;position: absolute;"><?php if ($supportMsg > 0) {
                                                                                                                echo $supportMsg;
                                                                                                            } ?></span>

                </a>

                <div class="bell-notification dropdown-menu dropdown-content width-350">

                    <div class="dropdown-content-heading">
                        <div class="row">
                            <div class="col-md-12">
                                <span>You have
                                    <?php
                                    if ($_SESSION['no_of_yellow'] > 0) {
                                        echo $_SESSION['no_of_yellow'];
                                    }
                                    ?>
                                    files to send. Click</span>
                                <span><a href="<?php echo $this->Url->build('/Client/showclientfiles?yellow=1'); ?>" style="text-decoration:underline;padding:0">here</a></span> to review
                            </div>
                        </div>
                        <br />
                        Tickets
                        <ul class="icons-list">
                            <li><a href="<?php echo $this->Url->build('/Supports/add/'); ?>" data-popup="tooltip" title="Add ticket"><i class="fa fa-plus-circle" aria-hidden="true"></i></a></li>
                        </ul>
                    </div>

                    <ul class="media-list dropdown-content-body">
                        <?php
                        $checkDate = '';
                        foreach ($supports as $support) :

                            if (!empty($support->created_on)) {
                                $created = $support->created_on;
                            } else {
                                $created = $support->reply_date;
                            }
                            if (!empty($support->title)) {
                                $time = '';
                                $start_date = new DateTime(date("Y-M-d", strtotime($created)));
                                $since_start = $start_date->diff(new DateTime(date(strtotime("Y-m-d"))));
                                if ($since_start->d == 0) {
                                    $currentDay = 'Today';
                                    $to_time = strtotime($created);
                                    $from_time = strtotime(date("Y-m-d H:i:s"));
                                    $getTime = round(abs($to_time - $from_time) / 60);
                                    if ($getTime > 60) {
                                        $time = round(abs($getTime) / 60) . " hour ago";
                                    } else {
                                        $time = round(abs($to_time - $from_time) / 60) . " minutes ago";
                                    }
                                } else if ($since_start->d == 1) {
                                    $currentDay = 'Yesterday';
                                    $time = date("H:i A", strtotime($created));
                                } else {
                                    $currentDay = date("D", strtotime($created)) . ", " . date("Y-M-d", strtotime($created));
                                    $time = date("H:i A", strtotime($created));
                                }

                                if (($checkDate != $currentDay)) {
                                    ?>

                                    <li class="media date-step content-divider">
                                        <span><?php echo $currentDay ?></span>
                                    </li>
                                <?php $checkDate = $currentDay;
                                        }
                                        ?>
                                <li class="media">
                                    <div class="media-left">
                                        <img src="<?php echo $this->request->webroot; ?>rtgv3/images/placeholder.jpg" class="img-circle img-sm" alt="">
                                        <span class="badge bg-danger-400 media-badge">4</span>
                                    </div>

                                    <div class="media-body">
                                        <a href="<?php echo $this->Url->build("/Supports/view/" . $support->id); ?>" class="media-heading" id="media-heading-new">
                                            <span class="text-semibold"><?= h($support->title) ?> <?php if (isset($parentIDs[$support->id])) {
                                                                                                                echo "(" . $parentIDs[$support->id] . ")";
                                                                                                            } ?></span>
                                            <span class="media-annotation pull-right"><?php echo $time ?></span>
                                        </a>

                                        <span class="text-muted">
                                            <?php
                                                    $support->description = strip_tags($support->description);
                                                    if (isset($parentIDs[$support->id])) {

                                                        if (strlen($support->description) > 75) {

                                                            ?>
                                                    <strong><?php echo substr($support->description, 0, 75) . " ..."; ?></strong>

                                                <?php } else { ?>
                                                    <strong><?php echo $support->description; ?></strong>
                                            <?php
                                                        }
                                                    } else {

                                                        if (strlen($support->description) > 75) {
                                                            echo substr($support->description, 0, 75) . " ...";
                                                        } else {
                                                            echo $support->description;
                                                        }
                                                    }
                                                    ?>
                                        </span>
                                    </div>
                                </li>
                        <?php }
                        endforeach; ?>

                    </ul>

                    <div class="dropdown-content-footer">
                        <a href="<?php echo $this->Url->build('/Supports/index/'); ?>" data-popup="tooltip" title="All ticket">Show More</a>
                    </div>
                </div>
            </li>
            <li>
                <a href="<?php echo $this->Url->build(["controller" => "SoftwareTraining", "action" => "index"]); ?>">Software Training</a>
            </li>
            <?php if (isset($settingData['facebook_url']) && !empty(isset($settingData['facebook_url']))) : ?>
                <li>
                    <a target=_blank href="<?php echo $settingData['facebook_url']; ?>">Facebook Group</a>
                </li>

            <?php endif; ?>
            <li><a href="<?php echo $this->Url->build(["controller" => "Supports", "action" => "index"]); ?>">Contact Support</a></li>
            <li><a href="<?php echo  APP_SERVER_HOST_URL . 'forum/index.php'; ?>">Forum</a></li>

            <li><a href="<?php echo $this->Url->build(["controller" => "dashboard", "action" => "edit-profile"]); ?>">Profile</a></li>
            <li><a href="<?php echo $this->Url->build(["controller" => "users", "action" => "logout"]); ?>">Logout</a></li>

        </ul>
    </div>
    <div class="col-sm-1 col-xs-12">
        <div class="header-package">
            <nav class="navbar package-menu">
                <div class="navbar-collapse" id="navbar">
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" id="upgrade-btn" role="button" aria-expanded="false">Upgrade!</a>
                        </li>
                    </ul>

                </div>
            </nav>
        </div>
    </div>
    <?php if ($_SESSION['new_affiliate_count'] > 0) { ?>
        <div id="affiliate-notif-alert" class="col-md-12 col-xs-12 yellow-alert">
            <div class="alert alert-warning alert-dismissible text-center" role="alert">
                <button  type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span class="close-btn" aria-hidden="true">&times;</span>
                </button>
                <strong>Great news! </strong> <?php echo $_SESSION['new_affiliate_count']; ?> new affiliate<?php echo $_SESSION['new_affiliate_count'] > 1 ? 's' : ''; ?> has been registered.
                <a href="#" onclick="affiliateNotificationUpdate()">(Clear all notifications)</a>
            </div>
        </div>
        <br>
    <?php } ?>

    <?php if (isset($_SESSION['is_warning']) && $_SESSION['is_warning'] == 1) { ?>
        <div class="col-md-12 col-xs-12 yellow-alert">
            <div class="alert alert-warning alert-dismissible text-center" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span class="close-btn" aria-hidden="true">&times;</span>
                </button>
                <strong>Warning! </strong> You have Client Files that Need Updated or Sent out Again. Please check your Clients Files

            </div>
        </div>
        <br>
    <?php } ?>

    <?php if (isset($_SESSION['total_num_of_clients']) && $_SESSION['total_num_of_clients'] > 0) { ?>
        <div class="col-md-12 col-xs-12 yellow-alert">
            <div class="alert alert-success alert-dismissible text-center">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span class="close-client-btn" aria-hidden="true">&times;</span>
                </button>
                <strong>Great news! </strong> <?php echo $_SESSION['total_num_of_clients']; ?> new client<?php echo $_SESSION['total_num_of_clients'] > 1 ? 's' : ''; ?> has been registered.
                <a href="#" id="clear-client_notification">(Clear all notifications)</a>
                <i id="spinner" style="display:none" class="fa fa-spinner fa-spin"></i>
            </div>
        </div>
    <?php } ?>

    <?php if (isset($_SESSION['agreements']) && !empty($_SESSION['agreements'])) {
        $total_count_agreement = count($_SESSION['agreements']);
        ?>
        <div class="col-md-12 col-xs-12 yellow-alert close-agreement-noti">
            <div class="alert alert-success alert-dismissible text-center">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span class="close-agreement-btn" aria-hidden="true">&times;</span>
                </button>
                <strong></strong> You have <?php echo $total_count_agreement; ?> client<?php echo $total_count_agreement > 1 ? 's' : ''; ?> signed your document.

                <div class="dropdown" style="display: inline;">
                    <a class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" href="#" id="">click Here <i class="fa fa-arrow-down"></i></a>
                    <ul class="dropdown-menu">
                        <?php if (!empty($_SESSION['agreements'])) {

                                foreach ($_SESSION['agreements'] as $key => $agree) {
                                    ?>
                                <li><a href="<?php echo $this->Url->build('/Client/clientdashboard/' . $key); ?>"><?php echo $agree; ?></a></li>
                        <?php
                                }
                            }
                            ?>
                    </ul>
                </div>
                to see all.
                <a href="#" id="clear-agreement_notification">(Clear all notifications)</a>
                <i id="spinner-agreement" style="display:none" class="fa fa-spinner fa-spin"></i>
                <div class="row">
                    <div class="col-md-6 col-md-offset-6">

                    </div>
                </div>
            </div>
        </div>

    <?php } ?>
</div>