$(function () {

    $("#global-loader").hide()
    // first tab
    $("input[name=metric_type]").on("click", function (e) {
        e.preventDefault();
        alertify.error("Available only in full version");
        return false;
    });

    var metricColor = $("select[name=metric_color] option:selected");
    $("select[name=metric_color]").on("change", function (e) {

        metricColor.prop("selected", true);
        alertify.error("Available only in full version");
    });

    var infoBoxIcon = $("select[name=info_box_icon] option:selected");
    $("select[name=info_box_icon]").on("change", function (e) {

        infoBoxIcon.prop("selected", true);
        alertify.error("Available only in full version");
    });

    // second tab

    $("input[name=name]").on("keydown", function (e) {
        e.preventDefault();
        alertify.error("Available only in full version");
        return false;
    });


    $("input[name=title]").on("keydown", function (e) {
        e.preventDefault();
        alertify.error("Available only in full version");
        return false;
    });

    var chartCategory = $("select[name=category] option:selected");
    $("select[name=category]").on("change", function (e) {

        chartCategory.prop("selected", true);
        alertify.error("Available only in full version");
    });

    var securityType = $("select[name=security_type] option:selected");
    $("select[name=security_type]").on("change", function (e) {

        if (securityType == "public") {
            $("#groups").prop("disabled", true);
        } else {
            $("#groups").prop("disabled", false);

        }

        securityType.prop("selected", true);
        alertify.error("Available only in full version");
    });

    $("#groups").on("change", function (e) {
        e.preventDefault();
        alertify.error("Available only in full version");
        return false;

    });

    $("input[name=chart_link]").on("click", function (e) {
        e.preventDefault();
        alertify.error("Available only in full version");
        return false;
    });


    // third tab


    var peformanceDataTable = $("select[name=performance_data_table] option:selected");
    $("select[name=performance_data_table]").on("change", function (e) {
        peformanceDataTable.prop("selected", true);
        alertify.error("Available only in full version");
    });

    var calculationColumn = $("select[name=calculation_column] option:selected");
    $("select[name=calculation_column]").on("change", function (e) {
        calculationColumn.prop("selected", true);
        alertify.error("Available only in full version");
    });


    var metricDirection = $("select[name=metric_direction] option:selected");
    $("select[name=metric_direction]").on("change", function (e) {
        metricDirection.prop("selected", true);
        alertify.error("Available only in full version");
    });

    var dateFilterColumn = $("select[name=date_filter_column] option:selected");
    $("select[name=date_filter_column]").on("change", function (e) {
        dateFilterColumn.prop("selected", true);
        alertify.error("Available only in full version");
    });

    var dateRange = $("select[name=date_range] option:selected");
    $("select[name=date_range]").on("change", function (e) {
        dateRange.prop("selected", true);
        alertify.error("Available only in full version");
    });



    var displayFormat = $("select[name=display_format] option:selected");
    $("select[name=display_format]").on("change", function (e) {
        displayFormat.prop("selected", true);
        alertify.error("Available only in full version");
    });


    $("input[name='custom_unit_input']").on("keydown", function (e) {
        e.preventDefault();
        alertify.error("Available only in full version");
        return false;
    });



    var comparedWith = $("select[name=compare_with] option:selected");
    $("select[name=compare_with]").on("change", function (e) {
        comparedWith.prop("selected", true);
        alertify.error("Available only in full version");
    });


    $("input[name='target_value_input']").on("keydown", function (e) {
        e.preventDefault();
        alertify.error("Available only in full version");
        return false;
    });

    $("input[name=drill_down]").on("click", function (e) {
        e.preventDefault();
        alertify.error("Available only in full version");
        return false;
    });



    var drillDownColumn = $("select[name='drill_down_columns[]'] option:selected");
    $("select[name='drill_down_columns[]']").on("change", function (e) {
        drillDownColumn.prop("selected", true);
        alertify.error("Available only in full version");
    });

    $("input[name=finish]").on("click", function (e) {
        window.parent.$("#add-metric-modal").modal('hide');
        window.parent.$("#edit-metric-modal").modal('hide');
    });

});
