<%@ Page Language="C#" AutoEventWireup="true" UICulture="auto" Culture="auto" meta:resourcekey="PageResource1" %>

<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="System.Globalization" %>

<script runat="server">
    //@Override this is suggested by Microsoft, overriding the initialize culture function (that is
    //automatically called by the aspx.
    //Checks if the cookie exists and sets the language correctly, otherwise will fall-back to the default language
    //(English).
    protected override void InitializeCulture()
    {
   
        HttpCookie lang = Request.Cookies["siteLanguage"];

        String selectedLanguage = (lang != null) ? lang.Value : "en";
        UICulture = selectedLanguage;
        Culture = selectedLanguage;

        Thread.CurrentThread.CurrentCulture =
            CultureInfo.CreateSpecificCulture(selectedLanguage);
        Thread.CurrentThread.CurrentUICulture = new
            CultureInfo(selectedLanguage);
        base.InitializeCulture();
    }
</script>
<%  
    //this prevents the browser from caching templates. (on IE the templates where cached with the old language
    //too, so the change language was not working, this is a workaround for that).
 
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetExpires(DateTime.Now.AddMinutes(-30)); %>

<%--view template starts here (will be appended inside a row-fluid)--%>

<link href="<%= ResolveUrl("~/assets/libs/js/backgrid-0.3.5/lib/backgrid.css") %>" rel="stylesheet" />
<link href="<%= ResolveUrl("~/app/custom-screens/" + Path.GetFileNameWithoutExtension(this.Request.PhysicalPath) + "/" + Path.GetFileNameWithoutExtension(this.Request.PhysicalPath) + ".css")%>" rel="stylesheet" />
<link href="<%= ResolveUrl("~/assets/libs/js/jstree/themes/default/style.css") %>" rel="stylesheet" />
<link href="<%= ResolveUrl("~/assets/libs/js/bootstrap-timepicker/css/bootstrap-timepicker.css") %>" rel="stylesheet" />
<link href="<%= ResolveUrl("~/assets/libs/js/autocomplete/backbone.autocomplete.css") %>" rel="stylesheet" />
<link href="<%= ResolveUrl("~/assets/libs/js/multiselect/virtual-select.min.css") %>" rel="stylesheet" />

