<?php error_reporting(E_ALL ^ E_NOTICE);
if(isset($list)){	
	$val=$list->row_array();
}
?>
<?php
$cekdup=($type=='New' ? ',ajax[ajaxcekcode]' : '');
?>
    
<div class="row">
	<ul class="breadcrumb">
        <li>
            <a href="#">Home</a>
        </li>
        <li>
            <a href="<?php echo base_url($this->utama)?>"><?php echo ucfirst($this->title)?></a>
        </li>
        <li>
            <a href="#"><?php echo $type?></a>
        </li>
    </ul>
    <div class="box col-md-12">
    <div class="box-inner">
    <div class="box-header well" data-original-title="">
        <h2><i class="<?php echo GetValue('icon','sv_menu',array('filez'=>'where/'.$this->utama))?>"></i> <?php echo $this->title;?></h2>

        
    </div>
    	<div class="box-content">
       <form id="form" method="post" enctype="multipart/form-data" action="<?php echo base_url($this->utama)?>/submit" class="form-horizontal formular" role="form">
		   
		   <?php echo form_hidden('id',isset($val['id']) ? $val['id'] : '')?>
			
		   
		   
		   <!--div class="form-group">
			   
			   <?php $nm_f="code";?>
			   <div class="col-sm-3">
				   <label for="<?php echo $nm_f?>">Code</label>
				   </div><div class="col-sm-9">
				   <input type="text" name="<?php echo $nm_f?>"  id="<?php echo $nm_f?>_master_brand" value="<?php echo $a= (isset($val[$nm_f]) ? $val[$nm_f] : '') ?>" class="col-sm-4 validate[required<?php echo $cekdup?>]">
			   </div>
		   </div-->
		   
		   <div class="form-group">
			   
			   <?php $nm_f="sales";?> 
			   <div class="col-sm-2">
				   <label for="<?php echo $nm_f?>">Solution Force</label>
				   </div><div class="col-sm-9">
                                   <?php echo form_dropdown($nm_f,$opt_sales,(isset($val[$nm_f]) ? $val[$nm_f] : ''),'class="select2" onchange="cekisi()" id="'.$nm_f.'"'); ?>
			   </div>
		   </div>
		  
		   <!--div class="form-group">
			   
			   <?php $nm_f="activity";?> 
			   <div class="col-sm-2">
				   <label for="<?php echo $nm_f?>">Jenis Activity</label>
				   </div><div class="col-sm-9" id="activity_sales">
                                   <?php echo form_dropdown($nm_f,array(),(isset($val[$nm_f]) ? $val[$nm_f] : ''),'class="select2" onchange="" id="'.$nm_f.'"'); ?>
			   </div>
		   </div-->
		   <div class="form-group">
			   
			   <?php $nm_f="periode";?> 
			   <div class="col-sm-2">
				   <label for="<?php echo $nm_f?>">Bulan</label>
				   </div><div class="col-sm-9">
                                   <?php echo form_input($nm_f,(isset($val[$nm_f]) ? $val[$nm_f] : ''),'class="datepicker" onchange="" id="'.$nm_f.'"'); ?>
			   </div>
		   </div>
		   <!--div class="form-group">
			   
			   <?php $nm_f="to";?> 
			   <div class="col-sm-2">
				   <label for="<?php echo $nm_f?>">To</label>
				   </div><div class="col-sm-9">
                                   <?php echo form_input($nm_f,(isset($val[$nm_f]) ? $val[$nm_f] : ''),'class="datepicker" onchange="" id="'.$nm_f.'"'); ?>
			   </div> 
		   </div-->
		   <!--div class="form-group">
			   
			   <?php $nm_f="target";?> 
			   <div class="col-sm-2">
				   <label for="<?php echo $nm_f?>">Target</label>
				   </div><div class="col-sm-9">
                                   <?php echo form_input($nm_f,(isset($val[$nm_f]) ? $val[$nm_f] : ''),'class="" onchange="" id="'.$nm_f.'"'); ?>
			   </div>
		   </div-->
		   <div class="form-group">
			   
                       <div class="col-sm-12"></div>
		   </div>
                   <div id="monthlys">
                   </div>
    		<div class="form-group">
                    <div class="col-sm-12">
                        <button href="#" onclick="viewsummary()" type="button">View</button>
                    </div>
            
                </div>
    		<div class="form-group">
                    <div class="col-sm-12">
                        
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#call_new_customer" id="btnsectionA">Call New Customer</a></li>
            <li><a data-toggle="tab" href="#call_customer" id="btnsectionA">Call Customer</a></li>
            <li><a data-toggle="tab" href="#visit" id="btnsectionA">Visit Customer</a></li>
            <li><a data-toggle="tab" href="#quotation" id="btnsectionA">Quotation</a></li>
            <li><a data-toggle="tab" href="#po_quotation" id="btnsectionA">PO / Quotation</a></li>
            <li><a data-toggle="tab" href="#po" id="btnsectionA">PO</a></li>
            <li><a data-toggle="tab" href="#po_new" id="btnsectionA">PO New</a></li>
        </ul>
                    </div>
            
                </div>
       <div class="tab-content" style="height:auto!important;min-height:500px!important;">          
                   <div id="call_new_customer" class="tab-pane fade in active">
                   </div>
                   <div id="call_customer" class="tab-pane fade in">
                   </div>
                   <div id="visit" class="tab-pane fade in">
                   </div>
                   <div id="quotation" class="tab-pane fade in">
                   </div>
                   <div id="po_quotation" class="tab-pane fade in">
                   </div>
                   <div id="po" class="tab-pane fade in">
                   </div>
                   <div id="po_new" class="tab-pane fade in">
                   </div>
       </div>
