<?php
global $hooks;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$hooks->add_action('silex_action','the_dashboard'); 
function dashboard_title(){
    echo "General Status";
}

function dashboard_js() {
    ?>
	
	<script src="/assets/global/plugins/select2/js/select2.full.min.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/jquery-validation/js/additional-methods.min.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/bootstrap-wizard/jquery.bootstrap.wizard.min.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/jquery-repeater/jquery.repeater.js" type="text/javascript"></script>
	<script src="/assets/global/scripts/datatable.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/datatables/datatables.min.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.js" type="text/javascript"></script>
	<script src="/assets/modul-js/common/dashboard/dashboard.js"></script>
<?php }

function dashboard_css() {
    ?>
	<link href="/assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.css" rel="stylesheet" type="text/css" />
	<link href="/assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.css" rel="stylesheet" type="text/css" />
	<link href="/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/global/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/global/plugins/bootstrap-sweetalert/sweetalert.css" rel="stylesheet" type="text/css" />
	<link href="/assets/global/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
    
<?php }

function dashboard_so_js() {
    ?>
	<script src="/assets/global/scripts/datatable.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/datatables/datatables.min.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/jspdf.js"></script>
	<script src="/assets/modul-js/common/dashboard/dashboard.so.js"></script>
	<script src="/assets/global/plugins/html2canvas/html2canvas.min.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/html2canvas/base64.js" type="text/javascript"></script>
	<script src="/assets/global/plugins/html2canvas/canvas2image.js" type="text/javascript"></script>
<?php }

function the_dashboard(){
	global $app;

	$app->get('/dashboard', function(){ 
		global $hooks;
		global $app;
		
		$hooks->add_action('global_css', "dashboard_css");
        $hooks->add_action('global_js', "dashboard_so_js");
		$hooks->add_action('the_title',"dashboard_title");
		
		the_head();
		include 'dashboard.so.tpl.php';
				
		the_footer();
		
		return "";
	}); 
	

	$app->post('/dashboard/list', function(Request $request)  {
        $curpage = $request->get('page');
        include 'dashboard.so.list.php';
        return '';
    }); 
	
	$app->get('/dashboard/shipping-order', function(){ 
		global $hooks;
		global $app;
		
		$hooks->add_action('global_css', "dashboard_css");
        $hooks->add_action('global_js', "dashboard_so_js");
		$hooks->add_action('the_title',"dashboard_title");
		
		the_head();
		include 'dashboard.so.tpl.php';
				
		the_footer();
		
		return "";
	}); 
	

	$app->post('/dashboard/shipping-order/list', function(Request $request)  {
        $curpage = $request->get('page');
        include 'dashboard.so.list.php';
        return '';
    }); 
}

include 'dashboard.func.php';