<div class="row-fluid subnavbar fixed-subnavbar not-print" style="min-width:1305px;"> 
    <div class="form-inline pull-left span11" style="min-width:1500px;"> 
        <label class="control-label" for="dateStartTbx" data-bind="classes: { hide: showShiftPickers, }" > 
            <asp:localize runat="server" meta:resourcekey="date_start_tbx_label" />
        </label>
        <label class="input-prepend" data-bind="classes: { hide: showShiftPickers, }"  > 
            <span class="add-on"><i class="icon-calendar"></i></span>
            <input type="text" id="dateStartTbx" class="input-date" style="width:75px;z-index:1000;" data-bind="value: start">
        </label>
        <label class="control-label" for="dateEndTbx" data-bind="classes: { hide: showShiftPickers, }" > 
            <asp:localize runat="server" meta:resourcekey="date_end_tbx_label" />
        </label>
        <label class="input-prepend" data-bind="classes: { hide: showShiftPickers, }" > 
            <span class="add-on"><i class="icon-calendar"></i></span>
            <input type="text" id="dateEndTbx" class="input-date" style="width:75px;z-index:1000;" data-bind="value: end">
        </label>
         <label class="control-label" data-bind="classes: { hide: showShiftPickers, }" > 
            <asp:localize runat="server" meta:resourcekey="equipment_data_entry_combo_label" />
            <input autocomplete="off" type="text" class="equipment-input-picker" id="equipmentPicker" style="cursor: pointer;" data-bind="value: equipmentPickerName," placeholder="<asp:Localize runat=server meta:resourcekey=item_equipment_holder />"  readonly />
        </label>
        <label class="control-label" data-bind="classes: { hide: showShiftPickers, }"> 
            <asp:localize runat="server" meta:resourcekey="shift_combo_label" />
            <select style="width:55px;" data-bind="value: shiftId, options: shifts, optionsDefault: { label: '<asp:localize runat=server meta:resourcekey=shift_combo_all_opt />', value: '-'} ">
            </select>
        </label>
        <button id="backNavBtn" class="btn btn-primary " style="margin-bottom:5px;margin-left:10px;" data-bind="classes: { hide: not(showShiftPickers), }">
                    <asp:Localize runat="server" meta:resourcekey="back_item_btn_label" />
        </button> 
        <label class="control-label" data-bind="classes: { hide: not(showShiftPickers), }">
                    <asp:localize runat="server" meta:resourcekey="selected_date_tbx_label" />
        </label>
        <input type="text" style="width:75px; text-align:center; margin-top: -5px;" data-bind="value: selectedDate, classes: { hide: not(showShiftPickers), }" readonly />
       
        <label class="control-label" data-bind="classes: { hide: not(showShiftPickers), }">
                    <asp:localize runat="server" meta:resourcekey="selected_shift_tbx_label" />
        </label>  
        <input type="text" style="width:20px; text-align:center; margin-top: -5px;" data-bind="value: selectedShift, classes: { hide: not(showShiftPickers), }"  readonly />

        <button id="forwardNavBtn" class="btn btn-primary" style="margin-bottom:5px;margin-left:10px;" data-bind="classes: { hide: not(showShiftPickers), }">
                    <asp:Localize runat="server" meta:resourcekey="forward_item_btn_label" />
        </button>
        <label class="control-label" data-bind="classes: { hide: showShiftPickers , }">
            <asp:localize runat="server" meta:resourcekey="crew_combo_label" />
            <select style="width:55px;" data-bind="value: crewId, options: crews, optionsDefault: { label: '<asp:localize runat=server meta:resourcekey=crew_combo_all_opt />', value: '-' } "></select> 
        </label>
        <label class="control-label">
            <div class="float-left"><asp:localize runat="server" meta:resourcekey="logEntryType_combo_label" /></div>
        </label>
        <label class="control-label"  style="width:140px !important">
            <div id="types-picker-multi-select"></div>
       </label>

      <%--   <label class="control-label" data-bind="classes: { hide: showShiftPickers , }">
            <asp:localize runat="server" meta:resourcekey="logEntryStatus_combo_label" />
            <select style="width:180px;" data-bind="value: statusCodeId, options: statusCodes, optionsDefault: { label: '<asp:localize runat=server meta:resourcekey=logEntryType_combo_all_opt />', value: '-' } "></select> 
        </label>--%>

             <label class="control-label">
            <div class="float-left"><asp:localize runat="server" meta:resourcekey="logEntryStatus_combo_label" /></div>
        </label>
        <label class="control-label"  style="width:160px !important">
            <div id="status-picker-multi-select"></div>
       </label>

        <label class="control-label" data-bind="classes: { hide: showShiftPickers , }">
            <asp:localize runat="server" meta:resourcekey="search_label" />
            <input type="text" class="input-large clear-search" style="margin-top:-4px; width:80px;" data-bind="value: trim(searchText)," placeholder="<asp:Localize runat=server meta:resourcekey=search_place_holder />" />
        </label>   
        <button id="refreshBtn" class="btn btn-primary" style="margin-bottom:5px;margin-left:10px;" title="<asp:localize runat=server meta:resourcekey=refresh_btn_title />">
            <i class="fa fa-refresh"></i>
        </button>
        <button id="excelBtn" class="btn btn-excel pull-right" style="margin-left:15px; margin-bottom:2px;" title="<asp:localize runat=server meta:resourcekey=excel_btn_title />">
            <i class="fa fa-file-excel-o"></i>
        </button>
        <div class="pull-right form-inline" style="margin-top:-6px;">
            <button id="printBtn" class="btn btn-primary hide"  style="margin-bottom:5px;margin-left:10px;" title="<asp:localize runat=server meta:resourcekey=print_btn_title />" >
                <i class="fa fa-print"></i>
            </button>
            <button id="addItemBtn" class="btn btn-primary">
                    <asp:Localize runat="server" meta:resourcekey="add_item_btn_label" />
            </button>
          
         <%--   <button id="shiftViewBtn" class="btn btn-primary btn-left hide" data-bind="classes: { hide: showShiftPickers , }">
                    <asp:Localize runat="server" meta:resourcekey="shift_view_btn_label" />
            </button> 
            <button id="searchViewBtn" class="btn btn-primary btn-left hide" data-bind="classes: { hide: not(showShiftPickers) , }">
                    <asp:Localize runat="server" meta:resourcekey="search_view_btn_label" />
            </button> --%>
        </div>
    </div>
