159 lines
		
	
	
		
			6.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			159 lines
		
	
	
		
			6.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {% extends "base.html" %}
 | |
| {% comment %}
 | |
| The Mia Accounting Application
 | |
| search.html: The template for the search results
 | |
| 
 | |
|  Copyright (c) 2020 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: 2020/7/21
 | |
| {% endcomment %}
 | |
| {% load static %}
 | |
| {% load i18n %}
 | |
| {% load mia_core %}
 | |
| {% load accounting %}
 | |
| 
 | |
| {% block settings %}
 | |
|   {% blocktrans asvar title with query=request.GET.q %}Search Result for “{{ query }}”{% endblocktrans %}
 | |
|   {% setvar "title" title %}
 | |
|   {% static "accounting/css/report.css" as file %}{% add_css file %}
 | |
| {% endblock %}
 | |
| 
 | |
| {% block content %}
 | |
| 
 | |
| <div class="btn-group btn-actions">
 | |
|   <div class="btn-group">
 | |
|     <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
 | |
|       <i class="fas fa-edit"></i>
 | |
|       {% trans "New" context "Accounting" as text %}{{ text|force_escape }}
 | |
|     </button>
 | |
|     <div class="dropdown-menu">
 | |
|       <a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
 | |
|         {{ _("Cash Expense")|force_escape }}
 | |
|       </a>
 | |
|       <a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
 | |
|         {{ _("Cash Income")|force_escape }}
 | |
|       </a>
 | |
|       <a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
 | |
|         {{ _("Transfer")|force_escape }}
 | |
|       </a>
 | |
|     </div>
 | |
|   </div>
 | |
|   {% with current_report_icon="fas fa-search" current_report_title=_("Search") %}
 | |
|     {% include "accounting/include/report-chooser.html" %}
 | |
|   {% endwith %}
 | |
|   <form class="btn btn-primary input-group" action="{% url "accounting:search" %}" method="get">
 | |
|     <input id="search-input" class="form-control form-control-sm search-input" type="text" name="q" value="{{ request.GET.q }}" />
 | |
|     <label for="search-input" class="search-label">
 | |
|       <button type="submit">
 | |
|         <i class="fas fa-search"></i>
 | |
|         {{ _("Search")|force_escape }}
 | |
|       </button>
 | |
|     </label>
 | |
|   </form>
 | |
| </div>
 | |
| 
 | |
| {% if record_list %}
 | |
|   {% include "mia_core/include/pagination.html" %}
 | |
| 
 | |
|   {# The table for large screens #}
 | |
|   <table class="table table-striped table-hover d-none d-md-table general-journal-table">
 | |
|     <thead>
 | |
|       <tr>
 | |
|         <th scope="col">{{ _("Date")|force_escape }}</th>
 | |
|         <th scope="col">{{ _("Account")|force_escape }}</th>
 | |
|         <th scope="col">{{ _("Summary")|force_escape }}</th>
 | |
|         <th class="amount" scope="col">{{ _("Debit")|force_escape }}</th>
 | |
|         <th class="amount" scope="col">{{ _("Credit")|force_escape }}</th>
 | |
|         <th scope="col">{{ _("Notes")|force_escape }}</th>
 | |
|         <th class="actions" scope="col">{{ _("View")|force_escape }}</th>
 | |
|       </tr>
 | |
|     </thead>
 | |
|     <tbody>
 | |
|       {% for record in record_list %}
 | |
|         <tr class="{% if not record.is_balanced or record.has_order_hole %} table-danger {% endif %}">
 | |
|           <td>{{ record.transaction.date|smart_date }}</td>
 | |
|           <td>{{ record.account.title|title_case }}</td>
 | |
|           <td><div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ record.summary|default:"" }}{% if not record.is_balanced %}
 | |
|             <span class="badge badge-danger badge-pill">
 | |
|               {{ _("Unbalanced")|force_escape }}
 | |
|             </span>
 | |
|           {% endif %}{% if record.has_order_hole %}
 | |
|             <span class="badge badge-danger badge-pill">
 | |
|               {{ _("Need Reorder")|force_escape }}
 | |
|             </span>
 | |
|           {% endif %}</div></td>
 | |
|           <td class="amount">{{ record.debit_amount|accounting_amount }}</td>
 | |
|           <td class="amount">{{ record.credit_amount|accounting_amount }}</td>
 | |
|           <td>{{ record.transaction.notes|default:"" }}</td>
 | |
|           <td class="actions">
 | |
|             <a href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}" class="btn btn-info" role="button">
 | |
|               <i class="fas fa-eye"></i>
 | |
|               {{ _("View")|force_escape }}
 | |
|             </a>
 | |
|           </td>
 | |
|         </tr>
 | |
|       {% endfor %}
 | |
|     </tbody>
 | |
|   </table>
 | |
| 
 | |
|   {# The list for small screens #}
 | |
|   <ul class="list-group d-md-none">
 | |
|     {% for record in record_list %}
 | |
|       <li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
 | |
|         <a class="list-group-item-action" href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}">
 | |
|           <div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
 | |
|             <div class="date-account-line">
 | |
|               {{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
 | |
|             </div>
 | |
|             <div class="d-flex justify-content-between align-items-center">
 | |
|               <div>
 | |
|                 {{ record.summary|default:"" }}
 | |
|                 {% if not record.is_balanced %}
 | |
|                   <span class="badge badge-danger badge-pill">
 | |
|                     {{ _("Unbalanced")|force_escape }}
 | |
|                   </span>
 | |
|                 {% endif %}
 | |
|                 {% if record.has_order_hole %}
 | |
|                   <span class="badge badge-danger badge-pill">
 | |
|                     {{ _("Need Reorder")|force_escape }}
 | |
|                   </span>
 | |
|                 {% endif %}
 | |
|               </div>
 | |
|               <div>
 | |
|                 {% if record.debit_amount is not None %}
 | |
|                   <span class="badge badge-success badge-pill">
 | |
|                     {{ record.debit_amount|short_amount }}
 | |
|                   </span>
 | |
|                 {% endif %}
 | |
|                 {% if record.credit_amount is not None %}
 | |
|                   <span class="badge badge-warning badge-pill">
 | |
|                     {{ record.credit_amount|short_amount }}
 | |
|                   </span>
 | |
|                 {% endif %}
 | |
|               </div>
 | |
|             </div>
 | |
|             <div>{{ record.transaction.note|default:"" }}</div>
 | |
|           </div>
 | |
|         </a>
 | |
|       </li>
 | |
|     {% endfor %}
 | |
|   </ul>
 | |
| {% else %}
 | |
|   <p>{{ _("There is currently no data.")|force_escape }}</p>
 | |
| {% endif %}
 | |
| 
 | |
| {% endblock %}
 |