<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Stemplingsur_Weblogg.Default" %>
<%@ Register assembly="DevExpress.Web.v18.1, Version=18.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web" tagprefix="dx" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="no">
	
<head runat="server">
	
	<title>Stemplingslogg</title>
	<link rel="icon" type="image/png" href="favicon.png" />
	
	<%--Styles--%>
	<style type="text/css">  
		body {overflow: hidden;margin:0px}
	</style> 
	 
	<%--Scripts--%>
	 <script type="text/javascript">

		 function gvOnInit(s, e) {
			 gvAdjustSize();            
		 }

		 function gvOnEndCallback(s, e) {             
			 gvAdjustSize();             
		 }

		 function gvOnControlsInitialized(s, e) {            
			ASPxClientUtils.AttachEventToElement(window, "resize", function(evt) {
				gvAdjustSize();
			});
		}
		function gvAdjustSize() {
			var height = Math.max(0, document.documentElement.clientHeight);            
			gvLogg.SetHeight(height - 80);           
		}
	   
		function Timer_Refresh(s,e)
		{
		    if (!gvLogg.InCallback())
			    gvLogg.PerformCallback('Getdata');
		}

		
		function GroupButton_click(s,e)
		{            
			if (s.name == 'gvLogg_Title_btnGroupLocation_0')
				gvLogg.PerformCallback('groupLocation');           
			else if(s.name == 'gvLogg_Title_btnGroupEmployee_0')
				gvLogg.PerformCallback('groupEmployee');
			else
				gvLogg.PerformCallback('cleargroup');
		}
         
		function ViewButton_click(s, e) {		   
		    gvLogg.PerformCallback('Getdata');
		}

	</script>
	
</head>
<body>
	<form id="form1" runat="server">
	<div>    
		<dx:ASPxImage ID="ASPxImage1" runat="server" ImageUrl="~/Images/CordelLogo.png" ShowLoadingImage="true">
		</dx:ASPxImage>
		<dx:ASPxGridView ID="gvLogg" runat="server" Width="100%" ClientInstanceName="gvLogg" AutoGenerateColumns="False" OnCustomGroupDisplayText="gvLogg_CustomGroupDisplayText" OnCustomCallback="gvLogg_CustomCallback" KeyFieldName="Id" Font-Size="10pt">
			<ClientSideEvents EndCallback="gvOnEndCallback" Init="gvOnInit" />
			
