initialize project documentation and setup instructions
This commit is contained in:
119
templates/pages/form.html
Normal file
119
templates/pages/form.html
Normal file
@@ -0,0 +1,119 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static custom_filters %}
|
||||
<!-- [ Main Content ] start -->
|
||||
{% block content %}
|
||||
|
||||
{% if card_form %}
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 mb-4">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{% if card_form %}
|
||||
<div class="card shadow-lg border-0">
|
||||
<div class="card-body p-5">
|
||||
<div class="d-flex justify-content-between align-items-center border-bottom pb-2 mb-4">
|
||||
<h6 class="fw-bold mb-0">
|
||||
{{ card_form }}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="row g-4 mb-4">
|
||||
{% for field in form %}
|
||||
<div class="col-12 col-md-6">
|
||||
<label for="{{ field.id_for_label }}" class="form-label fw-semibold">
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{{ field }}
|
||||
{% if field.help_text %}
|
||||
<div class="form-text ms-1">
|
||||
{{ field.help_text }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<hr class="my-5">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
{% if item %}
|
||||
<button class="btn bz-btn-outline-primary btn-bz-size" onclick="window.history.back();">Cancel</button>
|
||||
{% endif %}
|
||||
<button type="submit" name="action" value="save" class="btn bz-btn-primary btn-bz-size">Submit</button>
|
||||
</div>
|
||||
<div>
|
||||
{{ buttons_action|safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if card_list %}
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 mb-4">
|
||||
<div class="card shadow-lg border-0">
|
||||
<div class="card-body p-5">
|
||||
<div class="d-flex justify-content-between align-items-center border-bottom pb-2 mb-4">
|
||||
<h6 class="fw-bold mb-0">
|
||||
{{ card_list }}
|
||||
</h6>
|
||||
{# Jika ada dropdown #}
|
||||
{% comment %}{{ top_card_dropdown|safe }}{% endcomment %}
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered tableDatatables w-100">
|
||||
<thead>
|
||||
<tr class="align-middle">
|
||||
<th class="mw-25">No.</th>
|
||||
{# Menggunakan Objek Form #}
|
||||
{% for field in form %}
|
||||
<th>{{ field.label }}</th>
|
||||
{% endfor %}
|
||||
{# Menggunakan Mapping Label #}
|
||||
{% for key, value in fields.items %}
|
||||
<th>{{ value }}</th>
|
||||
{% endfor %}
|
||||
<th style="width:10%">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for item in items %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
{# Menggunakan Objek Form #}
|
||||
{% for field in form %}
|
||||
<td>
|
||||
{{ item|get_field_value:field.name|safe }}
|
||||
</td>
|
||||
{% endfor %}
|
||||
{# Menggunakan Mapping Label #}
|
||||
{% for field in fields %}
|
||||
<td>{{ item|get_field_value:field|safe }}{{ field }}</td>
|
||||
{% endfor %}
|
||||
<td>
|
||||
{% if item.buttons_action %}
|
||||
<button type="button" class="btn btn-warning btn-bz-size dropdown-toggle" data-bs-toggle="collapse" data-bs-target="#act-{{ item.id }}">Options </button>
|
||||
<div id="act-{{ item.id }}" class="collapse mt-1">
|
||||
{% for value in item.buttons_action %}
|
||||
{{ value|safe }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user