<!--
/*
** Job Arranger Manager
** Copyright (C) 2012 FitechForce, Inc. All Rights Reserved.
** Copyright (C) 2013 Daiwa Institute of Research Business Innovation Ltd. All Rights Reserved.
** Copyright (C) 2021 Daiwa Institute of Research Ltd. All Rights Reserved.
**
** Licensed to the Apache Software Foundation (ASF) under one or more
** contributor license agreements. See the NOTICE file distributed with
** this work for additional information regarding copyright ownership.
** The ASF licenses this file to you under the Apache License, Version 2.0
** (the "License"); you may not use this file except in compliance with
** the License. You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
**
**/
-->
<src:BaseUserControl x:Class="jp.co.ftf.jobcontroller.JobController.Form.JobResult.JobnetExecResultPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:src="clr-namespace:jp.co.ftf.jobcontroller.JobController"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" FontSize="11" FontFamily="Meiryo"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <src:DateConverter x:Key="DateConverter"/>
        <src:DetailVisibilityConverter x:Key="DetailVisibilityConverter"/>
    </UserControl.Resources>
    <Grid HorizontalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="75" />
            <RowDefinition Height="186*" />
        </Grid.RowDefinitions>
        <Label Content="{x:Static src:Properties.Resources.search_term_label_text}" Height="23" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" />
        <TextBox Height="23" Width="45" HorizontalAlignment="Left" Margin="75,5,0,0" Name="tbxFromYear" VerticalAlignment="Top"
                 VerticalContentAlignment="Center" MaxLength="4"
                 src:NumericTextBoxBehavior.IsNumeric="True"/>
        <Label Content="{x:Static src:Properties.Resources.year_label_text}" Height="23" HorizontalAlignment="Left" Margin="120,5,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combFromMonth" Height="23" Width="45" HorizontalAlignment="Left" Margin="160,5,0,0" VerticalAlignment="Top" IsEditable="True"  Loaded="ComboBox_Loaded" TextBoxBase.TextChanged="ComboBox_TextChanged" />
        <Label Content="{x:Static src:Properties.Resources.month_label_text}" Height="23" HorizontalAlignment="Left" Margin="205,5,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combFromDay" Height="23" Width="45" HorizontalAlignment="Left" Margin="245,5,0,0" VerticalAlignment="Top" IsEditable="True" Loaded="ComboBox_Loaded" TextBoxBase.TextChanged="ComboBox_TextChanged"/>
        <TextBlock Text="{x:Static src:Properties.Resources.day_label_text}" Height="23" HorizontalAlignment="Left" Margin="294,10,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combFromHour" Height="23" Width="45" HorizontalAlignment="Left" Margin="330,5,0,0" VerticalAlignment="Top" IsEditable="True" Loaded="ComboBox_Loaded" TextBoxBase.TextChanged="ComboBox_TextChanged"/>
        <Label Content="{x:Static src:Properties.Resources.hour_label_text}" Height="23" HorizontalAlignment="Left" Margin="375,5,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combFromMin" Height="23" Width="45" HorizontalAlignment="Left" Margin="415,5,0,0" VerticalAlignment="Top" IsEditable="True" Loaded="ComboBox_Loaded" TextBoxBase.TextChanged="ComboBox_TextChanged"/>
        <Label Content="{x:Static src:Properties.Resources.min_label_text}" Height="23" HorizontalAlignment="Left" Margin="460,5,0,0" VerticalAlignment="Top" />
        <Label Content="～" Height="23" HorizontalAlignment="Left" Margin="485,5,0,0" VerticalAlignment="Top" />
        <TextBox Height="23" Width="45" HorizontalAlignment="Left" Margin="515,5,0,0" Name="tbxToYear" VerticalAlignment="Top"
                 VerticalContentAlignment="Center" MaxLength="4"
                 src:NumericTextBoxBehavior.IsNumeric="True"/>
        <Label Content="{x:Static src:Properties.Resources.year_label_text}" Height="23" HorizontalAlignment="Left" Margin="560,5,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combToMonth" Height="23" Width="45" HorizontalAlignment="Left" Margin="600,5,0,0" VerticalAlignment="Top" IsEditable="True" Loaded="ComboBox_Loaded" TextBoxBase.TextChanged="ComboBox_TextChanged"/>
        <Label Content="{x:Static src:Properties.Resources.month_label_text}" Height="23" HorizontalAlignment="Left" Margin="645,5,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combToDay" Height="23" Width="45" HorizontalAlignment="Left" Margin="685,5,0,0" VerticalAlignment="Top" IsEditable="True" Loaded="ComboBox_Loaded" TextBoxBase.TextChanged="ComboBox_TextChanged"/>
        <TextBlock Text="{x:Static src:Properties.Resources.day_label_text}" Height="23" HorizontalAlignment="Left" Margin="734,10,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combToHour" Height="23" Width="45" HorizontalAlignment="Left" Margin="770,5,0,0" VerticalAlignment="Top" IsEditable="True" Loaded="ComboBox_Loaded" TextBoxBase.TextChanged="ComboBox_TextChanged"/>
        <Label Content="{x:Static src:Properties.Resources.hour_label_text}" Height="23" HorizontalAlignment="Left" Margin="815,5,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combToMin" Height="23" Width="45" HorizontalAlignment="Left" Margin="855,5,0,0" VerticalAlignment="Top" IsEditable="True" Loaded="ComboBox_Loaded" TextBoxBase.TextChanged="ComboBox_TextChanged"/>
        <Label Content="{x:Static src:Properties.Resources.min_label_text}" Height="23" HorizontalAlignment="Left" Margin="900,5,0,0" VerticalAlignment="Top" />
        <Button Content="{x:Static src:Properties.Resources.search_button_text}" Name="btnSearch" Height="23" Width="65" Margin="953,5,0,0"
                HorizontalAlignment="Left" VerticalAlignment="Top" Click="search_Click" IsDefault="True"/>
        <Button Content="{x:Static src:Properties.Resources.csv_button_text}" Name="btnCSV" Height="23" Width="65" Margin="1039,5,0,0"
                HorizontalAlignment="Left" VerticalAlignment="Top" Click="csv_Click"/>
        <Label Content="{x:Static src:Properties.Resources.jobnet_id_label_text}" Height="23" HorizontalAlignment="Left" Margin="0,0,0,12" VerticalAlignment="Bottom" />
        <TextBox Height="23" Width="245" HorizontalAlignment="Left" Margin="95,40,0,0" Name="tbxJobnetId" VerticalAlignment="Top"
                 VerticalContentAlignment="Center"/>
        <Label Content="{x:Static src:Properties.Resources.job_id_label_text}" Height="23" HorizontalAlignment="Left" Margin="350,40,0,0" VerticalAlignment="Top" />
        <TextBox Height="23" Width="245" HorizontalAlignment="Left" Margin="410,40,0,0" Name="tbxJobId" VerticalAlignment="Top"
                 VerticalContentAlignment="Center"/>
        <Label Content="{x:Static src:Properties.Resources.manage_id_label_text}" Height="23" HorizontalAlignment="Left" Margin="665,40,0,0" VerticalAlignment="Top" />
        <TextBox Height="23" Width="135" HorizontalAlignment="Left" Margin="730,40,0,0" Name="tbxManageId" VerticalAlignment="Top"
                 VerticalContentAlignment="Center" MaxLength="20" src:NumericTextBoxBehavior.IsNumeric="True"/>
        <Label Content="{x:Static src:Properties.Resources.user_name_label_text}" Height="23" HorizontalAlignment="Left" Margin="875,40,0,0" VerticalAlignment="Top" />
        <ComboBox Name="combUserName" Height="23" Width="150" HorizontalAlignment="Left" Margin="955,40,0,0" VerticalAlignment="Top" IsEditable="True"/>
        <DataGrid Name="dgResult" Grid.Row="1" AutoGenerateColumns="False" RowHeight="18"
                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White"
                  BorderBrush="Black" GridLinesVisibility="None" CanUserAddRows="False" SelectionUnit="Cell"
                  SelectionMode="Extended" RowHeaderWidth="0" IsReadOnly="True" HeadersVisibility="All"
                  HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" RowStyle="{StaticResource AutoHeightDataListRowStyle}"
                  KeyboardNavigation.TabNavigation="Once" ClipboardCopyMode="ExcludeHeader"
                  EnableColumnVirtualization="True" EnableRowVirtualization="True" ScrollViewer.CanContentScroll="True"
                  CellStyle="{StaticResource HLeftVCenterDataListCellStyle}"
                  SelectedCellsChanged="dgResult_SelectedCellsChanged">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="{x:Static src:Properties.Resources.detail_col_head_text}" Width="Auto">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="{x:Static src:Properties.Resources.detail_col_head_text}" Width="40" Height="18" Click="Detail_Click" VerticalContentAlignment="Center" FontSize="9">
                            <Button.Visibility>
                                <MultiBinding Converter="{StaticResource DetailVisibilityConverter}">
                                    <Binding Path="std_out" />
                                    <Binding Path="std_err"/>
                                </MultiBinding>
                            </Button.Visibility>
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>

                    <DataGridTemplateColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="HorizontalAlignment" Value="Stretch"/>
                            <Setter Property="HorizontalContentAlignment" Value="Left"/>
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="BorderThickness" Value="0"/>
                            <Setter Property="Focusable" Value="False"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </DataGridTemplateColumn.CellStyle>
                </DataGridTemplateColumn>

                <DataGridTextColumn Header="{x:Static src:Properties.Resources.run_date_col_head_text}"
                    Binding="{Binding Path=log_date, Converter={StaticResource DateConverter}}" Width="Auto" />
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.manage_id_col_head_text}"
                    Binding="{Binding Path=inner_jobnet_main_id}" Width="Auto" />
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.jobnet_id_col_head_text}"
                    Binding="{Binding Path=jobnet_id}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.job_id_col_head_text}"
                    Binding="{Binding Path=job_id}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.status_col_head_text}"
                    Binding="{Binding Path=message}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.jobnet_name_col_head_text}"
                    Binding="{Binding Path=jobnet_name}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.job_name_col_head_text}"
                    Binding="{Binding Path=job_name}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.user_name_col_head_text}"
                    Binding="{Binding Path=user_name}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.update_date_col_head_text}"
                    Binding="{Binding Path=update_date, Converter={StaticResource DateConverter}}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.return_value_col_head_text}"
                    Binding="{Binding Path=return_code}" Width="Auto"/>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</src:BaseUserControl>
