<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Expires" content="-1">
    <!-- Tell the browser to be responsive to screen width -->

    <?php 
  $ajax_url = '/ClientNote/note/'.$_SESSION['Auth']['User']['client_id'];
  if(isset($setting['meta_tag']))
  echo $setting['meta_tag'];
  ?>
    <?php
    if(!empty($setting['favicon_path'])){
    	$favicon_path = $setting['favicon_path'];
    } else{
    $favicon_path = 'images/favicon/favicon.ico';
	}
    if((APP_SERVER_HOST_URL == CLIENT_PORTAL_DOMAIN) || (strpos(CLIENT_PORTAL_DOMAIN, $_SERVER['REDIRECT_REDIRECT_SSL_TLS_SNI']) !== false)){
        $favicon_path = CLIENT_PORTAL_FAVICON;
        $setting['title'] = CLIENT_PORTAL_DEFAULT_HEADER;
    }      
?>
    <title><?php echo $setting['title'];?></title>
    <link rel="icon" href="<?php echo $this->request->webroot.'webroot/'.$favicon_path;?>" type="image/icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/select2.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/plugins/iCheck/flat/blue.css">
    <!-- Morris chart -->
    <!--  <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/plugins/morris/morris.css">-->
    <!-- jvectormap -->
    <link rel="stylesheet"
        href="<?php echo $this->request->webroot; ?>admin_lte/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet"
        href="<?php echo $this->request->webroot; ?>admin_lte/plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <!--<link rel="stylesheet" href="<?php //echo $this->request->webroot; ?>admin_lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">-->
    <!--  cms_style.css   custom style -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>css/cms_style.css">
    <!--  custom.css   custom style -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>css/custom.css">
    <?php //echo $this->CKEditor->loadJs(); ?>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
  <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/html5shiv.min.js"></script>
  <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/respond.min.js"></script>
  <![endif]-->


    <!-- Layout ::  new_dashboard  -->
    <!-- Font Awesome -->
    <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css"> -->
    <!-- Ionicons -->
    <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>new_layout/css/_all-skins.min.css">
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>new_layout/css/style.css">
    <!-- Layout ::  new_dashboard  -->



    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/full_page_loader.css?1.0.1">
</head>

<body class="hold-transition skin-blue sidebar-mini">
    <div class="loading" id="full-page-loader">
        <div class='uil-ring-css' style='transform:scale(0.79);'>
            <div></div>
            <h3></h3>
        </div>
    </div>
    <?php $username = $this->request->session()->read('Auth.User.username'); 
$img_path = $this->request->session()->read('Auth.User.img_path');
$profile_picture = (empty($img_path)) ? $this->request->webroot."media/companies/default.jpg" : $this->request->webroot.$img_path;
$client_logo_path = $this->request->session()->read('Auth.User.logo');


 ?>

    <style type="text/css">
    .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;
    }

    @media only screen and (max-width: 767px) {

        .top-icon-area,
        .ka-main-content {
            margin-top: 0 !important;
            margin-left: 0 !important;
        }
    }

    .direct-chat-text {
        word-break: break-word
    }
    </style>

    <?php
    if(!empty($setting['logo_path'])){
        $logo_path = $setting['logo_path'];
    } else{
    $logo_path = 'images/logo/favicon.ico';
    }

    $client_logo_path = "";
    if(isset($_SESSION['client_logo_path'])){
        $client_logo_path = $_SESSION['client_logo_path'];
    }
    $client_logo = (empty($client_logo_path)) ? $this->request->webroot.$logo_path : $this->request->webroot.'cmsuser_logo/'.$client_logo_path;
