<?php

function ftm_geo_target_public_styles(){

    wp_enqueue_style('ftm_geo_target_table_styles_public', plugins_url('ftm-geo-target/css/ftm_geo_table_css.css') , array(), rand(111,9999), 'all');

}

function ftm_geo_target_styles(){

    GLOBAL $plugin_path;

    wp_enqueue_media();

    //JS
    wp_register_script('ftm_geo_target_js',
        plugins_url('/ftm-geo-target/js/ftm_geo_target_custom.js'),
        array('jquery-ui-core',
            'jquery-ui-accordion',
            'jquery-ui-button',
            'jquery-ui-datepicker',
            'jquery-ui-dialog',
            'jquery-ui-draggable',
            'jquery-ui-droppable',
            'jquery-ui-mouse',
            'jquery-ui-position',
            'jquery-ui-selectable',
            'jquery-ui-resizable',
            'jquery-ui-sortable',
            'jquery-ui-tooltip',
            'jquery-ui-tabs',
            'jquery-effects-fade',
            'jquery-effects-transfer'
        ),
        rand(111,9999));
    wp_register_script('ftm_geo_target_jquery.validate', plugins_url('/ftm-geo-target/js/jquery.validate.min.js'));
    wp_register_script('ftm_geo_target_multiselect_js', plugins_url('/ftm-geo-target/js/multiselect.min.js'));
    wp_register_script('ftm_geo_target_chosen_js', plugins_url('/ftm-geo-target/js/chosen.jquery.min.js'));
    wp_register_script('bootstrap_5_js', '//cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js', [], '5.0.2');
    wp_register_script('autoCompletejs-js', plugins_url('/ftm-geo-target/js/tarekraafat-autocomplete-10.2.6.js'));



}

function ftm_geo_target_enqueue_admin_styles() {
    //CSS
    wp_enqueue_style('ftm_geo_target_styles_ui', plugins_url('/ftm-geo-target/css/jquery-ui.min.css'));
    wp_enqueue_style('ftm_geo_target_styles_ui_structure', plugins_url('/ftm-geo-target/css/jquery-ui.structure.min.css'));
    wp_enqueue_style('ftm_geo_target_styles_ui_theme', plugins_url('/ftm-geo-target/css/jquery-ui.theme.min.css'));
    wp_enqueue_style('ftm_geo_target_styles', plugins_url('/ftm-geo-target/css/ftm_geo_target.css'), [], FTM_GT_VERSION);
    wp_enqueue_style('ftm_geo_target_bootstrap', '//cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css', [], '5.0.2');
    wp_enqueue_style('ftm_geo_target_bootstrap_glyps', '//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css', [], '3.0.0');
    wp_enqueue_style('ftm_geo_target_chosen_css', plugins_url('/ftm-geo-target/css/chosen.min.css'));
    wp_enqueue_style('autoCompletejs-css', plugins_url('/ftm-geo-target/css/tarekraafat-autocomplete-10.2.6.css'));


    //JS
    wp_enqueue_script('ftm_geo_target_multiselect_js');
    wp_enqueue_script('ftm_geo_target_js');
    wp_enqueue_script('ftm_geo_target-ui');
    wp_enqueue_script('ftm_geo_target_jquery.validate');
    wp_enqueue_script('bootstrap_5_js');
    wp_enqueue_script('ftm_geo_target_chosen_js');
    wp_enqueue_script('autoCompletejs-js');


}



add_action('admin_menu', 'ftm_geo_target_menu');
//add_action('admin_head', 'ftm_geo_target_styles');
add_action('admin_print_styles', 'ftm_geo_target_styles');
//add_action('wp_enqueue_scripts', 'ftm_geo_target_public_styles');
// add_action('plugins_loaded', 'ftm_gt_update_db_check');
