<?php
  $settings = getSettings();
  $gKey = $settings['google_api_key'];
?>
<script>
    base_url = "<?= base_url() ?>";
    country_flag = '<?= $settings['country_flag'] ?>';
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=<?= $gKey ?>&libraries=places"></script>
<script src="<?= base_url('assets/js/bootstrap.min.js') ?>"></script>
<script src="<?= base_url('assets/js/pace.js') ?>"></script>
<script src="<?= base_url('assets/js/select2.full.min.js') ?>"></script>
<script src="<?= base_url('assets/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?= base_url('assets/js/dataTables.bootstrap.min.js') ?>"></script>
<script src="<?= base_url('assets/js/bootbox.min.js') ?>"></script>
<script src="<?= base_url('assets/js/app.min.js') ?>"></script>
<script src="<?= base_url('assets/js/locationpicker.js') ?>" type="text/javascript"></script>
<script src="<?= base_url('assets/js/custom-script.js') ?>"></script>
<script src="<?= base_url('assets/js/parsley.min.js') ?>"></script>
<script src="https://cdn.ckeditor.com/4.5.7/standard/ckeditor.js"></script>
<script src="<?= base_url('assets/js/bootstrap-datepicker.js') ?>"></script>
<script src="<?= base_url('assets/js/clockpicker.js') ?>" type="text/javascript"></script>
<script src="<?= base_url('assets/js/slick.min.js') ?>" type="text/javascript"></script>
<script src="<?= base_url('assets/js/custom.js') ?>" type="text/javascript"></script>

<script>
    jQuery('.clockpicker').clockpicker();
    jQuery( document ).ready(function() {
        if(jQuery('#rich_editor').length==1){CKEDITOR.replace('rich_editor');}
        if(jQuery('#rich_editor_1').length==1){CKEDITOR.replace('rich_editor_1');}
        if(jQuery('#rich_editor_2').length==1){CKEDITOR.replace('rich_editor_2');}
        if(jQuery('#rich_editor_6').length==1){CKEDITOR.replace('rich_editor_6');}
        if(jQuery('#rich_editor_8').length==1){CKEDITOR.replace('rich_editor_8');}
        if(jQuery('#rich_editor_9').length==1){CKEDITOR.replace('rich_editor_9');}

        if(jQuery('#rich_editor_3').length==1){CKEDITOR.replace('rich_editor_3',{language:'ar'});}
        if(jQuery('#rich_editor_4').length==1){CKEDITOR.replace('rich_editor_4',{language:'ar'});}
        if(jQuery('#rich_editor_5').length==1){CKEDITOR.replace('rich_editor_5',{language:'ar'});}
        if(jQuery('#rich_editor_7').length==1){CKEDITOR.replace('rich_editor_7',{language:'ar'});}
    });
    
    function doconfirm(){
        action = confirm("Are you sure to delete permanently?");
        if(action != true) return false;
    }

    <?php
        $ci = & get_instance();
        $controllerName = $ci->uri->segment(1);
        $actionName = $ci->uri->segment(2);
        $page = $controllerName . '-' . $actionName;

        switch ($page) {
            case 'Event-addEvent': ?>
                jQuery(function () {
                    jQuery('[date="start"]').datepicker({
                        format: 'dd - MM - yyyy',
                        startDate: '-0d',
                        endDate: '+90d'
                    });
                    jQuery('[date="end"]').datepicker({
                        format: 'dd - MM - yyyy',
                        startDate: '+1d',
                        endDate: '+90d'
                    });
                });
                jQuery('.datatable').DataTable({
                    "ordering" : jQuery(this).data("ordering"),
                    "order": [[ 0, "desc" ]]
                });
                <?php break; 
            default : ?>
                jQuery(function () {
                    jQuery('.datatable').DataTable({
                        "ordering" : jQuery(this).data("ordering"),
                        "order": [[ 0, "desc" ]]
                    });
                });
    <?php } ?>
</script>