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

{% block title %}
    Privilege
{% endblock %}
{% block tail %}
    <script src="{{ url_for('static',filename='wgcomm/js/pri-edit-copy.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-copy.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">CopyPrivilege</h1>
                    </div>
                    <div class="ms-auto pageheader-btn">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">DoorControl</li>
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Privilege</a></li>
                            <li class="breadcrumb-item active" aria-current="page">Copy</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">
                                <button href="#"
                                        class="btn btn-primary" id="btnpri_allowselected_usercopy"
                                        data-id="Copy left user permissions → to right users"
                                        data-name="Copy left user permissions → to right users"
                                        data-url="/pri_allowselected_usercopy"
                                >
                                    <i class="fe fe-plus-square"></i>Copy left user permissions → to right users
                                </button>

                                {#                                <button href="#"#}
                                {#                                        class="btn btn-primary btn-warning-light" id="btnpri_disallowselected"#}
                                {#                                        data-id="Prohibit Selected Users=>Selected Doors"#}
                                {#                                        data-name="Prohibit Selected Users=>Selected Doors"#}
                                {#                                        data-url="/pri_disallowselected"#}
                                {#                                >#}
                                {#                                    <i class="fe fe-trash"></i>Prohibit Selected Users=>Selected Doors#}
                                {#                                </button>#}
                                {#                                {% if g.extfunc5678_timeprofile %}#}
                                {#                                    <div class="py-2">#}
                                {#                                        <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 }}">#}
                                {#                                                    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">TimeProfile1-Free Time</option>#}
                                {#                                    </select>#}
                                {#                                {% endif %}#}
                                <div>
                                    <label>Note: Right user permissions cleared, then replaced<br>
                                        Multiple left users: permissions merged → copied to right [same door priority by Emp. ID]<br>
                                        Cannot select same user on both sides
                                    </label>
                                </div>

                                <p class="card-text text-warning" id="opSelectedResultInfo" hidden>
                                </p>
                                <p class="card-text text-warning" id="opResultInfo" hidden>
                                </p>
                            </div>
                        </div>
                    </div>

                    {#                    <div class="col-lg-8 col-xl-8">#}
                    <div class="col-lg-6 col-xl-6">
                        <div class="col-md-12">
                            <div class="card">
                                <div id="calendar3" 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 class="table table-bordered text-nowrap border-bottom wp-100"
                                                                {#                                                               id="basic-datatable">#}
                                                               id="responsive-datatableUser-src">
                                                            <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="chkalluser-src">
                                                                        <label for="chkalluser-src"
                                                                               class="custom-control-label"></label>
                                                                    </div>
                                                                </th>
                                                                <th class="bg-transparent border-bottom-0">User ID</th>
                                                                <th class="bg-transparent border-bottom-0">Name</th>
                                                                {#                                                                <th class="bg-transparent border-bottom-0">Card NO</th>#}
                                                                <th class="bg-transparent border-bottom-0">Department [Left]
                                                                </th>
                                                            </tr>
                                                            </thead>
                                                            <tbody class="table-body">
                                                            {% for con in objlist %}
                                                                <tr id="con-{{ con.f_ConsumerID }}-src">
                                                                    <td>
                                                                        <div class="d-flex align-items-stretch"
                                                                             style="width: 10px">
                                                                            <div class="custom-checkbox custom-control">
                                                                                <input type="checkbox"
                                                                                       data-bs-checkboxes="mygroup"
                                                                                       class="custom-control-input call-checkbox"
                                                                                       id="chk{{ con.f_ConsumerID }}-src">
                                                                                <label for="chk{{ con.f_ConsumerID }}-src"
                                                                                       class="custom-control-label"></label>
                                                                            </div>
                                                                        </div>
                                                                    </td>
                                                                    <td class="text-muted fs-15 fw-semibold text-start">{{ con.f_ConsumerNO }}</td>
                                                                    <td class="text-muted fs-15 fw-semibold text-start">{{ con.f_ConsumerName }}</td>
                                                                    {#                                                                    <td class="text-muted fs-15 fw-semibold text-start"#}
                                                                    {#                                                                        id="cardno-{{ con.f_ConsumerID }}-src">#}
                                                                    {#                                                                        {% if con.f_CardNO==None %}#}
                                                                    {#                                                                        {% else %}#}
                                                                    {#                                                                            {{ con.f_CardNO }}#}
                                                                    {#                                                                        {% endif %}#}
                                                                    {#                                                                    </td>#}
                                                                    <td class="text-muted fs-15 fw-semibold text-start">
                                                                        {% if con.f_GroupName %}
                                                                            {{ con.f_GroupName }}
                                                                        {% endif %}
                                                                    </td>
                                                                </tr>
                                                            {% endfor %}
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    {#                    <div class="col-lg-8 col-xl-8">#}
                    <div class="col-lg-6 col-xl-6">
                        <div class="col-md-12">
                            <div class="card">
                                <div id="calendar3" 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 class="table table-bordered text-nowrap border-bottom wp-100"
                                                                {#                                                               id="basic-datatable">#}
                                                               id="responsive-datatableUser">
                                                            <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="chkalluser">
                                                                        <label for="chkalluser"
                                                                               class="custom-control-label"></label>
                                                                    </div>
                                                                </th>
                                                                <th class="bg-transparent border-bottom-0">User ID</th>
                                                                <th class="bg-transparent border-bottom-0">Name</th>
                                                                {#                                                                <th class="bg-transparent border-bottom-0">Card NO</th>#}
                                                                <th class="bg-transparent border-bottom-0">
                                                                    Department [Right target users]
                                                                </th>
                                                            </tr>
                                                            </thead>
                                                            <tbody class="table-body">
                                                            {% for con in objlist %}
                                                                <tr id="con-{{ con.f_ConsumerID }}">
                                                                    <td>
                                                                        <div class="d-flex align-items-stretch"
                                                                             style="width: 10px">
                                                                            <div class="custom-checkbox custom-control">
                                                                                <input type="checkbox"
                                                                                       data-bs-checkboxes="mygroup"
                                                                                       class="custom-control-input call-checkbox"
                                                                                       id="chk{{ con.f_ConsumerID }}">
                                                                                <label for="chk{{ con.f_ConsumerID }}"
                                                                                       class="custom-control-label"></label>
                                                                            </div>
                                                                        </div>
                                                                    </td>
                                                                    <td class="text-muted fs-15 fw-semibold text-start">{{ con.f_ConsumerNO }}</td>
                                                                    <td class="text-muted fs-15 fw-semibold text-start">{{ con.f_ConsumerName }}</td>
                                                                    {#                                                                    <td class="text-muted fs-15 fw-semibold text-start"#}
                                                                    {#                                                                        id="cardno-{{ con.f_ConsumerID }}">#}
                                                                    {#                                                                        {% if con.f_CardNO==None %}#}
                                                                    {#                                                                        {% else %}#}
                                                                    {#                                                                            {{ con.f_CardNO }}#}
                                                                    {#                                                                        {% endif %}#}
                                                                    {#                                                                    </td>#}
                                                                    <td class="text-muted fs-15 fw-semibold text-start">
                                                                        {% if con.f_GroupName %}
                                                                            {{ con.f_GroupName }}
                                                                        {% endif %}
                                                                    </td>
                                                                </tr>
                                                            {% endfor %}
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--ROW CLOSED-->

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