{% extends "layout/pui-admin-layout.html" %}

{% set name = button|string + " Operator" %}
{% block title %}{{ name }}{% endblock %}

{% block admin_layout %}
    <div class="col-lg-10 mt-3">
        <div class="card br-card rounded-0 card-t-head mb-3">
            <div class="bg-holder d-none d-lg-block bg-left"></div>
            <div class="card-body top-nav-table-header">
                <div class="d-md-flex justify-content-between d-sm-block align-items-center">
                    <div class="mb-0 heading-text">{{ name }}</div>
                </div>
            </div>
        </div>

        <div class="card br-card rounded-0">
            <div class="card-body">

                <form class="needs-validation" novalidate method="post" action="{{ action }}">
                    <div class="row">
                        {% if isEdit %}
                            {% form_input field=form.id %}
                        {% endif %}

                        {% form_input field=form.name, wrapper="mb-3 col-md-12" %}

                        {% form_input field=form.accessType, wrapper="mb-3 col-md-6" %}
                        {% form_input field=form.status, wrapper="mb-3 col-md-6" %}

                        {% if auth_base == "USERNAME" %}
                            {% form_input field=form.username, wrapper="mb-3 col-md-12" %}
                        {% else %}
                            {% form_input field=form.email, wrapper="mb-3 col-md-12" %}
                        {% endif %}


                        {% if not isEdit %}
                            {% form_input field=form.password, wrapper="mb-3 col-md-12" %}
                        {% endif %}


                        <div class="col-12">
                            <div class="float-end">
                                <button type="submit" class="btn btn-primary">{{ button }}</button>
                                <a href="{{ url_for("operator_controller.list") }}" class="btn btn-danger ms-2">Cancel</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

{% endblock %}