{#
The Mia! Accounting Project
list.html: The account list

 Copyright (c) 2023 imacat.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2023/1/30
#}
{% extends "accounting/base.html" %}

{% block header %}{% block title %}{% if request.args.q %}{{ A_("Search Result for \"%(query)s\"", query=request.args.q) }}{% else %}{{ A_("Account Management") }}{% endif %}{% endblock %}{% endblock %}

{% block content %}

<div class="mb-2 accounting-toolbar">
  {% if accounting_can_edit() %}
    <a class="btn btn-primary text-nowrap d-none d-md-block" role="button" href="{{ url_for("accounting.account.create")|accounting_append_next }}">
      <i class="fa-solid fa-plus"></i>
      {{ A_("New") }}
    </a>
  {% endif %}
  <form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.account.list") }}" method="get" role="search" aria-labelledby="accounting-toolbar-search-label">
    <input id="accounting-toolbar-search" class="form-control form-control-sm" type="search" name="q" value="{{ request.args.q }}" placeholder=" " required="required">
    <label id="accounting-toolbar-search-label" for="accounting-toolbar-search" class="input-group-text">
      <button type="submit">
        <i class="fa-solid fa-magnifying-glass"></i>
        <span class="d-none d-md-inline">{{ A_("Search") }}</span>
      </button>
    </label>
  </form>
</div>

{% if accounting_can_edit() %}
  <div class="d-md-none accounting-material-fab">
    <a class="btn btn-primary" role="button" href="{{ url_for("accounting.account.create")|accounting_append_next }}">
      <i class="fa-solid fa-plus"></i>
    </a>
  </div>
{% endif %}

{% if list %}
  {% include "accounting/include/pagination.html" %}

  <div class="list-group">
  {% for item in list %}
    <a class="list-group-item list-group-item-action" href="{{ url_for("accounting.account.detail", account=item)|accounting_append_next }}">
      {{ item }}
      {% if item.is_need_offset %}
        <span class="badge rounded-pill bg-info">{{ A_("Needs Offset") }}</span>
      {% endif %}
    </a>
  {% endfor %}
  </div>
{% else %}
  <p>{{ A_("There is no data.") }}</p>
{% endif %}

{% endblock %}
