<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Contractor App</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

  <!-- Theme style -->
  <link rel="stylesheet" href="<?php echo base_url();?>assets/css/AdminLTE.min.css">
  <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
  <link rel="stylesheet" href="<?php echo base_url();?>assets/css/custom.css" type="text/css" media="screen"/>


  <!-- 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="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

 <?php  include"includes/header.php";  ?>
  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
  
   <?php  include"includes/sidebar.php";  ?>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper ">
	<section class="content-header">
      <h1>Subscription Plan Setup</h1>
    </section>
  
 
		<section class="content">
			
		<div class="backf pt30">
		
			
			<div class="row mb20 d-flex">
            <form  method="post" id="add_subscription">
				<div class="col-sm-6 mb30">
					<div class="form-group">
					  <label for="usr">Plan Title:</label>
					  <input type="text" class="form-control" id="plan_title" name="plan_title" required>
					</div>
				</div>
				<div class="col-sm-6 mb30">
					<div class="form-group">
					  <label for="usr">Plan ID:</label>
					  <input type="text" class="form-control" id="plan_id" name="plan_id" required>
					</div>
				</div>
				<div class="col-sm-6 mb30">
					<div class="form-group">
					  <label for="usr">Interval:</label>
					  <select class="form-control" id="sub_interval" name="sub_interval"><option>Month</option></select>
					</div>
				</div>
				<div class="col-sm-6 mb30">
					<div class="form-group">
					  <label for="usr"># of Intervals:</label>
					  <input type="text" class="form-control" id="of_interval" name="of_interval" required>
					</div>
				</div>
				<div class="col-sm-6 mb30">
					<div class="form-group">
					  <label for="usr">Amount (USD):</label>
					  <input type="text" class="form-control" id="amount" name="amount" required>
					</div>
				</div>
				<div class="col-sm-6 mb30">
					<div class="form-group">
					  <label for="usr">Trial Period Days:</label>
					  <input type="text" class="form-control" id="trial_days" name="trial_days" required>
					</div>
				</div>
				<div class="col-sm-6 mb30">
					<div class="form-group">
					  <label for="usr">Group To Activate On User:</label>
					  <select class="form-control" id="user_activate" name="user_activate"><option>Month</option></select>
					</div>
				</div>
				<div class="col-sm-12 mb30">
					<div class="form-group text-center">
					  <button class="btn btn-success">SAVE</button>
					</div>
				</div>
                </form>
			</div>
			

      </div>
		
		</section>
		
		
		
  </div>
  
 
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <strong>Copyright &copy; 2019 </strong> All rights
    reserved.
  </footer>

  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript" src="https://canvasjs.com/assets/script/jquery.canvasjs.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>

<script src="<?php echo base_url();?>assets/js/adminlte.min.js"></script>




<script type="text/javascript">

var chart1 = new CanvasJS.Chart("c1",{

    data: [{
			type: "pie",
			startAngle: 45,
			showInLegend: "true",
			legendText: "{label}",
			indexLabel: "{label} ({y})",
			yValueFormatString:"#,##0.#"%"",
			dataPoints: [
				{ label: "Women", y: 36 },
				{ label: "Men", y: 43 },
				{ label: "Others", y: 3 }
			]
	}]
});
var chart2 = new CanvasJS.Chart("c2",{
    data: [
        {
            type: "pie",
            showInLegend: "true",
			legendText: "{label}",
			indexLabel: "{label} ({y})",
			yValueFormatString:"#,##0.#"%"",
            dataPoints: [
				{ label: "Whole App Users", y: 1024 },
				{ label: "Peak Hours", y: 800 },
				{ label: "Page Jumps", y: 550 }
			]
        }]
});
 
chart1.render();
chart2.render();



</script>


<script>
Highcharts.chart('c3', {
    chart: {
        type: 'bar'
    },
    subtitle: {
        text: 'Source: <a href="https://en.wikipedia.org/wiki/World_population">Wikipedia.org</a>'
    },
    xAxis: {
        categories: ['General', 'Vegeterian', 'Non-Veg'],
        title: {
            text: null
        }
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Population (millions)',
            align: 'high'
        },
        labels: {
            overflow: 'justify'
        }
    },
    tooltip: {
        valueSuffix: ' millions'
    },
    plotOptions: {
        bar: {
            dataLabels: {
                enabled: true
            }
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'top',
        x: -40,
        y: 80,
        floating: true,
        borderWidth: 1,
        backgroundColor:
            Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF',
        shadow: true
    },
    credits: {
        enabled: false
    },
    series: [{
        name: 'Year 1800',
        data: [107, 31, 635]
    }, ]
});
</script>

<script>
$(document).ready(function() {
    $('.datatble').DataTable();
	
	
} );
</script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
<script>
$(".upoadldbtn").click(function () {
    $(this).next().click();
});
$('form[id="add_subscription"]').validate({
 rules: {

	plan_title:{
		required:true,
		},
	plan_id:{
		required:true,
		},
	sub_interval:{
		required:true,
		},
	of_interval:{
		required:true,
		},
	amount:{
		required:true,
		},
	trial_days:{
		required:true,
		},
	user_activate:{
		required:true,
		},
		
	},
	
 submitHandler: function(form) {
  var data = $("#add_subscription").serialize();
 $.ajax({                                      
			  url: '<?php echo base_url() ?>index.php/admin/add_subscription',                 //the script to call to get data  
			  type:'post',
			  data: data,//you can insert url argumnets here to pass to api.php
				  success: function(data)          //on recieve of reply
				  {

					if(data == 1){
					alert('Data inserted Successfully');
					location.reload();
						
						}  
				 } 
			  });
 }	
});

</script>	
</body>
</html>