?>
    <div class="container-fluid ka-header">
        <!--    <div class="col-sm-2">
         <img src="<?php echo $this->request->webroot; ?>new_layout/img/logo.png"  alt="" class="img-responsive ka-logo center-block"/> 
        <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-10 text-right">
    <ul class="ka-nav">
        
       
        <?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" => "dashboard","action" => "contact"]);?>">Contact</a></li>
       
         <li><a href="<?php echo $this->Url->build(["controller" => "Cmsusers","action" => "contactedit"]); ?>">Profile</a></li>
        <li><a href="<?php echo $this->Url->build(["controller" => "users","action" => "logout"]);?>">Logout</a></li>
    </ul>
  </div>-->
        <!--  <div class="col-sm-2">
    <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="<?php echo $this->Url->build(["controller" => "dashboard","action" => "upgrade"]);?>" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Upgrade! &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">

                <?php if(!empty($allPackages)): ?>
                    <?php foreach ($allPackages as $key => $pkg) : ?>
                        <?php if(isset($userHasPackage[$key]) && ($userHasPackage[$key] != 1) ): ?>
                             <li>
                                    <form name="package<?php echo $key; ?>" action="<?= $base_url ?>dashboard/upgrade" method="post" class="pkgForm">
                                        <input type="hidden" name="package_id" value="<?php echo $key; ?>">
                                        <input class="pkgFormBtn" type="button" name="upgrade<?php echo $key; ?>" value="<?php echo $pkg['name']; ?>" class="" onclick="if (confirm('Are you sure you want to upgrade? <?php echo $pkg['price'].' '.UNIT; ?> will be deducted from your stripe account.')) { document.package<?php echo $key; ?>.submit(); } else {event.returnValue = false; return false;}">
                                    </form>
                            </li> 
                            <li><a href="<?= $base_url.'dashboard/upgrade/'.$key; ?>"><?php echo $pkg['name']; ?></a></li>
                        <?php endif; ?>
                    <?php endforeach; ?>
                <?php endif; ?>

              </ul>
            </li>
          </ul>

      </div>
    </nav>
    </div>
  </div>-->
    </div>
    <div class="container-fluid ka-body">

        <!--Start of Main Navigation-->
        <?= $this->element('new_contact_user_dashboard_nav') ?>
        <!--End of Main Navigation-->

        <div class="col-sm-10">
            <?= $this->element('top_link',compact('client_logo')) ?>
            <div class="ka-main-content">
                <?= $this->Flash->render() ?>
                <?= $this->fetch('content') ?>
            </div>
        </div>

    </div>
    <footer class="">
        <div class="ka-footer">
            <?= $this->element('footer') ?>
        </div>
    </footer>



    <div id="reply-modal" class="modal fade" role="dialog">
        <div class="modal-dialog">

            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Message</h4>
                </div>
                <div class="modal-body">

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>

        </div>
    </div>


    <!-- ./wrapper -->
    <script src="<?php echo $this->request->webroot; ?>js/jquery-1.11.2.js"></script>
    <!-- jQuery 2.2.0 -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/jQuery/jQuery-2.2.0.min.js"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/jquery-ui.min.js"></script>
    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
    <script>
    $.widget.bridge('uibutton', $.ui.button);
    </script>
    <!-- Bootstrap 3.3.6 -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/bootstrap.min.js"></script>
    <script src="<?php echo $this->request->webroot; ?>rtgv3/js/select2.full.min.js"></script>
    <!-- Morris.js charts -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
    <?php echo $this->Html->script('morris/morris.min.js'); ?>
    <!-- <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> -->
    <!--    <script src="http://cdn.oesmith.co.uk/morris-0.4.1.min.js"></script>-->
    <!-- Sparkline -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/sparkline/jquery.sparkline.min.js"></script>
    <!-- jvectormap -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js">
    </script>
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/jvectormap/jquery-jvectormap-world-mill-en.js">
    </script>
    <!-- jQuery Knob Chart -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/knob/jquery.knob.js"></script>
    <!-- daterangepicker -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/moment.min.js"></script>
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/daterangepicker/daterangepicker.js"></script>
    <!-- datepicker -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/datepicker/bootstrap-datepicker.js"></script>
    <!-- Bootstrap WYSIHTML5 -->
    <!--<script src="<?php //echo $this->request->webroot; ?>admin_lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>-->
    <!-- Slimscroll -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/fastclick/fastclick.js"></script>
    <!-- AdminLTE App -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/dist/js/app.min.js"></script>
    <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/dist/js/pages/dashboard.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/dist/js/demo.js"></script>

    <!-- InnerTablist1 Select Option Value -->
    <?php echo $this->Html->script('selectbox1/jcf.js'); ?>
    <?php echo $this->Html->script('selectbox1/jcf.select.js'); ?>
    <?php echo $this->Html->script('selectbox1/jcf.scrollable.js'); ?>

    <!-- SmartMenus jQuery plugin -->
    <?php echo $this->Html->script('smartmenus.js'); ?>

    <!-- SmartMenus jQuery Bootstrap Addon -->
    <?php echo $this->Html->script('jquery.smartmenus.bootstrap.js'); ?>


    <!-- bootstrap date picker -->
    <?php echo $this->Html->script('bootstrap-datepicker.js'); ?>
    <?php echo $this->Html->script('timepick.js') ?>
    <?php echo $this->Html->script('jquery.countdown.js') ?>

    <!-- important custom js -->
    <script src="<?php echo $this->request->webroot;?>js/sweetalert2/sweetalert2.min.js"></script>
    <?php echo $this->Html->script('custom.js'); ?>
    <?php echo $this->Html->script('globalsettings.js'); ?>
    <?php echo $this->element('tinymce_js'); ?>
    <script>
    function getMessage(note_id, title) {
        event.preventDefault();
        if (note_id && title) {
            var loader = $('#reply-loder-' + note_id + ', #top-id');
            loader.show();
            var formData = {
                action: 'GET_REPLY_DATA',
                note_id: note_id,
                title: title
            }
            $.ajax({
                type: "POST",
                data: formData,
                url: '<?php echo $this->Url->build($ajax_url); ?>',
                success: function(response) {
                    loader.hide();
                    response = JSON.parse(response);
                    $('.modal-body').html(response)
                    var total_note = $(".note-count").text();
                    total_note = parseInt(total_note);
                    total_note--;
                    $(".note-count").text('');
                    if (total_note > 0) {
                        $(".note-count").text(total_note);
                    }

                    if (total_note == 0) {
                        $('div.width-350').remove()
                    } else {
                        $('#notelist-' + note_id).remove();
                    }
                    $('#reply-modal .modal-content').removeAttr("style");
                    $('#reply-modal h4.modal-title').text('Message');
                    $('#reply-modal').modal('show');
                    setDefaultMessage('<?php echo NOTE_CHAR_LENGTH ?>', '<?php echo NOTE_CHAR_LENGTH ?>', $(
                        '#reply-modal .char-count-text'))


                },
                error: function() {
                    loader.hide();
                }
            })
        }
    }

    function copyToClipboard(text, el) {
        var copyTest = document.queryCommandSupported('copy');
        var elOriginalText = el.attr('data-original-title');

        if (copyTest === true) {
            var copyTextArea = document.createElement("textarea");
            copyTextArea.value = text;
            document.body.appendChild(copyTextArea);
            copyTextArea.select();
            try {
                var successful = document.execCommand('copy');
                var msg = successful ? 'Copied!' : 'Whoops, not copied!';
                el.attr('data-original-title', msg).tooltip('show');
            } catch (err) {
                console.log('Oops, unable to copy');
            }
            document.body.removeChild(copyTextArea);
            el.attr('data-original-title', elOriginalText);
        } else {
            // Fallback if browser doesn't support .execCommand('copy')
            window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
        }
    }

    //    $(document).ready(function () {
    //        $(document).on('click', '.edit', function () {
    //            var cid = $(this).attr('id');
    //            window.location = '<?php echo $this->Url->build('/teams/edit/'); ?>' + cid;
    //            return false;
    //        });
    //
    //        $("#bulk_action_apply").click(function (e) {
    //            var selectedContent = $("input[name='selected_content']").val();
    //            if (selectedContent == null || selectedContent == "") {
    //                e.preventDefault();
    //                $('#status-area').flash_message({
    //                    text: 'Select atleast one item in the list!',
    //                    how: 'append'
    //                });
    //            }
    //        });
    //    });
    //if($('.direct-chat-messages').length > 0)
    //$('.direct-chat-messages').scrollTop($('.direct-chat-messages')[0].scrollHeight);
    </script>
    <script>
    var ENVIROMENT = '<?php echo ENVIROMENT; ?>'
    </script>
    <script src="<?php echo $this->request->webroot; ?>js/unwanted_char_remove.js?1.0.2"></script>
    <script src="<?php echo $this->request->webroot;?>js/js.input.validation.js?1.0.2"></script>
    <?php echo $this->element('letter_count_textarea'); ?>
    <?php echo $this->element('js_clipboardcopy'); ?>
</body>

</html>