{% extends 'wgcomm/base.html' %}

{% block title %}
    Modify user access permissions  
{% endblock %}
{#{% block tail %}#}
{#    <script src="{{ url_for('static',filename='wgcomm/js/console-getswipe.js') }}"></script>#}
{#    <script src="static/wgcomm/js/table-data.js"></script>#}
{#{% endblock %}#}
{#{% block tail_min %}#}
{#    <script src="{{ url_for('static',filename='wgcomm/js/console-getswipe.min.js') }}"></script>#}
{#    <script src="static/wgcomm/js/table-data.min.js"></script>#}
{#{% endblock %}#}

{% block tail %}
    <script src="{{ url_for('static',filename='wgcomm/js/pri-edit.js') }}"></script>
    <script src="static/wgcomm/js/table-data.js"></script>
{% endblock %}
{% block tail_min %}
    <script src="{{ url_for('static',filename='wgcomm/js/pri-edit.min.js') }}"></script>
    <script src="static/wgcomm/js/table-data.min.js"></script>
{% endblock %}

{% block main_content %}

    <!--app-content open-->
    <div class="app-content main-content mt-0" id="allpage">
        <div class="side-app">
            <!-- CONTAINER -->
            <div class="main-container container-fluid">
                <!-- PAGE-HEADER -->
                <div class="page-header">
                    <div>
                        <h1 class="page-title">User Access Privilege</h1>
                    </div>
                    <div class="ms-auto pageheader-btn">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">Configuration</li>
                            <li class="breadcrumb-item">user</li>
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Access PrivilegeEdit</a></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-md-12">
                        <div class="card">
                            <div class="card-body">
                                <p class="card-text">
                                    Name: {{ username }}
                                    {% if cardNO>0 %}
                                        &nbsp;&nbsp;&nbsp;&nbsp;CardNO: {{ cardNO }}
                                    {% endif %}
                                    {#                                    {% if syncinfo %}#}
                                    {#                                        &nbsp;&nbsp;&nbsp;&nbsp;{{ syncinfo }}#}
                                    {#                                    {% endif %}#}
                                </p>
                                <p class="card-text text-warning" id="opSelectedResultInfo" hidden>
                                </p>
                            </div>


                            <form action="{{ url_for('wgcomm_pri.web_pri_editUserPrivilege') }}" method="post"
                                  enctype="multipart/form-data" id="formA">
                                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                                {{ wgform._csrf }}
                                <input type="hidden" name="f_ConsumerID" value="{{ wgform.f_ConsumerID.data }}">
                                <input type="hidden" name="f_ConsumerName" value="{{ wgform.f_ConsumerName.data }}">

                                <div class="col-lg-12 col-xl-12">
                                    <div class="col-md-12">
                                        <div class="card">
                                            {#                                <div class="card-body tasks-table-container">#}
                                            {#                                    <div class="table-responsive">#}
                                            <div id="calendar2"
                                                 class="fc fc-media-screen fc-direction-ltr fc-theme-standard">
                                                <div class="card-body">
                                                    <div class="fc-view-harness fc-view-harness-active"
                                                         style="height: 500px;">
                                                        <div class="fc-list  fc-list-sticky fc-listMonth-view fc-view">
                                                            <div class="fc-scroller fc-scroller-liquid" id="logscroll"
                                                                 style="overflow: hidden auto;">
                                                                <div class="table-responsive">
                                                                    <table id="responsive-datatableDoor"
                                                                           class="table editable-table table-nowrap table-bordered  wp-100 active-tb">
                                                                        <thead class="table-head">
                                                                        <tr>
                                                                            <th class="bg-transparent border-bottom-0 no-btn"
                                                                                style="max-width: 4px">
                                                                                <div class="custom-checkbox custom-control">
                                                                                    <input type="checkbox"
                                                                                           data-bs-checkboxes="mygroup"
                                                                                           class="custom-control-input"
                                                                                           id="chkalldoor">
                                                                                    <label for="chkalldoor"
                                                                                           class="custom-control-label"></label>
                                                                                </div>
                                                                            </th>
                                                                            <th class="bg-transparent border-bottom-0">Door</th>

                                                                            {% if g.extfunc5678_timeprofile %}
                                                                                <th class="bg-transparent border-bottom-0">
                                                                                    TimeProfile
                                                                                </th>
                                                                            {% endif %}
                                                                            {#                                                <th class="bg-transparent border-bottom-0">In Controllers</th>#}
                                                                            {#                                                <th class="bg-transparent border-bottom-0">Description</th>#}
                                                                        </tr>
                                                                        </thead>
                                                                        <tbody class="table-body">
                                                                        {% for con in objlistDoor %}
                                                                            <tr>
                                                                                <td id="rwchk{{ con.f_DoorID }}">
                                                                                    <div class="d-flex align-items-stretch">
                                                                                        <div class="custom-checkbox custom-control">
                                                                                            <input type="checkbox"
                                                                                                   data-bs-checkboxes="mygroup"
                                                                                                   class="custom-control-input call-checkbox"
                                                                                                   id="ckd{{ con.f_DoorID }}"
                                                                                                   name="ckd{{ con.f_DoorID }}"
                                                                                                   value="{{ con.f_DoorID }}"
                                                                                                    {% if con.f_pri_active==1 %}
                                                                                                   checked
                                                                                                    {% endif %}
                                                                                            >
                                                                                            <label for="ckd{{ con.f_DoorID }}"
                                                                                                   class="custom-control-label"></label>
                                                                                        </div>
                                                                                    </div>
                                                                                </td>
                                                                                <td class="text-muted fs-15 fw-semibold text-start">{{ con.f_DoorName }}</td>
                                                                                {% if g.extfunc5678_timeprofile %}
                                                                                    <td class="text-muted fs-15 fw-semibold text-start"
                                                                                        id="info{{ con.f_DoorID }}">
                                                                                        {{ con.f_ControlSegID }}</td>
                                                                                {% endif %}
                                                                                {#                                                    #}
                                                                                {#                                                    <td class="text-muted fs-15 fw-semibold text-start">#}
                                                                                {#                                                        {{ con.f_infactSegID }}</td>#}
                                                                                {#                                                    <td class="text-muted fs-15 fw-semibold text-start">#}
                                                                                {#                                                        {{ con.f_compare }}</td>#}
                                                                            </tr>
                                                                        {% endfor %}
                                                                        </tbody>
                                                                    </table>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        {% if g.extfunc5678_timeprofile %}
                                            <div class="py-2">
                                                <label for="f_ControlSegID">Specify new time period  :</label>
                                                <select class="form-control  form-select  text-dark" id="f_ControlSegID"
                                                        name="f_ControlSegID">
                                                    <option value="1">TimeProfile1-Free Time</option>
                                                    {% for seginfo in timeprofiles %}
                                                        <option value="{{ seginfo.f_ControlSegID }}"
                                                                {% if selectedtimesegment==seginfo.f_ControlSegID %}
                                                                selected
                                                                {% endif %}>
                                                            TimeProfile{{ seginfo.f_ControlSegID }}-{{ seginfo.f_ControlSegName }}</option>
                                                    {% endfor %}
                                                </select>
                                            </div>
                                        {% else %}
                                            <select class="form-control  form-select  text-dark" id="f_ControlSegID"
                                                    name="f_ControlSegID" hidden="hidden">
                                                <option value="1" selected>TimeProfile1-Free Time</option>
                                            </select>
                                        {% endif %}
                                    </div>
                                </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>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <!--ROW CLOSED-->

            </div>
        </div>
    </div>
    <!-- CONTAINER CLOSED -->
{% endblock %}
