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

{% block title %}
    Antiback
{% endblock %}
{% block tail %}
    <script src="{{ url_for('static',filename='wgcomm/js/delete-check.js') }}"></script>
    <!-- INTERNAL DATATABLES JS -->
    <script src="static/wgcomm/js/table-editable.js"></script>
{% endblock %}
{% block tail_min %}
    <script src="{{ url_for('static',filename='wgcomm/js/delete-check.min.js') }}"></script>
    <!-- INTERNAL DATATABLES JS -->
    <script src="static/wgcomm/js/table-editable.min.js"></script>
{% 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">Antiback</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);">Antiback</a></li>
                            <li class="breadcrumb-item active" aria-current="page">List</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 mb-3">#}
                    {#                        <div class="btn-list">#}
                    {#                            <a href="{{ url_for("wgcomm_extern_inter_lock.web_extern_inter_lock_option") }}" class="btn btn-primary">#}
                    {#                                <i class="fe fe-plus-square"></i>Interlock Option#}
                    {#                            </a>#}
                    {#                        </div>#}
                    {#                    </div>#}
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-body tasks-table-container">
                                <div class="table-responsive">
                                    <table id="editable-file-datatable"
                                           class="table editable-table table-nowrap table-bordered  wp-100 active-tb">
                                        <thead class="table-head">
                                        <tr>
                                        <tr>
                                            <th class="bg-transparent border-bottom-0 w-5">Controller#</th>
                                            <th class="bg-transparent border-bottom-0">SN</th>
                                            <th class="bg-transparent border-bottom-0">Doors</th>
                                            <th class="bg-transparent border-bottom-0">Description</th>
                                            <th class="bg-transparent border-bottom-0 no-btn">Operation</th>
                                        </tr>
                                        </tr>
                                        </thead>
                                        <tbody class="table-body">
                                        {% for con in objlist %}
                                            {% if con.f_ControllerSN > 100000000 %}
                                                <tr id="con-{{ con.f_ControllerID }}">
                                                    <td class="text-muted fs-15 fw-semibold text-start">{{ con.f_ControllerNO }}</td>
                                                    <td class="text-muted fs-15 fw-semibold text-start">{{ con.f_ControllerSN }}</td>
                                                    <td class="text-muted fs-15 fw-semibold text-start">{{ con.f_DoorsNames }}</td>
                                                    <td class="text-muted fs-15 fw-semibold text-center">
                                                        {#                                                    <i hidden="hidden">{{ con.f_ForceWarn }}</i>#}
                                                        {#                                                    {% if con.f_ForceWarn %}#}
                                                        {#                                                        <i class="fa fa-check"></i>#}
                                                        {#                                                    {% else %}#}
                                                        {#                                                    {% endif %}#}
                                                        {% if (con.f_AntiBack)>0 %}
                                                            Enabled
                                                        {% else %}

                                                        {% endif %}
                                                    </td>

                                                    <td>
                                                        <div class="d-flex align-items-stretch">
                                                            <form action="{{ url_for('wgcomm_extern_anti_back.web_extern_anti_back_edit') }}"
                                                                  method="post">
                                                                <input type="hidden" name="csrf_token"
                                                                       value="{{ csrf_token() }}">
                                                                <input type="hidden" name="conID"
                                                                       value="{{ con.f_ControllerID }}">
                                                                <button class="btn btn-icon btn-primary-light me-2"
                                                                        data-id="{{ con.f_ControllerID }}"
                                                                        data-bs-toggle="tooltip" title=""
                                                                        data-bs-original-title="Edit">
                                                                    <i class="fe fe-edit"></i></button>
                                                            </form>
                                                        </div>
                                                    </td>
                                                </tr>
                                            {% endif %}
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--ROW CLOSED-->

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