</form>
    	</div> 
    </div>
    </div>
</div>
<script>
    
    $(document).ready(function(e){
        cekisi();
        $("#form").validate({
            submitHandler: function(form) {
    form.submit();
  },
           ignore: [],      
            rules: {
                'title': {required:true},
                'tag': {required:true}
            }
            , 
            messages: {
                'title': 'Wajib diisi',
                'tag': 'Wajib diisi'
            }
            });
                $("#periode").datepicker( {
                format: "yyyy-mm",
                startView: "months", 
                minViewMode: "months"
                    });
    });
    function cekisi(){
        
            $('#monthlys').empty();
            var sales=$('#sales').val();
            var year=$('#year').val();
            if(sales){
                $('#activity_sales').load('<?php echo base_url()?>activity_summary/loadactivity',{s:sales},function(e){
                    
            });
            }
//        if(sales && year){
//            $('#monthlys').append('<img src="<?php echo base_url()?>assets/img/nowload.gif" width="30px" height="30px"/>');
//            $('#monthlys').load('<?php echo base_url()?>sales_plan/loadisi',{s:sales,y:year},function(e){
//            });
//        }
    }
    function viewsummary(){
            var sales=$('#sales').val();
            var periode=$('#periode').val();
                $('#call_new_customer').load('<?php echo base_url()?>activity_summary/call_new_customer',{s:sales,p:periode},function(e){
                    
                 });
                 $('#call_customer').load('<?php echo base_url()?>activity_summary/call_customer',{s:sales,p:periode},function(e){
                    
                 }); 
                 $('#visit').load('<?php echo base_url()?>activity_summary/visit',{s:sales,p:periode},function(e){
                    
                });
                $('#quotation').load('<?php echo base_url()?>activity_summary/quotation',{s:sales,p:periode},function(e){
                    
                });
                $('#po_quotation').load('<?php echo base_url()?>activity_summary/po_quotation',{s:sales,p:periode},function(e){
                    
                });
                 $('#po').load('<?php echo base_url()?>activity_summary/po',{s:sales,p:periode},function(e){
                    
                });
                 $('#po_new').load('<?php echo base_url()?>activity_summary/po_new',{s:sales,p:periode},function(e){
                    
                });
    }
</script>