﻿//Close calender information dialog
function close() {
    $('#closeCalendarInformation').click(function () {
        $('#CalendarInformation').dialog('close');
        return false;
    });
}
// open calender information dialog
function calenderinfo(eId, currentDate) {
    var url = "/Communication/Calendar/CalenderInformation/?CalendarId=" + eId + "&currentDate=" + currentDate;
    $("#CalendarInformation").load(url, null, function () {
        $("#CalendarInformation").attr("style", "display:block; overflow:visible;");
        $("#CalendarInformation").loaderShow();
        $("#CalendarInformation").dialog('open');
        $("#CalendarInformation").loaderHide();
        close();
    });
    return false;
}


$(document).ready(function () {
    $.ajaxSetup({ cache: false });

    ////////////////////////////AddStatusdialog/////////////////////////////////////////////////////////
    $('#AddStatusdialog').dialog({
        autoOpen: false,
        modal: true,
        draggable: false,
        resizable: false,
        width: 428,
        closeOnEscape: true,
        minHeight: 180
    });
    $("#btnInsertNote").css("cursor", "pointer");

    $('#btnInsertNote').click(function () {
        $('#AddStatusdialog').dialog('open');
        return false;
    });

    $('#AddStatusdialogclose').click(function () {
        $('#AddStatusdialog').dialog('close');
        return false;
    });


    $("#AddStatus").validate({
        rules: {
            statusheader: {
                required: true
            },
            statusText: {
                required: true
            }
        },
        messages: {
            statusheader: {
                required: window.BT.language.Validation.RequireValidation.format(window.BT.language.Status.Header)
            },
            statusText: {
                required: window.BT.language.Validation.RequireValidation.format(window.BT.language.Status.Text)
            }
        }
    });
    ////////////////////////////AddCommentsdialog/////////////////////////////////////////////////////////
    $('#AddCommentdialog').dialog({
        autoOpen: false,
        modal: true,
        draggable: false,
        resizable: false,
        width: 428,
        closeOnEscape: true,
        minHeight: 180
    });
    $('#AddCommentdialogClose').click(function () {
        $('#AddCommentdialog').dialog('close');
        return false;
    });

    function OpenAddCommentDialog(id) {
        $('#CommentStatusId').val(id);
        var x = $('#CommentStatusId').val();
        $('#AddCommentdialog').dialog('open');
        return false;
    }
    //------------------------------------
    $("#AddComment").validate({
        rules: {
            commentText: {
                required: true
            }
        },
        messages: {
            commentText: {
                required: window.BT.language.Validation.RequireValidation.format(window.BT.language.Comment.Text)
            }
        }
    });
    ////////////////////////////\AddCommentsdialog/////////////////////////////////////////////////////////

    $("#btnNotes").click(function () {
        window.location.href = '/Communication/Comments/index';
    });

    // calender information dialog
    $("#CalendarInformation").dialog({
        autoOpen: false,
        modal: true,
        draggable: false,
        resizable: false,
        width: 428,
        closeOnEscape: true,
        minHeight: 180
    });

    $(".ArrowRight").css("cursor", "pointer");
    // Clandar link

    $("#CalendarIcon").click(function () {
        window.location.href = '/Communication/Calendar/Index';
    });

    //group link
    $("#groupIcon").click(function () {
        window.location.href = '/Groups/Home/MyGroups';
    });

    //Contacts link
    $("#contactsIcon").click(function () {
        window.location.href = '/Communication/Contacts/Index';
    });
    $("#articleIcon").click(function () {
        window.location.href = '/Knowledge/Article';
    });
});