<SettingsAdaptivity>
<AdaptiveDetailLayoutProperties ColCount="1"></AdaptiveDetailLayoutProperties>
</SettingsAdaptivity>

			<Templates>
				<FooterRow> 
                    <div style="float:left;width:auto">                 
					<dx:ASPxTextBox ID="lblStatus" runat="server" Text='<%#Session["LastUpdate"] %>' BackColor="Transparent" ViewStateMode="Enabled" Width="190px">
						<Border BorderStyle="None" />
					</dx:ASPxTextBox>       
                        </div>
                    <div style="float:right">
                        <dx:ASPxTextBox ID="lblappversion" runat="server" Text='<%#((Stemplingsur_Weblogg.Models.ApkVersion)Session["appVersion"])?.Version %>' BackColor="Transparent" ViewStateMode="Enabled" Width="100%">
						<Border BorderStyle="None" />
					</dx:ASPxTextBox>       
                    </div>               
				</FooterRow>
				<TitlePanel>
				   <div style="float:left">
					   <dx:ASPxLabel ID="lblStatus" runat="server" Text="Stemplingslogg" Font-Bold="True" Font-Size="14pt"></dx:ASPxLabel>
				   </div>
					<div style="float:right;padding-left:3px">                        
						<dx:ASPxButton ID="btnPrint" runat="server" Text="Rapport" Font-Size="10pt" AutoPostBack="False">                            
							<ClientSideEvents Click="function(s, e) {
	window.open('ReportPage.aspx');
}" />
							<Image Url="~/Images/Action_Export_ToPDF.png">
							</Image>
						</dx:ASPxButton>
				   </div>
                    <div style="float:right;padding-left:20px">                        
						<dx:ASPxButton ID="btnCrewlist" runat="server" Text="Mannskapsliste" Font-Size="10pt" AutoPostBack="False">                            
							<ClientSideEvents Click="function(s, e) {
	popcrewlistdate.ShowAtElementByID(s.name);
}" />
							<Image Url="~/Images/Action_Export_ToPDF.png">
							</Image>
						</dx:ASPxButton>
				   </div>
					<div style="float:right">                        
						<dx:ASPxButton ID="btnGroupEmployee" runat="server" Text="Medarbeider" AutoPostBack="false" GroupName="G" Font-Size="10pt">
							<ClientSideEvents Click="GroupButton_click" />
						</dx:ASPxButton>
				   </div>                    
				   <div style="float:right">                        
						<dx:ASPxButton ID="btnGroupLocation" runat="server" Text="Lokasjon" AutoPostBack="false" GroupName="G" Font-Size="10pt">
							<ClientSideEvents Click="GroupButton_click" />
						</dx:ASPxButton>
				   </div>
				   <div style="float:right">
						
						<dx:ASPxButton ID="btnGroupClear" runat="server" Text="Ingen" AutoPostBack="false" GroupName="G" Font-Size="10pt">
							<ClientSideEvents Click="GroupButton_click" />
						</dx:ASPxButton>
				   </div>
					<div style="float:right;padding-top:5px;padding-right:5px;padding-left:15px">                        
						<dx:ASPxLabel ID="lblGrupper" runat="server" Font-Size="10pt" Text="Grupper : "></dx:ASPxLabel>
				   </div>
					<div style="float:right">                        
						<dx:ASPxButton ID="btnVisStatus2" runat="server" AutoPostBack="false" GroupName="V" Font-Size="10pt" UseSubmitBehavior="false" ToolTip="Viser ikke fordelte tids-stemplinger.">
							<ClientSideEvents Click="ViewButton_click" />
							<Image Height="16px" Url="~/Images/Status2.png" Width="16px">
							</Image>
						</dx:ASPxButton>
				   </div>                    
				   <div style="float:right">                        
						<dx:ASPxButton ID="btnVisStatus0" runat="server" AutoPostBack="false" GroupName="V" Font-Size="10pt" UseSubmitBehavior="false" ToolTip="Viser også brukere som ikke er stemplet inn.">
							<ClientSideEvents Click="ViewButton_click" />
							<Image Height="16px" Url="~/Images/Status0.png" Width="16px">
							</Image>
						</dx:ASPxButton>
				   </div>
				   <div style="float:right">
						
						<dx:ASPxButton ID="btnVisStatus1" runat="server" AutoPostBack="false" GroupName="V" Font-Size="10pt" UseSubmitBehavior="false" ToolTip="Viser alle brukere som er stemplet inn.">
							<ClientSideEvents Click="ViewButton_click" />
							<Image Height="16px" Url="~/Images/Status1.png" Width="16px">
							</Image>
						</dx:ASPxButton>
				   </div>
					<div style="float:right;padding-top:5px;padding-right:5px">                        
						<dx:ASPxLabel ID="lblVisning" runat="server" Font-Size="10pt" Text="Visning : "></dx:ASPxLabel>
				   </div>					
				</TitlePanel>
			</Templates>
			<SettingsPager Visible="False" Mode="ShowAllRecords">
			</SettingsPager>
			<Settings ShowTitlePanel="True" VerticalScrollableHeight="50" VerticalScrollBarMode="Visible" ShowFooter="True" ShowGroupedColumns="True" />
			<SettingsBehavior AllowDragDrop="False" />
			<SettingsDataSecurity AllowDelete="False" AllowEdit="False" AllowInsert="False" />
			<SettingsText Title="Stemplingsur Logg" EmptyDataRow="Ingen data tilgjengelig" />

