mirror of
https://github.com/bszczuka/steel-training.git
synced 2025-12-21 13:23:02 +01:00
Add custom target distance forsingle targets
This commit is contained in:
@@ -42,6 +42,10 @@
|
||||
class="{{ 'shadow-inner shadow-blue-900' if current_url == url_for('ipsc') else '' }} bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600 transition-colors">
|
||||
El Presidente
|
||||
</a>
|
||||
<a href="{{ url_for('custom') }}"
|
||||
class="{{ 'shadow-inner shadow-blue-900' if current_url == url_for('custom') else '' }} bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600 transition-colors">
|
||||
Custom
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="flex justify-center mt-4">
|
||||
|
||||
44
templates/custom.html
Normal file
44
templates/custom.html
Normal file
@@ -0,0 +1,44 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}El Presidente{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
|
||||
<form class="" action="/generate-pdf-custom" method="post">
|
||||
{% include 'setup.html' %}
|
||||
<div class="mb-6 max-w-2xl mx-auto">
|
||||
<h2>{%trans%}Select the stage{%endtrans%}</h2>
|
||||
|
||||
<div class="mb-6 max-w-2xl mx-auto mt-4">
|
||||
<h2>{%trans%}Simulated distance{%endtrans%} [m]</h2>
|
||||
<input type="number" id="simulated_distance" name="simulated_distance" min="1" max="300" class="w-full p-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400" required>
|
||||
</div>
|
||||
|
||||
<div id="stage" class="grid grid-cols-1 gap-4">
|
||||
<div>
|
||||
<label for="ipsc">
|
||||
<p>IPSC</p>
|
||||
{% with target_width=4.5, target_height=5.8 %}
|
||||
{%include 'ipsc_svg.html'%}
|
||||
{% endwith %}
|
||||
<input type="radio" id="ipsc" name="target_type" value="ipsc" required>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="idpa">
|
||||
<p>IDPA</p>
|
||||
{% with target_width=4.6, target_height=7.8 %}
|
||||
{%include 'idpa_svg.html'%}
|
||||
{% endwith %}
|
||||
<input type="radio" id="idpa" name="target_type" value="idpa">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button type="submit"
|
||||
class="bg-green-500 text-white py-2 px-4 rounded-md hover:bg-green-600 transition-colors">
|
||||
{%trans%}Generate PDF{%endtrans%}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
82
templates/pdf_template_custom.html
Normal file
82
templates/pdf_template_custom.html
Normal file
@@ -0,0 +1,82 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Steel Training | {%trans%}Target{%endtrans%}: {{ target_type|upper }} | {%trans%}Simulated distance{%endtrans%}: {{ simulated_distance }}m | {%trans%}Place target on{%endtrans%}: {{distance}}cm</title>
|
||||
<style>
|
||||
@page {
|
||||
size: {{size}};
|
||||
margin: 5mm;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.target {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page-break {
|
||||
page-break-after: always;
|
||||
}
|
||||
|
||||
.content {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.mounting-point {
|
||||
height: 10mm;
|
||||
width: 0.5mm;
|
||||
background-color: #ccc;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.mounting-info {
|
||||
font-size: xx-small;
|
||||
color: #ccc;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.preview {
|
||||
display: block;
|
||||
border-bottom: solid 1px black;
|
||||
border-top: solid 1px black;
|
||||
width: 100%;
|
||||
height: 75mm;
|
||||
position: relative;
|
||||
}
|
||||
.preview-target {
|
||||
position: absolute;
|
||||
bottom: 30%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="page-break">
|
||||
<div class="content">
|
||||
{% with target_width=target_width, target_height=target_height %}
|
||||
{%if target_type == 'ipsc' %}
|
||||
{%include 'ipsc_svg.html'%}
|
||||
{%else%}
|
||||
{%include 'idpa_svg.html'%}
|
||||
{%endif%}
|
||||
{% endwith %}
|
||||
<br>
|
||||
<div class="mounting-info">
|
||||
{%trans%}Target{%endtrans%}: {{ target_type|upper }} | {%trans%}Simulated distance{%endtrans%}: {{ simulated_distance }}m | {%trans%}Place target on{%endtrans%}: {{distance}}cm
|
||||
<br>
|
||||
Steel Training
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
<body>
|
||||
<div class="page-break">
|
||||
<h1>Steel Training</h1>
|
||||
<h1>Paper Challenge</h1>
|
||||
<h2>IPSC - El Presidente</h2>
|
||||
<div class="preview">
|
||||
{% for i in range(3) %}
|
||||
|
||||
@@ -7,13 +7,14 @@
|
||||
class="w-40 h-auto">
|
||||
<input type="radio" id="floor" name="distance_type" value="floor" required>
|
||||
</label>
|
||||
|
||||
<label for="wall"
|
||||
class="cursor-pointer border-2 border-transparent rounded-lg overflow-hidden transition-all hover:border-blue-400">
|
||||
<img src="{{ url_for('static', filename='images/wall.webp') }}" alt="{%trans%}Wall length{%endtrans%}"
|
||||
class="w-40 h-auto">
|
||||
<input type="radio" id="wall" name="distance_type" value="wall" required>
|
||||
</label>
|
||||
{% if current_url != url_for('custom') %}
|
||||
<label for="wall"
|
||||
class="cursor-pointer border-2 border-transparent rounded-lg overflow-hidden transition-all hover:border-blue-400">
|
||||
<img src="{{ url_for('static', filename='images/wall.webp') }}" alt="{%trans%}Wall length{%endtrans%}"
|
||||
class="w-40 h-auto">
|
||||
<input type="radio" id="wall" name="distance_type" value="wall" required>
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
<div class="mb-6 max-w-2xl mx-auto mt-4">
|
||||
|
||||
Reference in New Issue
Block a user