mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-28 05:49:32 +00:00
Renamed label_system templates folder to recommended snake_style style
This commit is contained in:
parent
06f86176b6
commit
12d4c2f4d9
16 changed files with 12 additions and 12 deletions
117
templates/label_system/dialog.html.twig
Normal file
117
templates/label_system/dialog.html.twig
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
{% extends 'main_card.html.twig' %}
|
||||
|
||||
{% block title %}{% trans %}label_generator.title{% endtrans %}{% endblock %}
|
||||
|
||||
{%- block card_title -%}
|
||||
<i class="fas fa-qrcode fa-fw"></i> {% trans %}label_generator.title{% endtrans %}
|
||||
{% if profile %}({{ profile.name }}){% endif %}
|
||||
{%- endblock -%}
|
||||
|
||||
{% block card_content %}
|
||||
{{ form_start(form) }}
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-bs-toggle="tab" id="common-tab" role="tab" aria-controls="common" aria-selected="true" href="#common"
|
||||
>{% trans %}label_generator.common{% endtrans %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="tab" id="advanced-tab" role="tab" aria-controls="advanced" aria-selected="false" href="#advanced"
|
||||
>{% trans %}label_generator.advanced{% endtrans %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="tab" id="profiles-tab" role="tab" aria-controls="profiles" aria-selected="false" href="#profiles"
|
||||
>{% trans %}label_generator.profiles{% endtrans %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content mt-2">
|
||||
|
||||
<div class="tab-pane active" id="common" role="tabpanel" aria-labelledby="common-tab">
|
||||
{{ form_row(form.target_id) }}
|
||||
|
||||
{{ form_row(form.options.supported_element) }}
|
||||
<div class="mb-2 row">
|
||||
{{ form_label(form.options.width) }}
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
{{ form_widget(form.options.width) }}
|
||||
|
||||
<span class="input-group-text">x</span>
|
||||
|
||||
{{ form_widget(form.options.height) }}
|
||||
|
||||
<span class="input-group-text">mm</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ form_row(form.options.barcode_type) }}
|
||||
{{ form_row(form.options.lines) }}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="advanced" role="tabpanel" aria-labelledby="advanced-tab">
|
||||
{{ form_row(form.options.additional_css) }}
|
||||
{{ form_widget(form.options) }}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="profiles" role="tabpanel" aria-labelledby="profiles-tab">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">{% trans %}label_generator.selected_profile{% endtrans %}</label>
|
||||
<div class="col-sm-9">
|
||||
<span class="form-control-plaintext">{{ profile.name ?? '-' }}
|
||||
{% if profile %}
|
||||
<a href="{{ entity_url(profile, 'edit') }}" title="{% trans %}label_generator.edit_profile{% endtrans %}"
|
||||
><i class="fas fa-edit"></i></a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="offset-sm-3 col-sm-9">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-info dropdown-toggle" type="button" id="loadProfilesButton"
|
||||
{% if not is_granted("@labels.create_labels") %}disabled{% endif %}
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{% trans %}label_generator.load_profile{% endtrans %}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="loadProfilesButton">
|
||||
{% if is_granted("@labels.create_labels") %}
|
||||
{% for type in constant("App\\Entity\\LabelSystem\\LabelOptions::SUPPORTED_ELEMENTS") %}
|
||||
{% set profiles = label_profile_dropdown_helper.dropdownProfiles(type) %}
|
||||
{% if profiles is not empty %}
|
||||
<h6 class="dropdown-header">{{ (type~'.label') | trans }}</h6>
|
||||
{% endif %}
|
||||
{% for profile in profiles %}
|
||||
<a class="dropdown-item" href="{{ path('label_dialog_profile', {'profile': profile.id }) }}">{{ profile.name }}</a>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{{ form_end(form) }}
|
||||
{% if pdf_data %}
|
||||
<div class="row">
|
||||
<div class="col-sm-9 offset-sm-3">
|
||||
<a data-turbo="false" class="btn btn-secondary" href="#" {{ stimulus_controller('pages/label_download_btn')}} {{ stimulus_action('pages/label_download_btn', 'download')}} download="{{ filename ?? '' }}">
|
||||
{% trans %}label_generator.download{% endtrans %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block additional_content %}
|
||||
{% if pdf_data %}
|
||||
<div class="card mt-2 p-1 border-secondary" style="resize: vertical; overflow: scroll; height: 250px">
|
||||
<object id="pdf_preview" data="{{ pdf_data | data_uri(mime='application/pdf') }}"style="height: inherit">
|
||||
</object>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
24
templates/label_system/dropdown_macro.html.twig
Normal file
24
templates/label_system/dropdown_macro.html.twig
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{% macro profile_dropdown(type, id = null, include_text = true, btn_type = 'btn-secondary') %}
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn {{ btn_type }} dropdown-toggle" title="{% trans %}label_generator.label_btn{% endtrans %}"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" {% if not is_granted("@labels.create_labels") %}disabled{% endif %}>
|
||||
<i class="fas fa-fw fa-qrcode"></i> {% if include_text %}{% trans %}label_generator.label_btn{% endtrans %}{% endif %}
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
{% if is_granted('@labels.read_profiles') %}
|
||||
{% set profiles = label_profile_dropdown_helper.dropdownProfiles(type) %}
|
||||
{% else %}
|
||||
{% set profiles = [] %}
|
||||
{% endif %}
|
||||
{% for profile in profiles %}
|
||||
<a class="dropdown-item" href="{{ path('label_dialog_profile', {'profile': profile.id, 'target_type': type, 'target_id': id, 'generate': true}) }}">{{ profile.name }}</a>
|
||||
{% endfor %}
|
||||
{% if profiles is not empty and is_granted('@labels.edit_options') %}
|
||||
<div class="dropdown-divider"></div>
|
||||
{% endif %}
|
||||
{% if is_granted('@labels.edit_options') %} {# An empty dialog does not make much sense, when you can not edit the options... #}
|
||||
<a class="dropdown-item" href="{{ path('label_dialog', {'target_type': type, 'target_id': id}) }}">{% trans %}label_generator.label_empty{% endtrans %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
27
templates/label_system/labels/base_label.html.twig
Normal file
27
templates/label_system/labels/base_label.html.twig
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ meta_title }}</title>
|
||||
<meta name="author" content="{{ partdb_title }}">
|
||||
<meta name="description" content="Label for {{ meta_title }}">
|
||||
<meta name="keywords" content="Part-DB, Label, Barcode">
|
||||
<style>
|
||||
{% include("label_system/labels/label_style.css.twig") %}
|
||||
{{ options.additionalCss | escape("html") }}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{% for element in elements %}
|
||||
<div class="page">
|
||||
{% if options.barcodeType == 'none' %}
|
||||
{% include "label_system/labels/label_page_none.html.twig" %}
|
||||
{% elseif options.barcodeType in ['qr', 'datamatrix'] %}
|
||||
{% include "label_system/labels/label_page_qr.html.twig" %}
|
||||
{% elseif options.barcodeType in ['code39', 'code93', 'code128'] %}
|
||||
{% include "label_system/labels/label_page_1d.html.twig" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</body>
|
||||
</html>
|
||||
27
templates/label_system/labels/label_page_1d.html.twig
Normal file
27
templates/label_system/labels/label_page_1d.html.twig
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<div>
|
||||
<div class="lines-container">
|
||||
{{ element.lines | raw }}
|
||||
</div>
|
||||
<div class="C39-container" style="">
|
||||
<img class="C39" src="{{ element.barcode | data_uri(mime='image/svg+xml') }}" height="30px"><br>
|
||||
<span class="C39-text">{{ element.barcode_content }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<div class="C39-container">
|
||||
<img class="C39" src="{{ inlineData(element.barcode, 'image/svg+xml') }}" width="100%" height="50px" style="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-7">
|
||||
<div class="lines-container">
|
||||
{{ element.lines | raw }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
#}
|
||||
1
templates/label_system/labels/label_page_none.html.twig
Normal file
1
templates/label_system/labels/label_page_none.html.twig
Normal file
|
|
@ -0,0 +1 @@
|
|||
{{ element.lines | raw }}
|
||||
17
templates/label_system/labels/label_page_qr.html.twig
Normal file
17
templates/label_system/labels/label_page_qr.html.twig
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<div>
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<div class="qr-container">
|
||||
<a href="{{ element.barcode_content }}">
|
||||
<img class="qr" src="{{ element.barcode | data_uri(mime='image/svg+xml') }}" width="100%" style="">
|
||||
</a>
|
||||
</div>
|
||||
{#{{ element.barcode | raw }} #}
|
||||
</div>
|
||||
<div class="col-7">
|
||||
<div class="lines-container">
|
||||
{{ element.lines | raw }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
175
templates/label_system/labels/label_style.css.twig
Normal file
175
templates/label_system/labels/label_style.css.twig
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
@page {
|
||||
margin: 12px 6px;
|
||||
}
|
||||
|
||||
.page {
|
||||
page-break-inside: avoid;
|
||||
page-break-before: avoid;
|
||||
page-break-after: always;
|
||||
|
||||
overflow: hidden;
|
||||
/* Absolute position prevents automatic page breaks */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Last page should not break */
|
||||
.page:last-of-type {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "DejaVu Sans Mono";
|
||||
font-size: 12px;
|
||||
line-height: 1.0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.qr {
|
||||
max-width: 80%;
|
||||
}
|
||||
|
||||
.qr-container a {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.C39 {
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
.C39-container {
|
||||
display: inline-block;
|
||||
align-content: center;
|
||||
text-align: left;
|
||||
position: fixed;
|
||||
bottom: 32px;
|
||||
}
|
||||
|
||||
.C39-text {
|
||||
display: block;
|
||||
font-size: 6pt;
|
||||
}
|
||||
|
||||
/**************************************
|
||||
Grid system token from simplegrid.io
|
||||
|
||||
SIMPLE GRID
|
||||
(C) ZACH COLE 2016
|
||||
************************************/
|
||||
.font-light {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.font-regular {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.font-heavy {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* POSITIONING */
|
||||
|
||||
.left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.justify {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
/* ==== GRID SYSTEM ==== */
|
||||
|
||||
.container {
|
||||
width: 90%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.row {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
page-break-after: avoid;
|
||||
page-break-before: avoid;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
.row [class^="col"] {
|
||||
float: left;
|
||||
margin: 0 0.5%;
|
||||
min-height: 0.125rem ;
|
||||
}
|
||||
|
||||
.row::after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.col-1 {
|
||||
width: 4.33%;
|
||||
}
|
||||
|
||||
.col-2 {
|
||||
width: 12.66%;
|
||||
}
|
||||
|
||||
.col-3 {
|
||||
width: 21%;
|
||||
}
|
||||
|
||||
.col-4 {
|
||||
width: 29.33%;
|
||||
}
|
||||
|
||||
.col-5 {
|
||||
width: 37.66%;
|
||||
}
|
||||
|
||||
.col-6 {
|
||||
width: 46%;
|
||||
}
|
||||
|
||||
.col-7 {
|
||||
width: 54.33%;
|
||||
}
|
||||
|
||||
.col-8 {
|
||||
width: 62.66%;
|
||||
}
|
||||
|
||||
.col-9 {
|
||||
width: 71%;
|
||||
}
|
||||
|
||||
.col-10 {
|
||||
width: 79.33%;
|
||||
}
|
||||
|
||||
.col-11 {
|
||||
width: 87.66%;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
width: 96%;
|
||||
}
|
||||
26
templates/label_system/scanner/scanner.html.twig
Normal file
26
templates/label_system/scanner/scanner.html.twig
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{% extends 'main_card.html.twig' %}
|
||||
|
||||
{% block card_title %}<i class="fas fa-camera-retro fa-fw"></i> {% trans %}label_scanner.title{% endtrans %}{% endblock %}
|
||||
|
||||
{% block card_content %}
|
||||
<div class="alert alert-warning d-none" id="scanner-warning">
|
||||
<strong>{% trans %}label_scanner.no_cam_found.title{% endtrans %}</strong>: {% trans %}label_scanner.no_cam_found.text{% endtrans %}
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
<div class="form-group row">
|
||||
<div class="offset-sm-3 col-sm-9">
|
||||
|
||||
<div class="img-thumbnail" style="max-width: 600px;">
|
||||
<div id="reader-box" {{ stimulus_controller('pages/barcode_scan') }}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{ form_start(form, {'attr': {'id': 'scan_dialog_form'}}) }}
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue