<?php error_reporting(0);

                                                $webmasterid=$this->session->userdata('webmaster_marketing');
?>
<!--script src="<?php echo base_url('assets')?>/highcharts/js/highcharts.js"></script>
<script src="<?php echo base_url('assets')?>/highcharts/js/modules/data.js"></script>
<script src="<?php echo base_url('assets')?>/highcharts/js/modules/drilldown.js"></script--> 
 
 <div>
    <ul class="breadcrumb">
        <li>
            <a href="#">Home</a>
        </li>
        <li>
            <a href="#"><?php echo ucfirst($this->utama)?></a>
        </li>
    </ul>
</div>
						<div class="clock">
<div id="Date"></div><br/>
  <ul style="
    width: 100%;
    margin: 0 auto;
    padding: 0px;
    list-style: none;
    text-align: center;
    height:70%;">
      <li id="hours" style="
    display: inline;
    font-size: 13px;
    text-align: center;
    font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
    text-shadow: 0 0 5px #000;"></li>
      <li id="point" style="
    display: inline;
    font-size: 13px;
    text-align: center;
    font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
    text-shadow: 0 0 5px #000;">:</li>
      <li id="min" style="
    display: inline;
    font-size: 13px;
    text-align: center;
    font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
    text-shadow: 0 0 5px #000;"></li>
      <li id="point" style="
    display: inline;
    font-size: 13px;
    text-align: center;
    font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
    text-shadow: 0 0 5px #000;">:</li>
      <li id="sec" style="
    display: inline;
    font-size: 13px;
    text-align: center;
    font-family: 'BebasNeueRegular', Arial, Helvetica, sans-serif;
    text-shadow: 0 0 5px #000;"></li>
  </ul>
</div>
<?php 
$allow=1;
if(!diaadmin()){
    $allow=GetValue('update','users_permission_sf',array('menu_id'=>'where/1','user_id'=>'where/'.$this->session->userdata('webmaster_marketing')));//lastq();
}?>
<?php if($allow==1){?>
<div style="z-index:999999999;position: relative;float:right;margin-left:20px;"> 
    <button onclick="filter()">FILTER</button></div>
&nbsp;&nbsp;&nbsp;&nbsp;<div style="z-index:999999999;position: relative;float:right;margin-left:20px;" id="grupingnya">Group :  
<?php echo form_dropdown('group',GetOptAll('ref_group','-All-'),$this->session->userdata('groups'),'onchange="" id="grupnya"');?></div>&nbsp;&nbsp;
<div style="z-index:999999999;position: relative;float:right">Divisi :  
<?php echo form_dropdown('filter',GetOptAll('ref_divisi','-All-'),$this->session->userdata('divisi'),'onchange="gantiindivisi(this.value)" id="divisinya"');?></div><?php }?>
<ul class="nav nav-tabs">
    
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/114','user_id'=>'where/'.$webmasterid))=='1'){?>
        <li class="active"><a data-toggle="tab" href="#sectionA" id="btnsectionA">Monthly Activity</a></li>
    <?php }?>
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/115','user_id'=>'where/'.$webmasterid))=='1'){?>
    <li><a data-toggle="tab" href="#sectionB" id="btnsectionB">Solution Force Activity</a></li>
    <?php }?>
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/116','user_id'=>'where/'.$webmasterid))=='1'){?>
    <li><a data-toggle="tab" href="#sectionC" id="btnsectionC">Activity by Customer</a></li>
    <?php }?>
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/117','user_id'=>'where/'.$webmasterid))=='1'){?>
    <li><a data-toggle="tab" href="#sectionD" id="btnsectionC">Target Analysis</a></li>
    <?php }?>
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/118','user_id'=>'where/'.$webmasterid))=='1'){?>
    <li><a data-toggle="tab" href="#sectionE" id="btnsectionC">Customer Analysis</a></li>
    <?php }?>