<EditFormLayoutProperties ColCount="1"></EditFormLayoutProperties>
			<Columns>
				<dx:GridViewDataTextColumn FieldName="eId" VisibleIndex="2" ShowInCustomizationForm="True" Caption="Nr" Width="100px">
				</dx:GridViewDataTextColumn>
				<dx:GridViewDataTextColumn FieldName="Name" VisibleIndex="3" ShowInCustomizationForm="True" Caption="Navn" ExportWidth="200">
				</dx:GridViewDataTextColumn>
				<dx:GridViewDataTextColumn FieldName="TimestampInn" VisibleIndex="4" ShowInCustomizationForm="True" Caption="Stemplet inn" Width="200px">
				</dx:GridViewDataTextColumn>
				<dx:GridViewDataTextColumn FieldName="Location" VisibleIndex="7" ShowInCustomizationForm="True" Caption="Lokasjon">
				</dx:GridViewDataTextColumn>
				<dx:GridViewDataTextColumn Caption="Notat" Visible="False" VisibleIndex="8" ExportWidth="100">
				</dx:GridViewDataTextColumn>
				<dx:GridViewDataTextColumn FieldName="Id" Visible="False" VisibleIndex="0">
				</dx:GridViewDataTextColumn>
				<dx:GridViewDataTextColumn Caption="Ordre" FieldName="OrderNo" VisibleIndex="5">
				</dx:GridViewDataTextColumn>
				<dx:GridViewDataTextColumn Caption="Jobb" FieldName="TaskNo" VisibleIndex="6">
				</dx:GridViewDataTextColumn>
				<dx:GridViewDataImageColumn Caption="Status" FieldName="Status" VisibleIndex="1" Width="60px">
					<PropertiesImage ImageUrlFormatString="Images/Status{0}.png">
					</PropertiesImage>
				</dx:GridViewDataImageColumn>
			</Columns>
			<GroupSummary>
                <dx:ASPxSummaryItem DisplayFormat="{0} stk" FieldName="Name" SummaryType="Count" />
            </GroupSummary>
			<Styles>
				<GroupRow Font-Bold="True">
				</GroupRow>
				<TitlePanel HorizontalAlign="Left">
				</TitlePanel>
                
			</Styles>
		</dx:ASPxGridView>
	
	</div>
		 <dx:ASPxGlobalEvents ID="ge" runat="server">
		<ClientSideEvents ControlsInitialized="gvOnControlsInitialized" />
	</dx:ASPxGlobalEvents>
		<dx:ASPxTimer ID="timRefresh" runat="server" Enabled="false" ClientSideEvents-Tick="Timer_Refresh">
		</dx:ASPxTimer>
		<dx:ASPxGridViewExporter ID="StemplingsloggExport" runat="server" GridViewID="gvLogg">
		</dx:ASPxGridViewExporter>
	    <dx:ASPxPopupControl ID="popCrewListDate" runat="server" ClientInstanceName="popcrewlistdate" HeaderText="Velg en dato" OnWindowCallback="popCrewListDate_WindowCallback" PopupHorizontalAlign="LeftSides" PopupVerticalAlign="Below" Font-Size="10pt">
            <ClientSideEvents EndCallback="function(s, e) {
	 if (s.cp_redirect) {               
                window.open('ReportPage.aspx?report=crewlist');
                delete (s.cp_redirect);
                dtecrewlistdate.SetValue(null);
            }
    popcrewlistdate.Hide();
}" />
            <ContentCollection>
<dx:PopupControlContentControl runat="server">
    <dx:ASPxDateEdit ID="dteCrewListDate" runat="server" ClientInstanceName="dtecrewlistdate" Caption="Dato" AllowUserInput="False" Font-Size="10pt">
    </dx:ASPxDateEdit>
    <div style="float:right;margin-top:5px">                        
						<dx:ASPxButton ID="btnSelectDateOk" runat="server" Text="Ok" AutoPostBack="false"  Font-Size="10pt">
							<ClientSideEvents Click="function(s, e) {
	                            if(dtecrewlistdate.GetValue() != null)
                                    popcrewlistdate.PerformCallback();
}" />
						</dx:ASPxButton>
				   </div>
                </dx:PopupControlContentControl>
</ContentCollection>
        </dx:ASPxPopupControl>
	</form>
</body>
   
</html>
