164 lines
5.6 KiB
HTML
164 lines
5.6 KiB
HTML
{% extends "base.html" %}
|
|
{% load static i18n crispy_forms_tags %}
|
|
|
|
{% block title %}Create Training Material - {{ block.super }}{% endblock %}
|
|
|
|
{% block customCSS %}
|
|
<style>
|
|
/* ================================================= */
|
|
/* THEME VARIABLES AND GLOBAL STYLES */
|
|
/* ================================================= */
|
|
:root {
|
|
--kaauh-teal: #00636e;
|
|
--kaauh-teal-dark: #004a53;
|
|
--kaauh-border: #eaeff3;
|
|
--kaauh-primary-text: #343a40;
|
|
}
|
|
|
|
/* Primary Color Overrides */
|
|
.text-primary { color: var(--kaauh-teal) !important; }
|
|
|
|
/* Main Action Button Style */
|
|
.btn-main-action, .btn-primary {
|
|
background-color: var(--kaauh-teal);
|
|
border-color: var(--kaauh-teal);
|
|
color: white;
|
|
font-weight: 600;
|
|
padding: 0.6rem 1.2rem;
|
|
transition: all 0.2s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
.btn-main-action:hover, .btn-primary:hover {
|
|
background-color: var(--kaauh-teal-dark);
|
|
border-color: var(--kaauh-teal-dark);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
|
}
|
|
|
|
/* Outlined Button Styles */
|
|
.btn-secondary, .btn-outline-secondary {
|
|
background-color: #f8f9fa;
|
|
color: var(--kaauh-teal-dark);
|
|
border: 1px solid var(--kaauh-teal);
|
|
font-weight: 500;
|
|
}
|
|
.btn-secondary:hover, .btn-outline-secondary:hover {
|
|
background-color: var(--kaauh-teal-dark);
|
|
color: white;
|
|
border-color: var(--kaauh-teal-dark);
|
|
}
|
|
|
|
/* Card enhancements */
|
|
.card {
|
|
border: 1px solid var(--kaauh-border);
|
|
border-radius: 0.75rem;
|
|
overflow: hidden;
|
|
box-shadow: 0 4px 12px rgba(0,0,0,0.06);
|
|
background-color: white;
|
|
}
|
|
|
|
/* Colored Header Card */
|
|
.list-header-card {
|
|
background: linear-gradient(135deg, var(--kaauh-teal), #004d57);
|
|
color: white;
|
|
border-radius: 0.75rem 0.75rem 0 0;
|
|
padding: 1.5rem;
|
|
box-shadow: 0 4px 10px rgba(0,0,0,0.15);
|
|
}
|
|
.list-header-card h1 {
|
|
font-weight: 700;
|
|
margin: 0;
|
|
font-size: 1.8rem;
|
|
}
|
|
.heroicon {
|
|
width: 1.25rem;
|
|
height: 1.25rem;
|
|
vertical-align: text-bottom;
|
|
stroke: currentColor;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
/* ================================================= */
|
|
/* FIX: CRISPY FORMS ALIGNMENT/SPACING */
|
|
/* ================================================= */
|
|
/* Crispy forms wraps each field in a div with .mb-3.
|
|
This rule ensures the label and input are vertically aligned
|
|
and have clean spacing when inside a grid column. */
|
|
.card-body .form-group .form-label,
|
|
.card-body .form-group .input-group-text {
|
|
/* Align text within label if necessary (usually unnecessary) */
|
|
vertical-align: middle;
|
|
}
|
|
|
|
/* Ensures the form elements themselves are cleanly aligned */
|
|
.card-body .form-group {
|
|
/* Ensures consistent bottom spacing for all form groups */
|
|
margin-bottom: 1.2rem;
|
|
}
|
|
|
|
/* Override for fields inside the grid, using Bootstrap 5's default
|
|
g-x for horizontal and g-y for vertical padding from the row */
|
|
.card-body .row .col-md-6 .form-group {
|
|
margin-bottom: 0 !important; /* Let the row's g-4 handle vertical spacing */
|
|
}
|
|
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container-fluid py-4">
|
|
|
|
<div class="card mb-4">
|
|
<div class="list-header-card">
|
|
<div class="d-flex justify-content-between align-items-start flex-wrap">
|
|
<div class="flex-grow-1">
|
|
<h1 class="h3 mb-1">
|
|
<i class="fas fa-file-upload"></i>
|
|
{% trans "Create New Training Material" %}
|
|
</h1>
|
|
<p class="text-white opacity-75 mb-0">{% trans "Upload a new document or guide for your team." %}</p>
|
|
</div>
|
|
<div class="d-flex gap-2 mt-1">
|
|
<a href="{% url 'training_list' %}" class="btn btn-outline-light btn-sm" title="{% trans 'Back to List' %}">
|
|
<i class="fas fa-arrow-left"></i>
|
|
<span class="d-none d-sm-inline">{% trans "Back to List" %}</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow-sm">
|
|
<div class="card-header bg-white border-bottom">
|
|
<h2 class="h5 mb-0 text-primary">
|
|
<i class="fas fa-book me-1"></i>
|
|
{% trans "Material Details" %}
|
|
</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="post" enctype="multipart/form-data">
|
|
{% csrf_token %}
|
|
|
|
{# Use a row structure with g-3 for slightly tighter spacing #}
|
|
<div class="row g-3">
|
|
{# Iterate through all form fields #}
|
|
{% for field in form %}
|
|
<div class="col-md-{% if field.field.widget.input_type == 'textarea' or field.field.widget.input_type == 'file' %}12{% else %}6{% endif %}">
|
|
{# Crispy field rendering #}
|
|
{{ field|as_crispy_field }}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<hr class="mt-4 mb-4">
|
|
<button class="btn btn-main-action" type="submit">
|
|
<i class="fas fa-save me-1"></i>
|
|
{% trans "Create Material" %}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %} |