<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Project:Links</title>
    <link rel="icon" type="image/x-icon" href="{{ asset('project_links_icon.ico') }}" />
    <!-- Bootstrap -->
    <link rel="stylesheet" type="text/css" href="{{asset('/bundles/user/css/bootstrap.min.css')}}"> 
    <!-- Font Awesome -->
    <link rel="stylesheet" type="text/css" href="{{asset('/bundles/user/css/font-awesome.min.css')}}"> <!-- Custom Theme Style -->
    <!-- Custom Theme Style -->
    <link rel="stylesheet" type="text/css" href="{{asset('/bundles/user/css/custom.css')}}">

    <link rel="stylesheet" type="text/css" href="{{asset('/bundles/user/css/green.css')}}"> 
   
    <link rel="stylesheet" type="text/css" href="{{asset('/bundles/user/css/bootstrap-css/bootstrap-progressbar-3.3.4.min.css')}}"> <!-- Custom Theme Style -->
   
      <!-- Choosen -->
    <link href="{{asset('/bundles/user/css/chosen.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('/bundles/user/datatables/datatables.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('/bundles/user/datatables/plugins/bootstrap/datatables.bootstrap.css')}}" rel="stylesheet" type="text/css" />

    <link href="{{asset('/bundles/user/vendors/iCheck/skins/flat/green.css')}}" rel="stylesheet" type="text/css" />
    <style>
.profile_info{
    width: auto;
}
    </style>
   {% block stylesheets %}
    {% endblock %}
  </head>
