<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="HorarioMarcacaoFaltasDocente.aspx.vb"    Inherits="EnsinoBasico.HorarioMarcacaoFaltasDocente" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    
        <script type="text/javascript">
            function OnClientClose(oWnd, args) {

                var idSlot = args.get_argument();

                if (idSlot == null)
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("clearWindows");
                else if (idSlot != 0) {
                    SetBorderColor(idSlot, "red");

                    $find("<%= RadAjaxManager1.ClientID %>").
                        ajaxRequest("Rebind");
                }                
            }

            function OnMarcarFaltaComSumarioClose(oWnd, args) {

                var idSlot = args.get_argument();

                if (idSlot == null)
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("clearWindows");
                else  if (idSlot != 0) {
                    SetBorderColor(idSlot, "red");

                    $find("<%= RadAjaxManager1.ClientID %>").
                    ajaxRequest("OnMarcarFaltaComSumario");
                }
            }

            function SetBorderColor(idSlot, color) {
                if (idSlot == null) return;

                if (idSlot != 0) {
                    var scheduler = $find('<%=RadScheduler1.ClientID %>');
                    var slots = scheduler.get_appointments();


                    slots.forEach(function (slot) {
                        if (idSlot == slot._id) slot.set_borderColor(color);
                    });
                }
            }
        </script>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true" EnableScriptLocalization="true"></telerik:RadScriptManager>
    
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
            <Localization Cancel="Cancelar" Close="Fechar" Maximize="Maximizar" Minimize="Minimizar" No="Não" Reload="Recarregar" Restore="Restaurar" Yes="Sim" />
        </telerik:RadWindowManager>
   
        <telerik:RadWindowManager ID="RadWindowManager2" runat="server">
            <Localization Cancel="Cancelar" Close="Fechar" Maximize="Maximizar" Minimize="Minimizar" No="Não" Reload="Recarregar" Restore="Restaurar" Yes="Sim" />   
        </telerik:RadWindowManager>
    
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"></telerik:RadAjaxManager>
     
        <telerik:RadScheduler ID="RadScheduler1" runat="server" DataKeyField="Id" DataSubjectField="Subject"
            OverflowBehavior="Expand" Height="100%" DataStartField="Begining" DataEndField="Ending"
            AllowDelete="False" AllowEdit="False" AllowInsert="False" DisplayDeleteConfirmation="False"
            HoursPanelTimeFormat="H:mm" ReadOnly="True" ShowFooter="False"
            BorderColor="Red" BorderStyle="None" ShowAllDayRow="False" ShowNavigationPane="true"
            Culture="pt-PT" Localization-AdvancedCalendarToday="Hoje" Localization-HeaderToday="Hoje">

            <TimelineView ReadOnly="True" UserSelectable="False" />
            <WeekView UserSelectable="False" />
            <DayView ReadOnly="True" UserSelectable="False" ShowAllDayInsertArea="False" DayEndTime="00:00:00" DayStartTime="08:00:00" WorkDayEndTime="00:00:00" EnableExactTimeRendering="True" />
            <MonthView UserSelectable="False" />
            <Localization AdvancedCalendarToday="Hoje" />
        </telerik:RadScheduler>
    </form>
</body>
</html>
