initialize project documentation and setup instructions
This commit is contained in:
5
templates/pages/dashboard copy.html
Normal file
5
templates/pages/dashboard copy.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
<!-- [ Main Content ] start -->
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
141
templates/pages/dashboard.html
Normal file
141
templates/pages/dashboard.html
Normal file
@@ -0,0 +1,141 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static custom_filters %}
|
||||
<!-- [ Main Content ] start -->
|
||||
{% block content %}
|
||||
|
||||
{% if card_title %}
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 mb-4">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{% if card_title %}
|
||||
<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_title }}
|
||||
</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 %}
|
||||
|
||||
{# HANYA tampilkan preview jika ini adalah field image #}
|
||||
{% if field.name == 'image' and enable_preview_image %}
|
||||
<div class="mt-2">
|
||||
{% if item.image %}
|
||||
<img id="preview" src="{{ item.image.url }}" class="img-thumbnail w-25" alt="Preview">
|
||||
{% else %}
|
||||
<img id="preview" src="{% static 'images/placeholder.jpg' %}" class="img-thumbnail w-25" alt="Default">
|
||||
{% endif %}
|
||||
</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 items %}
|
||||
<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">
|
||||
List View
|
||||
</h6>
|
||||
{{ top_dropdown|safe }}
|
||||
</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>
|
||||
{% 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>
|
||||
{% for field in fields %}
|
||||
{% if field == 'image' %}
|
||||
<td style="width: 150px;">
|
||||
<img id="imagePreview" src="{% if item.image %}{{ item.image.url }}{% else %}{% static 'images/placeholder.jpg' %}{% endif %}" class="img-thumbnail" alt="Preview">
|
||||
</td>
|
||||
{% else %}
|
||||
<td>
|
||||
{{ item|get_field_value:field|safe }}
|
||||
{% if field == 'location' %}
|
||||
{% if item.maps_location %}
|
||||
<div class="mt-1">
|
||||
{# Hilangkan |urlencode jika datanya sudah berupa link utuh #}
|
||||
<a href="{{ item.maps_location }}"
|
||||
target="_blank"
|
||||
class="btn btn-link btn-sm p-0 text-decoration-none"
|
||||
style="font-size: 0.75rem;">
|
||||
View on Maps
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% elif field == 'event_name' %}
|
||||
{{ item.copy_link }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% 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 %}
|
||||
201
templates/pages/form copy.html
Normal file
201
templates/pages/form copy.html
Normal file
@@ -0,0 +1,201 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static custom_filters %}
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 mb-4">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="tabs-1" role="tabpanel">
|
||||
<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_title_second }}
|
||||
</h6>
|
||||
</div>
|
||||
{% if form_readonly %}
|
||||
<div class="row g-4">
|
||||
{% for field in form_readonly %}
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label fw-semibold">
|
||||
{{ field.label|title }}
|
||||
</label>
|
||||
<p class="form-control-plaintext border-bottom">
|
||||
{{ field }}
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<hr class="my-5">
|
||||
{% endif %}
|
||||
|
||||
<form method="post" id="main-form" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="row g-4">
|
||||
{% if reject_reason %}
|
||||
{{ reject_reason }}
|
||||
{% endif %}
|
||||
{% for field in form %}
|
||||
<div class="col-12 col-md-6">
|
||||
{% if field.name == 'file' %}
|
||||
<label for="{{ field.label }}" class="form-label fw-semibold">
|
||||
{{ field.label|title }}
|
||||
</label>
|
||||
<div class="file-input-wrapper">
|
||||
{{ field }}
|
||||
{# <input type="hidden" name="delete_existing_file" id="delete_existing_file" value="false"> #}
|
||||
<label for="id_attachments" class="file-input-label">
|
||||
<i class="bi bi-cloud-arrow-up"></i>
|
||||
<div class="file-input-text">
|
||||
<span>Click or drag to upload files</span>
|
||||
{% if field.help_text %}
|
||||
<div class="form-text">
|
||||
{{ field.help_text }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div id="file_preview_container" class="file-preview" style="{% if form.instance.file %}display: block;{% else %}display: none;{% endif %}">
|
||||
{% if form.instance.file %}
|
||||
<div class="file-item" id="existing-file-{{ form.instance.pk }}">
|
||||
<div class="file-info d-flex align-items-center p-2">
|
||||
<div class="icon-wrapper rounded-circle bg-dark bg-opacity-10 d-flex justify-content-center align-items-center"
|
||||
data-extension="{{ form.instance.file.name|slice:'-3:' }}">
|
||||
<!-- Icon akan di-generate lewat JS -->
|
||||
</div>
|
||||
|
||||
<div class="file-details">
|
||||
<div class="file-name fw-bold">{{ form.instance.file.name|cut:"dms/" }}</div>
|
||||
<div class="file-size text-muted small">
|
||||
{{ form.instance.file.size|filesizeformat }} (Uploaded)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% comment %}
|
||||
<button type="button" class="file-remove" onclick="showDeleteConfirmation('id_attachments', 'file_preview_container', 0)">
|
||||
<i class="bi bi-x"></i>
|
||||
</button>
|
||||
{% endcomment %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="form-text ms-1">
|
||||
You can attach any relevant supporting documents here.
|
||||
</div>
|
||||
{% else %}
|
||||
<label for="{{ field.label }}" class="form-label fw-semibold">
|
||||
{{ field.label|title }}
|
||||
</label>
|
||||
{{ field }}
|
||||
{% if field.help_text %}
|
||||
<div class="form-text ms-1">
|
||||
{{ field.help_text }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<div class="form-text text-danger ms-1">
|
||||
{{ field.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{{ form.errors }}
|
||||
</div>
|
||||
<hr class="my-5">
|
||||
<div class="d-flex justify-content-end">
|
||||
{{ cancel_btn|safe }}
|
||||
<button class="btn btn-primary btn-new-size" type="submit">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tabs-2" role="tabpanel">
|
||||
<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">
|
||||
{{ tab_2|plural }}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered tableDatatables w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No.</th>
|
||||
{% for key, value in fields.items %}
|
||||
<th>{{ value }}</th>
|
||||
{% endfor %}
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for item in items %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
{% for field in fields %}
|
||||
<td>{{ item|get_field_value:field|safe }}</td>
|
||||
{% endfor %}
|
||||
<td>
|
||||
{% if item.buttons_action %}
|
||||
<button type="button" class="btn btn-warning btn-new-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>
|
||||
{% else %}--{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.select2-multiple').select2({
|
||||
theme: 'bootstrap-5',
|
||||
allowClear: true,
|
||||
width: '100%',
|
||||
{% if document_ajax %}
|
||||
ajax: {
|
||||
url: "{{ document_ajax }}",
|
||||
data: params => ({ term: params.term }),
|
||||
processResults: data => ({ results: data.results }),
|
||||
cache: true, // Jika user mengetik kata yang sama, tidak akan request ke server lagi, hasil lama langsung dipakai.
|
||||
}
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
$('.select2-tags').select2({
|
||||
theme: 'bootstrap-5',
|
||||
tags: true,
|
||||
// tokenSeparators: [',', ' '],
|
||||
allowClear: true,
|
||||
width: '100%',
|
||||
{% if tag_ajax %}
|
||||
ajax: {
|
||||
url: "{{ tag_ajax }}",
|
||||
data: params => ({ term: params.term }),
|
||||
processResults: data => ({ results: data.results }),
|
||||
cache: true, // Jika user mengetik kata yang sama, tidak akan request ke server lagi, hasil lama langsung dipakai.
|
||||
}
|
||||
{% endif %}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock scripts %}
|
||||
|
||||
{% endblock content %}
|
||||
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