</ul>
<div class="tab-content" style="height:auto!important;min-height:500px!important;">
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/114','user_id'=>'where/'.$webmasterid))=='1'){?> 
    <div id="sectionA" class="tab-pane fade in active">&nbsp;<?php $this->load->view('contents/dashboard/yearly') ?>
    </div>
    <?php }?>
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/115','user_id'=>'where/'.$webmasterid))=='1'){?>
     <div id="sectionB" class="tab-pane fade in">&nbsp;<?php $this->load->view('contents/dashboard/marketing') ?>
    </div>
    <?php }?>
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/116','user_id'=>'where/'.$webmasterid))=='1'){?>
     <div id="sectionC" class="tab-pane fade in">&nbsp;<?php $this->load->view('contents/dashboard/pelanggan') ?>
    </div>
    <?php }?>
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/117','user_id'=>'where/'.$webmasterid))=='1'){?>
     <div id="sectionD" class="tab-pane fade in">&nbsp;<?php $this->load->view('contents/dashboard/sales_plan') ?>
    </div>
    <?php }?>
    <?php if(diaadmin() || GetValue('view','users_permission_sf',array('menu_id'=>'where/118','user_id'=>'where/'.$webmasterid))=='1'){?>
     <div id="sectionE" class="tab-pane fade in">&nbsp;<?php $this->load->view('contents/dashboard/customer_analysis') ?>
    </div>
    <?php }?>
</div>
<script type="text/javascript">

$(document).ready(function() {
    gantiindivisi();
    <?php if(isset($_GET['activer'])){
        ?>
                $('#btn<?php echo $_GET['activer']?>').click();
    <?php }?>
// Create two variable with the names of the months and days in an array
var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; 
var dayNames= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]

// Create a newDate() object
var newDate = new Date();
// Extract the current date from Date object
newDate.setDate(newDate.getDate());
// Output the day, date, month and year   
$('#Date').html('<center>'+dayNames[newDate.getDay()] + " " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ' ' + newDate.getFullYear()+'</center>');

setInterval( function() {
	// Create a newDate() object and extract the seconds of the current time on the visitor's
	var seconds = new Date().getSeconds();
	// Add a leading zero to seconds value
	$("#sec").html(( seconds < 10 ? "0" : "" ) + seconds);
	},1000);
	
setInterval( function() {
	// Create a newDate() object and extract the minutes of the current time on the visitor's
	var minutes = new Date().getMinutes();
	// Add a leading zero to the minutes value
	$("#min").html(( minutes < 10 ? "0" : "" ) + minutes);
    },1000);
	
setInterval( function() {
	// Create a newDate() object and extract the hours of the current time on the visitor's
	var hours = new Date().getHours();
	// Add a leading zero to the hours value
	$("#hours").html(( hours < 10 ? "0" : "" ) + hours);
    }, 1000);	
});
function gantiindivisi(){
    
    var dz=$('#divisinya').val();
    $('#grupingnya').load('<?php echo base_url()?>load/grup/',{dz:dz});
    
    }
function gantidivisi(val){
    $.post('<?php echo base_url()?>load/gantidivisidashboard',{d:val},function(e){
                var abc = $(".tab-pane.fade.in.active").attr("id");
                var winz=window.location.href;
                var res=removeParam('activer',winz);
   window.location.href = res + "?activer="+abc;

    });
}
function filter(){
    var divisi=$('#divisinya').val();
    var grup=$('#grupnya').val();
    $.post('<?php echo base_url()?>load/gantidivisidashboard',{d:divisi,g:grup},function(e){
                var abc = $(".tab-pane.fade.in.active").attr("id");
                var winz=window.location.href;
                var res=removeParam('activer',winz);
   window.location.href = res + "?activer="+abc;

    });
}

function removeParam(key, sourceURL) {
    var rtn = sourceURL.split("?")[0],
        param,
        params_arr = [],
        queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
    if (queryString !== "") {
        params_arr = queryString.split("&");
        for (var i = params_arr.length - 1; i >= 0; i -= 1) {
            param = params_arr[i].split("=")[0];
            if (param === key) {
                params_arr.splice(i, 1);
            }
        }
        rtn = rtn + "" + params_arr.join("&");
    }
    return rtn;
}
</script>

<!-- Data from www.netmarketshare.com. Select Browsers => Desktop share by version. Download as tsv. -->
