web/penny/templates/entity.html
{% extends "navbar.html" %}
{% block content %}
<div class="container-fluid">
<h1 class="h3 mb-2 text-gray-800">Entity</h1>
<div class="card shadow mb-4">
<div class="card-body">
<div class="table-responsive">
{%- if entity -%}
<form action="{{ url_for('entities.entity', id=entity.id) }}" method="POST">
{%- else -%}
<form action="{{ url_for('entities.add') }}" method="POST">
{%- endif -%}
{{ form.hidden_tag() }}
{{ form.csrf_token }}
{% include 'includes/display_flash_message.html' %}
<div class="col-lg-12">
<div class="table-responsive">
<table class="table table-bordered" widht="100%" cellspacing="0" id="table">
<tbody>
<tr>
<td>Name</td>
<td>
{%- if form.name.errors -%}
<div class="form-group has-error">
<label class="control-label" for="inputError">{{ form.name.errors[0] }}</label>
{%- endif -%}
{{ form.name(class="form-control") }}
{%- if form.name.errors -%}
</div>
{%- endif -%}
</td>
</tr>
<tr>
<td>Entity Type</td>
<td>
{%- if form.entitytype.errors -%}
<div class="form-group has-error">
<label class="control-label" for="inputError">{{ form.entitytype.errors[0] }}</label>
{%- endif -%}
<select id="entitytype" name="entitytype" class="form-control">
{% for choice in form.entitytype.choices %}
<option value="{{ choice.0 }}"{% if form.entitytype.default == choice.0 %} selected="selected"{% endif %}>{{choice.1}}</option>
{% endfor %}
</select>
{%- if form.entitytype.errors -%}
</div>
{%- endif -%}
</td>
</tr>
</tbody>
</table>
{%- if request.path == "/entities/add" -%}
{%- set submit_name = 'add' -%}
{%- set submit_value = 'Add' -%}
{%- else -%}
{%- set submit_name = 'update' -%}
{%- set submit_value = 'Update' -%}
{%- endif -%}
<div class="input-group btn-block" style="padding-top:10px;">
<div class="pull-left" style="padding-right:5px;">
<input type="submit" class="btn btn-primary" name="{{ submit_name }}" value="{{ submit_value }}">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}