<body class="nav-md">
    <div class="container body">
     {% block full_body_content %}
      <div class="main_container">
        <div class="col-md-3 left_col">
          <div class="left_col scroll-view col-md-12">
            <div class="clearfix"></div>
            <!-- menu profile quick info -->
            <div class="profile">
              <div class="profile_pic">
                <img src="http://erp.cisin.com/img%5C{{ app.user.empCode }}.jpg" alt="..." class="img-circle profile_img">
              </div>
              <div class="profile_info">
                <span>Welcome,</span>
                <h2>{{ app.user.name|split(' ')|first }}</h2>
              </div>
            </div>
            <!-- /menu profile quick info -->
            
            <br />
            <!-- sidebar menu -->
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              <div class="menu_section">
              <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h3>
                <ul class="nav side-menu">
                {% if is_granted('ROLE_SUPER_ADMIN')  %}
                  <li><a href="{{ path('user_dashboard')}}"><i class="fa fa-tachometer"></i> Dashboard <span ></span></a> 
                  </li>
                {% else %}
                  <li><a href="{{ path('user_dashboard')}}"><i class="fa fa-search"></i> Search Projects</a></li>
                {% endif %}
                  <!-- <li><a href="{{ path('user_dashboard')}}"><i class="fa fa-search"></i> Search Projects</a></li> -->
                  {% if is_granted('ROLE_ATL') or is_granted('ROLE_TL') or is_granted('ROLE_SUPER_ADMIN')  %}
                  <li><a><i class="fa fa-edit"></i> Tags <span class="fa fa-chevron-down"></span></a>
                    <ul class="nav child_menu">
                      <li><a href="{{ path('user_categories_add') }}">Add Tag</a>
                      </li>
                       <li><a href="{{ path('user_categories_view') }}">View Tags</a>
                      </li>
                    </ul>
                  </li>
                  {% endif %} 
                  <li><a><i class="fa fa-desktop"></i> Project Links <span class="fa fa-chevron-down"></span></a>
                    <ul class="nav child_menu">
                      <li><a href="{{ path('user_project_create')}}">Add Links</a>
                      </li>
                      <li><a href="{{ path('user_project_view')}}">View Links</a>
                      </li>
                    </ul>
                  </li>
                   <li><a href="{{ path('appointment_calendar_homepage')}}"><i class="fa fa-calendar"></i>Calendar
                   </a></li>
                  {% if is_granted('ROLE_ATL') or is_granted('ROLE_TL') or is_granted('ROLE_SUPER_ADMIN')  %}
                   <li><a><i class="fa fa-gears"></i> Skills <span class="fa fa-chevron-down"></span></a>
                    <ul class="nav child_menu">
                      <li><a href="{{ path('userskills_index')}}">View Users Skills</a>
                      </li>
                    </ul>
                  </li>
                  {% else %}
                  <li><a href="{{ path('userskills_index') }}"><i class="fa fa-gears"></i>My Skills </a>

              {% endif %}  

              <li><a><i class="fa fa-file"></i>Estimation <span class="fa fa-chevron-down"></span></a>
                  <ul class="nav child_menu">
                    <li><a href="{{ path('project_estimation_add')}}">Add Estimation</a>
                    </li>
                    <li><a href="{{ path('project_estimation_view')}}">View Estimation</a>
                    </li>
                  </ul>
              </li>
              <li><a href="{{ path('edit_profile')}}"><i class="fa fa-user"></i> Profile <span ></span></a> 
              </li>

              

              {% if is_granted('ROLE_SUPER_ADMIN') %}                    
                <li><a><i class="fa fa-user"></i> Users Section <span class="fa fa-chevron-down"></span></a>
                  <ul class="nav child_menu">
                    <li><a href="{{ path('user_add')}}">Add User</a>
                    </li>
                    <li><a href="{{ path('user_view')}}">View Users</a>
                    </li>
                  </ul>
                  </li>
                  <li><a><i class="fa fa-book"></i>Business Dev
                    <span class="fa fa-chevron-down"></span></a>
                  <ul class="nav child_menu">
                    <li><a href="{{ path('add_bd')}}">Add BD</a>
                    </li>
                    <li><a href="{{ path('view_bd')}}">View BD</a>
                    </li>
                  </ul>
                  </li>

                  <li><a><i class="fa fa-file"></i>Upload 
                    <span class="fa fa-chevron-down"></span></a>
                  <ul class="nav child_menu">
                    <li><a href="{{ path('upload_cv')}}">Upload CV</a>
                    </li>
                    <li><a href="{{ path('view_cv_list')}}">View CV</a>
                    </li>
                    <li><a href="{{ path('create_cv')}}">Create CV</a>
                    </li>
                  </ul>
                  </li>
           <li><a href="{{ path('view_log')}}"><i class="fa fa-history"></i>View Logs<span ></span></a> 
              </li>

          {% endif %}      
                </ul>
              </div>
              <div class="menu_section">
                <ul class="nav side-menu">
              </div>
            </div>
          </div>
        </div>

        <!-- top navigation -->
        <div class="top_nav">

          <div class="nav_menu">
            <nav class="" role="navigation">
              <div class="nav toggle">
                <a id="menu_toggle"><i class="fa fa-bars"></i></a>
              </div>
              <ul class="nav navbar-nav navbar-right">
                <li class="">
                  <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                  <i class="fa fa-user aero red">&nbsp;<b>{{ app.user.name }}</b></i>
                    <span class=" fa fa-angle-down"></span>
                  </a>
                  <ul class="dropdown-menu dropdown-usermenu pull-right">
                    <li><a href="{{ path('user_change_password') }}"><i class="fa fa-sign-out pull-right"></i> Change Password</a>
                    </li>
                    <li><a href="{{ path('userskills_new') }}"><i class="fa fa-plus-circle pull-right"></i> Add Skills</a>
                    </li>
                    <li><a href="{{ path('edit_profile') }}"><i class="fa fa-user pull-right"></i>Profile</a>
                    </li>

                    {% if is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_SUPER_ADMIN') %}
                     <li><a href="{{ path('send_notification') }}"><i class="fa fa-user pull-right"></i>Send Notification</a>
                    </li>

                    <li><a href="{{ path('view_user_projects') }}"><i class="fa fa-user pull-right"></i>View User's Projects</a>
                    </li>
                     {% endif %}

                     
                    <li><a href="{{ path('logout_user') }}"><i class="fa fa-sign-out pull-right"></i> Log Out</a>
                    </li>
                  </ul>
                </li>
                {% if is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_TL') or app.user.empCode == 1270 %}
                
                <li id="notification" role="presentation" class="dropdown">
                  <a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown" id="count_notice" aria-expanded="false">
                    <i class="fa fa-envelope-o"></i>
                    <span class="badge bg-green" id="n_count"></span>
                  </a>
                  <ul id="menu1" class="dropdown-menu list-unstyled msg_list" role="menu" style="overflow-y: auto; max-height: 248px;">
                    <li class="loading" style="background-color: white; padding: 0px !important;">
                    <a style="margin-left: 40%;">
                      <span class="image">
                        <img src="{{asset('/bundles/user/image/loading.gif')}}" alt="loding image" />
                      </span>
                    </a>
                    </li>
                    <div id="notice-list">
                     <!-- Notification list fill by ajax -->
                    </div>
                  </ul>
                </li>
                {% endif %}
              </ul>
            </nav>
          </div>

        </div>
        <!-- /top navigation -->


        <!-- page content -->
        <div class="right_col" role="main">
          <div class="row">
           {% block body_content %}

                No content to display!
            {% endblock %}
          </div>
          <br/>
          <div class="row">
          </div>
          <div class="row">
            <div class="col-md-8 col-sm-8 col-xs-12">
              <div class="row">
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- footer content -->
  <!--       <footer>
         
          <div class="clearfix"></div>
        </footer> -->
        <!-- /footer content -->
      </div>
    {% endblock %}
    </div>
<!-- jQuery -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/jquery/dist/jquery.min.js')}}"></script>
   
    <!-- Bootstrap -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/bootstrap/dist/js/bootstrap.min.js')}}"></script>
   
    <!-- FastClick -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/fastclick/lib/fastclick.js')}}"></script>
  
    <!-- NProgress -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/nprogress/nprogress.js')}}"></script>
   
 
  
    <!-- gauge.js -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/bernii/gauge.js/dist/gauge.min.js')}}"></script>
  
    <!-- bootstrap-progressbar -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js')}}"></script>
  
    <!-- iCheck -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/iCheck/icheck.min.js')}}"></script>
   
    <!-- Skycons -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/skycons/skycons.js')}}"></script>
  
    <!-- Flot -->
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/Flot/jquery.flot.js')}}"></script>
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/Flot/jquery.flot.pie.js')}}"></script>
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/Flot/jquery.flot.time.js')}}"></script>
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/Flot/jquery.flot.stack.js')}}"></script>
    <script type="text/javascript" src="{{asset('/bundles/user/vendors/Flot/jquery.flot.resize.js')}}"></script>
    <!-- Flot plugins -->
    <script type="text/javascript" src="{{asset('/bundles/user/js/flot/jquery.flot.orderBars.js')}}"></script>
    <script type="text/javascript" src="{{asset('/bundles/user/js/flot/date.js')}}"></script>
    <script type="text/javascript" src="{{asset('/bundles/user/js/flot/jquery.flot.spline.js')}}"></script>
    <script type="text/javascript" src="{{asset('/bundles/user/js/flot/curvedLines.js')}}"></script>
   
 
    <!-- bootstrap-daterangepicker -->
    <script type="text/javascript" src="{{asset('/bundles/user/js/moment/moment.min.js')}}"></script>
    <script type="text/javascript" src="{{asset('/bundles/user/js/datepicker/daterangepicker.js')}}"></script>  
    <!-- Custom Theme Scripts -->
    <script type="text/javascript" src="{{asset('/bundles/user/js/custom.js')}}"></script>  
      <!-- chosen Scripts -->
    <script type="text/javascript" src="{{asset('/bundles/user/script/chosen.jquery.js')}}"></script>
       <!-- Data table -->   
    <script src="{{asset('/bundles/user/datatables/datatables.min.js')}}" type="text/javascript"></script>
    <script src="{{asset('/bundles/user/datatables/plugins/bootstrap/datatables.bootstrap.js')}}" type="text/javascript"></script>
    <script src="{{asset('/bundles/user/script/datatable.js')}}" type="text/javascript"></script>

    <script src="{{asset('/bundles/user/js/jquery.validate.min.js')}}" type="text/javascript"></script>

    <!-- PNotify -->
    <script src="{{asset('/bundles/user/vendors/pnotify/dist/pnotify.js')}}"></script>
    <script src="{{asset('/bundles/user/vendors/pnotify/dist/pnotify.buttons.js')}}"></script>
    <script src="{{asset('/bundles/user/vendors/pnotify/dist/pnotify.nonblock.js')}}"></script>
    
    <!-- Guage -->
    <script src="{{asset('/bundles/user/vendors/bernii/gauge.js/dist/gauge.min.js')}}"></script>


    <link href="{{asset('/bundles/user/vendors/pnotify/dist/pnotify.css')}}" rel="stylesheet">
    <link href="{{asset('/bundles/user/vendors/pnotify/dist/pnotify.buttons.css')}}" rel="stylesheet">
    <link href="{{asset('/bundles/user/vendors/pnotify/dist/pnotify.nonblock.css')}}" rel="stylesheet">
    <script type="text/javascript">
$(document).ready(function() {
    $(".chosen-select").chosen({
      search_contains:true
    });
      var select, chosen,id;

      // cache the select element as we'll be using it a few times
      select = $("#categorie_id");

      // init the chosen plugin
      select.chosen({ no_results_text: 'Press Enter to add new entry:'});
    
      // get the chosen object
      chosen = select.data('chosen');

      // Bind the keyup event to the search box input
      $('#categorie_id_chosen').find('input').on('keyup', function(e){
        // if we hit Enter and the results list is empty (no matches) add the option
        if (e.which == 13 && chosen.dropdown.find('li.no-results').length > 0){
          //Call to ajax to save categories
          var data = this.value;
          var path = '{{ path("user_categories_add") }}';
          $.ajax({
              type: "POST",
              url: path,
              data: "categorie_name="+data+"&parent_name=''&ajax='true'",                  
              success: function(data)
              {
                id = data.id;
                var option = $("<option>").val(id).text(data.name);
                // add the new option
                select.prepend(option);
                // automatically select it
                select.find(option).prop('selected', true);
                // trigger the update
                select.trigger("chosen:updated");
              }
          });
        }
    });

    {% if is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_TL') or app.user.empCode == 1270 %}
      //get notification count on each 3 sec
      var urlNotifiCount = '{{ path("user_notification_count") }}' 
      setInterval(function(){
        $.getJSON(urlNotifiCount,function(data){
            html='<i class="fa fa-envelope-o">';
            $('#count_notice').html('');
            if(data.count>0){
              html+='<span class="badge bg-green" id="n_count">'+data.count+'</span>';
            }
            $('#count_notice').html(html);
        });
      },3000);

      //get notification list on click on notification icon
      $("#notification").on("click",function(){
        //get notification list
        $.ajax({
          type: "POST",
          url: "{{ path('user_notification_list') }}",
          dataType: "json",
          beforeSend: function() {
            $('.loading').show();
            $('.notice-list').remove()
          },                 
          success: function(data){
            var list = data.list
            htmlList = "";
            if(list.length == 0){
              htmlList = "<li class='notice-list'> No records available.</li>"
              $("#notice-list").append(htmlList);
            }else{
              for (var i = 0; i < list.length; i++) {

               /* var time = list[i].duration.split(" ");
                var requestTime = time[0]+" min ago";
                if(time[0] > 60){
                  requestTime = parseInt(time[0]/60)+" hours ago";
                  if(requestTime > 24){
                    requestTime = parseInt(requestTime/24)+" days ago"; 
                  }
                }*/
                var listRow = '<li class="notice-list" id="notice_'+ list[i].id +'" ><a><span class="image"><img src="' + list[i].image +'" alt="Profile Image" /></span><span><span>' + list[i].name + '</span><span class="time">' + list[i].duration + '</span><span class="message" data-id="' + list[i].id + '" ><span> ' + list[i].disc + ' </span><br>';
                    if(list[i].type == 'forget-password'){
                     listRow += '<button class="btn btn-success btn-xs pull-right generate" type="button">Generate</button><button class="btn btn-danger btn-xs pull-right reject" type="button">Reject</button>'
                    }else{
                       listRow += '<a href="/project/details/'+ list[i].linkId +'" target="_blank" class="btn btn-success btn-xs pull-right">view detail</a>'
                    }
                    listRow += '</span></a></li>';
                $("#notice-list").append(listRow);
              }
            }
            $('.loading').hide();
          }
        });
      });
      
      $("#notice-list").on("click",".generate",function(){
        var id = $(this).parent().data('id');
        $(this).text('Sending....');
        $.ajax({
          type: "POST",
          url: "{{ path('user_generate_password') }}",
          dataType: "json",
          data: {'id': id},
          success : function(data){
            if(data.status == 'success'){
              alert('Password Sent Successfully!');
              $('#notice_'+id).empty().text("Successfully generated.");
              $('#notice_'+id).fadeOut(3000,function(){
                $('#notice_'+id).remove();
              });
            }
          }
        });
        return false;
      });

      $("#notice-list").on("click",".reject",function(){
         var id = $(this).parent().data('id');
        $.ajax({
          type: "POST",
          url: "{{ path('user_reject_request') }}",
          data: {'id': id},
          dataType: "json",
          success : function(data){
            if(data.status == 'success'){
              $('#notice_'+id).empty().text("Successfully rejected.");
              $('#notice_'+id).fadeOut(3000,function(){
                $('#notice_'+id).remove();
              });
            }
          }
        })
        return false;
      });
    {% endif %}

});

</script>
   <!-- Data table -->
   <!-- BEGIN PAGE LEVEL SCRIPTS -->
{% block javascripts %}
{% endblock %}
<!-- END PAGE LEVEL SCRIPTS -->

<!-- Chosen initialization -->