</div>
<div>
    
   <div id="pageborder" style="margin-bottom:5px !important"></div>

    
    <div class="split-left left not-print" style="margin-top:6.1%">
        <div class="no-data-poster row-fluid text-center animated fadeIn not-print" data-bind="classes: { hide: any(hasData, isLoading), }" style="height:500px;">
            <div class="row-fluid" style="position:relative;top:100px;">
                <i class="fw-icon-circle-blank fw-icon-4x" style="font-size:115px;"></i>
            </div>
            <div class="row-fluid" style="position:relative;top:115px;">
                <h3 style="font-size:50px;">
                    <asp:localize runat="server" meta:resourcekey="no_data_available" />
                </h3>
            </div>
        </div>
        <div class="no-data-poster row-fluid text-center animated fadeIn not-print" data-bind="classes: { hide: not(isLoading), }" style="height:500px;">
            <div class="row-fluid" style="position:relative;top:100px;">
                <i class="fa fa-cog fw-icon-4x fa-spin" style="font-size:115px;"></i>
            </div>
            <div class="row-fluid" style="position:relative;top:115px;">
                <h3 style="font-size:50px;">
                    <asp:localize runat="server" meta:resourcekey="loading_data" />
                </h3>
            </div>
        </div>
        <div id="grid-logBook" class="items-grid-container backgrid-container" data-bind="classes: { hideAll: any(not(hasData), isLoading), }"></div>
    </div>       
    <div class="split-right right not-print">
        <div data-bind="classes: { hide: (showDataEntryMode), }">     
            <div class="row-fluid" style="margin-top:20%">
                <i class="fw-icon-arrow-left" style="font-size:180px;margin-left:10%;"></i>
            </div>
            <div class="row-fluid" style="text-align: center;">
                <h3 style="font-size:50px;line-height:50px;">
                    <asp:localize runat="server" meta:resourcekey="no_item_selected" />
                </h3>
            </div>
        </div> 
        <div id="outer" data-bind="classes: { hideAll: not(showDataEntryMode), }" style="background-color:#e5eaf6">
            <div id="inner_fixed_top">
                <div class="row entry-row"> 
                    <div class="span2 entry-div-label" >
                        <label class="control-label col-class entry-label" for="dateEntry" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="date_entry_tbx_label" />
                        </label>
                    </div>
                    <div class="span2">
                        <label class="input-prepend">
                            <span class="add-on"><i class="icon-calendar"></i></span>
                            <input type="text" id="dateEntry" class="input-date" style="width:75px;z-index:1000;" data-bind="value: itemDate">
                        </label>   
                    </div>
                    <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="time_data_entry_combo_label" />
                        </label>           
                    </div>
                    <div class="span2">
                        <div class="input-group bootstrap-timepicker timepicker">
                             <label class="input-prepend"> 
                                 <span class="add-on"><i class="icon-time"></i></span>
                                <input id="timepicker1" type="text" class="form-control input-small" data-bind="value: itemTime">
                             </label>                        
                        </div>
                    </div>
                </div>
                <div class="row entry-row"> 
                    <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="mo_data_entry_label" />
                        </label> 
                    </div>
                    <div class="span2" >
                        <input type="text" id="input-melt-order" class="input-large clear-search" style="margin-top:-4px; width:100%;" data-bind="value: trim(itemMeltOrder)" placeholder="<asp:Localize runat=server meta:resourcekey=title_data_entry_place_holder />" disabled/>
                    </div>    

                    <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="shift_data_entry_combo_label" />
                        </label>
                    </div>
                    <div class="span1"> 
                        <input type="text" style="width:55px;" data-bind="value: itemShift," readonly/>
                    </div>

                    <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="crew_data_entry_combo_label" />
                        </label>           
                    </div>
                    <div class="span2">
                        <input type="text" style="width:55px;" data-bind="value: itemCrew," readonly />
                    </div>

                           
               


                </div>
                <div class="row entry-row">
                    <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="logEntryType_data_entry_label" />
                        </label>
                    </div>
                    <div class="span2">
                        <select style="width:110px;" data-bind="value: itemLogEntryType, options: logEntryTypes," />
                    </div>
                    <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="equipment_data_entry_combo_label" />
                        </label>           
                    </div>
                    <div class="span2">
                        <input autocomplete="off" type="text" class="equipment-input" id="equipmentEntry" style="cursor: pointer;" data-bind="value: equipmentDataEntryName," placeholder="<asp:Localize runat=server meta:resourcekey=item_equipment_holder />" readonly />
                    </div>
                </div> 
                <div class="row entry-row">
                    <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="authors_data_entry_label" />
                        </label>
                    </div>
                    <div class="span2">
                        <input type="text" id="input-author" class="input-large clear-search" style="margin-top:-4px; width:110px;" data-bind="value: trim(itemAuthor)," placeholder="<asp:Localize runat=server meta:resourcekey=authors_data_entry_place_holder />"/>
                    </div>
                    <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="logEntryStatus_data_entry_label" />
                        </label>
                    </div>
                    <div class="span2">
                        <select style="width:200px;" data-bind="value: itemStatusCodeId, options: statusCodes," />
                    </div>
               
                </div>
                <div class="row entry-row">
                     <div class="span2 entry-div-label">
                        <label class="control-label col-class entry-label" style="padding-right: 0px;">
                            <asp:localize runat="server" meta:resourcekey="title_data_entry_label" />
                        </label> 
                    </div>
                     <div class="span2" >
                        <input type="text" id="input-title" class="input-large clear-search" style="margin-top:-4px; width:490px;" data-bind="value: trim(itemTitle)" placeholder="<asp:Localize runat=server meta:resourcekey=title_data_entry_place_holder />" />
                    </div>              
               
                </div>
            </div>
            <div id="inner_remaining">
                <label id="textarea-title">
                    <asp:localize runat="server" meta:resourcekey="description_data_entry_label" />
                </label>
                <textarea id="entry-textarea" data-bind="value: trim(itemDescription),"></textarea>
            </div>
            <div id="inner_fixed_bottom">
                <div class="row">
                    <div class="span8">
                        <button id="saveItemBtn" class="btn btn-primary">
                            <asp:Localize runat="server" meta:resourcekey="save_item_btn_label" />
                        </button>
                    </div>
                    <div class ="span4">
                        <button id="deleteItemBtn" class="btn btn-secondary">
                            <asp:Localize runat="server" meta:resourcekey="delete_item_btn_label" />
                        </button>
                    </div>
                </div>
              </div>
        </div>
    </div>

    <div>
        <!--STEEL DYNAMICS LOGO PRINT OPTION-->
        <div class="print">
            <div class="badge-logo-title">
                <div id ="img-logo" style="margin-left:0px; /*margin-top:-100px;*/">
                    <img src='<%= ResolveUrl("~/app/custom-screens/" + Path.GetFileNameWithoutExtension(this.Request.PhysicalPath) + "/" + 
                    Path.GetFileNameWithoutExtension(this.Request.PhysicalPath) + ".jpg") %>' />
                </div>
            </div>
            <div class="badge-logo-title" style="margin-left: 500px !important; margin-top:-250px;">
                <h2 id="pdf-title">
                    <asp:localize runat="server" meta:resourcekey="title_tbx_label" />
                </h2>
            </div>
        </div>
        <div class="items-grid-container-print print backgrid" style="margin-top:25px !important"></div>
    </div>
</div>

<script id="equipment_declare_modal" type="text/x-handlebars-template">
    <div class="modal-header" style="min-width:700px !important;">    
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
        <h3><asp:Localize runat=server meta:resourcekey=equipment_declare_modal_title /></h3>
    </div>
    <div style="padding-bottom:0;padding-top:0; min-width:700px;" class="modal-body">
        <div style="max-height:500px;padding-bottom:0;" class="modal-body">
            <div class="row-fluid">
                <form class="form-horizontal" style="margin-bottom:0;">
                        <div style="height:330px;overflow:auto;" class="equipment-codes-tree cursor-pointer"></div>
                </form>
           </div>
        </div>
    </div>
    <div class="modal-footer" style="min-width:700px;">
        <button id="acceptBtn" class="btn btn-primary" > 
            <asp:Localize runat='server' meta:resourcekey='accept_btn_label' />
        </button>
        <button id="cancelBtn" class="btn" data-dismiss="modal">
            <asp:Localize runat='server' meta:resourcekey='cancel_btn_label' />
        </button>
    </div>
</script>