/**
 * Created by Peter on 02/05/2017.
 */
/*!
 *
 * mtc_site_menu.js - A jQuery plugin for Site Menu
 * Version : 2017-05-26
 * Author(s) : Peter Carlyle, Dawid Bestrzynski
 *
 * Website: http://www.mtcmedia.co.uk
 *
 */

$(document).ready(function () {
    if ($('#parent_id').val() == 0) {
        $('#url').attr('disabled','disabled');
    }

    $('#parent_id').change(function () {
        if ($('#parent_id').val() == 0) {
            $('#url').attr('disabled','disabled');
        } else {
            $('#url').removeAttr('disabled');
        }
    });

    $('#manage-site-menus .ui-sortable').on('sortupdate', function () {
        $.ajax({
            type : 'POST',
            url: '/plugins/SiteMenu/admin/ajax.php',
            data: {
                menu_name : $('#orderbymenu').val()
            },
            success: function (data) {
                response = $.parseJSON(response);
            }
        });
    });
});
