{% extends 'wgcomm/base.html' %}
{% block head %}
    {#    <link href="/static/wgcomm/bootstrap-datetimepicker.min.css" rel="stylesheet"/>#}
{% endblock %}
{% block tail %}
    <script src="static/wgcomm/js/datepicker.js"></script>
    <script src="static/wgcomm/js/wgdatepicker.js"></script>

{% endblock %}
{% block tail_min %}
    <script src="static/wgcomm/js/datepicker.min.js"></script>
    <script src="static/wgcomm/js/wgdatepicker.min.js"></script>
{% endblock %}
{% block title %}
    EditTimeProfile
{% endblock %}

{% block main_content %}
    <!--app-content open-->
    <div class="app-content main-content mt-0">
        <div class="side-app">
            <!-- CONTAINER -->
            <div class="main-container container-fluid">

                <!-- PAGE-HEADER -->
                <div class="page-header">
                    <div>
                        <h1 class="page-title">EditTimeProfile</h1>
                    </div>
                    <div class="ms-auto pageheader-btn">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">Configuration</li>
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Time Profile</a></li>
                            <li class="breadcrumb-item active" aria-current="page">Edit</li>
                        </ol>
                    </div>
                </div>
                <!-- PAGE-HEADER END -->
                {% with messages = get_flashed_messages() %}
                    {% if messages %}
                        <div class="form-group">
                            <ul>
                                {% for message in messages %}
                                    <li class="text-danger">{{ message }}</li>
                                {% endfor %}
                            </ul>
                        </div>
                    {% endif %}
                {% endwith %}
                <!--ROW OPENED-->
                <div class="row">
                    <div class="col-lg-12 col-md-12">
                        <div class="card">
                            <form action="{{ url_for('wgcomm_timeprofile.web_timeprofile_edit') }}" method="post">
                                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                                {{ wgform._csrf }}
                                <div class="card-header border-bottom">
                                    <h4 class="mb-0">Time Profile Information</h4>
                                </div>
                                <div class="card-body">
                                    <div class="form-group">
                                        {{ wgform.f_ControlSegID.label }}<br>{{ wgform.f_ControlSegID.data }}
                                        <div hidden="hidden">
                                            {{ wgform.f_ControlSegID( class="form-control") }}
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        {{ wgform.f_ControlSegName.label }}
                                        {{ wgform.f_ControlSegName( class="form-control") }}
                                    </div>


                                    <div class="form-group">
                                        {{ wgform.f_BeginYMD.label }}
                                        <div id="begin-datepicker" class="input-group date"
                                             data-date-format="yyyy-mm-dd">
                                                <span class="input-group-addon input-group-text bg-primary-transparent"><i
                                                        class="fe fe-calendar text-primary-dark"></i></span>
                                            <input id="f_BeginYMD" name="f_BeginYMD" class="form-control" type="text"
                                                   value={{ wgform.f_BeginYMD.data }}    placeholder="Year-Month-Day  "/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        {{ wgform.f_EndYMD.label }}
                                        <div id="end-datepicker" class="input-group date"
                                             data-date-format="yyyy-mm-dd">
                                                <span class="input-group-addon input-group-text bg-primary-transparent"><i
                                                        class="fe fe-calendar text-primary-dark"></i></span>
                                            <input id="f_EndYMD" name="f_EndYMD" class="form-control" type="text"
                                                   value={{ wgform.f_EndYMD.data }}     placeholder="Year-Month-Day  "/>
                                        </div>
                                    </div>
                                    <div class="col-sm-12 col-md-12 col-xl-3 no-taskEnd-checkbox">
                                        <div class="form-group">
                                            <label class="custom-control custom-checkbox no-taskEnd-checkbox-container">
                                                <input type="checkbox" class="custom-control-input" id="f_Monday"
                                                       name="f_Monday"
                                                        {% if wgform.f_Monday.data %}
                                                       value="1" checked
                                                        {% else %}
                                                       value="0"
                                                        {% endif %}
                                                >
                                                <span class="custom-control-label"> {{ wgform.f_Monday.label }}</span>
                                            </label>
                                        </div>

                                        <div class="form-group">
                                            <label class="custom-control custom-checkbox no-taskEnd-checkbox-container">
                                                <input type="checkbox" class="custom-control-input" id="f_Tuesday"
                                                       name="f_Tuesday"
                                                        {% if wgform.f_Tuesday.data %}
                                                       value="1" checked
                                                        {% else %}
                                                       value="0"
                                                        {% endif %}
                                                >
                                                <span class="custom-control-label"> {{ wgform.f_Tuesday.label }}</span>
                                            </label>
                                        </div>
                                        <div class="form-group">
                                            <label class="custom-control custom-checkbox no-taskEnd-checkbox-container">
                                                <input type="checkbox" class="custom-control-input" id="f_Wednesday"
                                                       name="f_Wednesday"
                                                        {% if wgform.f_Wednesday.data %}
                                                       value="1" checked
                                                        {% else %}
                                                       value="0"
                                                        {% endif %}
                                                >
                                                <span class="custom-control-label"> {{ wgform.f_Wednesday.label }}</span>
                                            </label>
                                        </div>
                                        <div class="form-group">
                                            <label class="custom-control custom-checkbox no-taskEnd-checkbox-container">
                                                <input type="checkbox" class="custom-control-input" id="f_Thursday"
                                                       name="f_Thursday"
                                                        {% if wgform.f_Thursday.data %}
                                                       value="1" checked
                                                        {% else %}
                                                       value="0"
                                                        {% endif %}
                                                >
                                                <span class="custom-control-label"> {{ wgform.f_Thursday.label }}</span>
                                            </label>
                                        </div>
                                        <div class="form-group">
                                            <label class="custom-control custom-checkbox no-taskEnd-checkbox-container">
                                                <input type="checkbox" class="custom-control-input" id="f_Friday"
                                                       name="f_Friday"
                                                        {% if wgform.f_Friday.data %}
                                                       value="1" checked
                                                        {% else %}
                                                       value="0"
                                                        {% endif %}
                                                >
                                                <span class="custom-control-label"> {{ wgform.f_Friday.label }}</span>
                                            </label>
                                        </div>
                                        <div class="form-group">
                                            <label class="custom-control custom-checkbox no-taskEnd-checkbox-container">
                                                <input type="checkbox" class="custom-control-input" id="f_Saturday"
                                                       name="f_Saturday"
                                                        {% if wgform.f_Saturday.data %}
                                                       value="1" checked
                                                        {% else %}
                                                       value="0"
                                                        {% endif %}
                                                >
                                                <span class="custom-control-label"> {{ wgform.f_Saturday.label }}</span>
                                            </label>
                                        </div>
                                        <div class="form-group">
                                            <label class="custom-control custom-checkbox no-taskEnd-checkbox-container">
                                                <input type="checkbox" class="custom-control-input" id="f_Sunday"
                                                       name="f_Sunday"
                                                        {% if wgform.f_Sunday.data %}
                                                       value="1" checked
                                                        {% else %}
                                                       value="0"
                                                        {% endif %}
                                                >
                                                <span class="custom-control-label"> {{ wgform.f_Sunday.label }}</span>
                                            </label>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        Valid Time Zone#1
                                        <br>
                                        {{ wgform.f_BeginHMS1.label }}

                                        <input type="time" style="border-width: 1px; border-style: solid"
                                               id="f_BeginHMS1" name="f_BeginHMS1" min="00:00" max="23:59"
                                               value={{ wgform.f_BeginHMS1.data }}>


                                        {{ wgform.f_EndHMS1.label }}
                                        <input type="time" style="border-width: 1px; border-style: solid" id="f_EndHMS1"
                                               name="f_EndHMS1" min="00:00" max="23:59"
                                               value={{ wgform.f_EndHMS1.data }}>
                                    </div>
                                    <div class="form-group">
                                        Valid Time Zone#2<br>
                                        {{ wgform.f_BeginHMS2.label }}

                                        <input type="time" style="border-width: 1px; border-style: solid"
                                               id="f_BeginHMS2" name="f_BeginHMS2" min="00:00" max="23:59"
                                               value={{ wgform.f_BeginHMS2.data }}>

                                        {{ wgform.f_EndHMS2.label }}
                                        <input type="time" style="border-width: 1px; border-style: solid" id="f_EndHMS2"
                                               name="f_EndHMS2" min="00:00" max="23:59"
                                               value={{ wgform.f_EndHMS2.data }}>
                                    </div>
                                    <div class="form-group">
                                        Valid Time Zone#3<br>
                                        {{ wgform.f_BeginHMS3.label }}
                                        <input type="time" style="border-width: 1px; border-style: solid"
                                               id="f_BeginHMS3" name="f_BeginHMS3" min="00:00" max="23:59"
                                               value={{ wgform.f_BeginHMS3.data }}>
                                        {{ wgform.f_EndHMS3.label }}
                                        <input type="time" style="border-width: 1px; border-style: solid" id="f_EndHMS3"
                                               name="f_EndHMS3" min="00:00" max="23:59"
                                               value={{ wgform.f_EndHMS3.data }}>
                                    </div>
                                    <div class="card-header border-bottom">
                                        <h4 class="mb-0">Time-based access control  </h4>
                                    </div>
                                    <div class="form-group">
                                        <br>
                                        {{ wgform.f_ReaderCount.label }}
                                        {{ wgform.f_ReaderCount( class="form-control") }}
                                        <br>
                                        {{ wgform.f_LimitedTimesOfDayCurrentDay.label }}
                                        {{ wgform.f_LimitedTimesOfDayCurrentDay( class="form-control") }}
                                        <br>
                                        {{ wgform.f_LimitedTimesOfDayMonth.label }}
                                        {{ wgform.f_LimitedTimesOfDayMonth( class="form-control") }}
                                        <br>
                                        {{ wgform.f_LimitedTimesOfHMS1.label }}
                                        {{ wgform.f_LimitedTimesOfHMS1( class="form-control") }}
                                        <br>
                                        {{ wgform.f_LimitedTimesOfHMS2.label }}
                                        {{ wgform.f_LimitedTimesOfHMS2( class="form-control") }}
                                        <br>
                                        {{ wgform.f_LimitedTimesOfHMS3.label }}
                                        {{ wgform.f_LimitedTimesOfHMS3( class="form-control") }}
                                    </div>

                                    <div class="form-group">
                                        {{ wgform.f_ControlSegIDLinked.label }}
                                        {#                                        {{ wgform.f_ControlSegIDLinked( class="form-control") }}#}
                                        <select class="form-control  form-select  text-dark" id="f_ControlSegIDLinked"
                                                name="f_ControlSegIDLinked">
                                            {#                                            <option value="0" >0</option>#}
                                            {% for i in range(255) %}
                                                {% if i!=1 and i!=wgform.f_ControlSegID.data %}
                                                    <option value="{{ i }}"
                                                            {% if i==wgform.f_ControlSegIDLinked.data %}
                                                            selected
                                                            {% endif %}
                                                    >{{ i }}</option>
                                                {% endif %}
                                            {% endfor %}
                                        </select>
                                    </div>

                                    <div class="row p-5">
                                        <div class="btn-list text-end">
                                            <button id="submitcancel" name="submitcancel" class="btn btn-outline-danger"
                                                    type="submit" value="Cancel">
                                                <i class="fe fe-x-circle"></i>
                                                Cancel
                                            </button>
                                            <button id="submitsave" name="submitsave" class="btn btn-primary"
                                                    type="submit"
                                                    value="Save">
                                                <i class="fe fe-check-circle"></i>
                                                Save
                                            </button>
                                            {#                                            <button id="submitsave" name="submitsaveandadd" class="btn btn-primary"#}
                                            {#                                                    type="submit" value="Save And Continue">#}
                                            {#                                                <i class="fe fe-check-square"></i>#}
                                            {#                                                Save And Continue#}
                                            {#                                            </button>#}
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <!--ROW CLOSED-->
            </div>
        </div>
    </div>
    <!-- CONTAINER CLOSED -->
{% endblock %}
