Renamed parts/ templates folder to recommended snake_case style

This commit is contained in:
Jan Böhmer 2023-02-04 23:05:39 +01:00
parent e8efe81f79
commit 9097220026
41 changed files with 63 additions and 63 deletions

View file

@ -0,0 +1,5 @@
{{ form_row(form.needsReview) }}
{{ form_row(form.favorite) }}
{{ form_row(form.mass) }}
{{ form_row(form.ipn) }}
{{ form_row(form.partUnit) }}

View file

@ -0,0 +1,5 @@
{% import "components/attachments.macro.html.twig" as attachments %}
{{ form_row(form.master_picture_attachment) }}
{{ attachments.attachment_edit_list(form.attachments) }}

View file

@ -0,0 +1,18 @@
{% form_theme form with ['parts/edit/edit_form_styles.html.twig'] %}
{% import 'components/collection_type.macro.html.twig' as collection %}
<div {{ collection.controller(form.partLots, 'part_lot.edit.delete.confirm') }}>
<table class="table table-striped table-sm" id="lots_table" {{ collection.target() }}>
<tbody>
{% for lot in form.partLots %}
{{ form_widget(lot) }}
{% endfor %}
</tbody>
</table>
<button type="button" class="btn btn-success" {{ collection.create_btn() }}
{% if not is_granted('edit', part) %}disabled{% endif %}>
<i class="fas fa-plus-square fa-fw"></i>
{% trans %}part_lot.create{% endtrans %}
</button>
</div>

View file

@ -0,0 +1,15 @@
{{ form_row(form.name) }}
{% if part.category is not null and part.category.partnameHint is not empty %}
<div class="row">
<div class="col-sm-9 offset-sm-3">
<p class="form-text help-text"><b>{% trans %}part.edit.name.category_hint{% endtrans %}:</b> {{ part.category.partnameHint }}</p>
</div>
</div>
{% endif %}
{{ form_row(form.description) }}
{{ form_row(form.category) }}
{{ form_row(form.tags) }}
{{ form_row(form.minAmount) }}
{{ form_row(form.footprint) }}

View file

@ -0,0 +1,4 @@
{{ form_row(form.manufacturer) }}
{{ form_row(form.manufacturer_product_number) }}
{{ form_row(form.manufacturer_product_url)}}
{{ form_row(form.manufacturing_status) }}

View file

@ -0,0 +1,18 @@
{# Leave this template at bootstrap 4 for now, as it otherwise destroys our layout #}
{% form_theme form.orderdetails with ['parts/edit/edit_form_styles.html.twig', "bootstrap_4_layout.html.twig"] %}
{% import 'components/collection_type.macro.html.twig' as collection %}
<div {{ collection.controller(form.orderdetails, 'orderdetails.edit.delete.confirm') }}>
<table class="table table-striped table-sm table-responsive-md" id="orderdetails_table" {{ collection.target() }}>
<tbody>
{% for detail in form.orderdetails %}
{{ form_widget(detail) }}
{% endfor %}
</tbody>
</table>
<button type="button" class="btn btn-success" {{ collection.create_btn() }}>
<i class="fas fa-plus-square fa-fw"></i>
{% trans %}orderdetail.create{% endtrans %}
</button>
</div>

View file

@ -0,0 +1,31 @@
{% form_theme form with ['parts/edit/edit_form_styles.html.twig'] %}
{% import 'components/collection_type.macro.html.twig' as collection %}
<div {{ collection.controller(form.parameters, 'parameter.delete.confirm') }}>
<table class="table table-striped table-sm table-bordered table-responsive-md" id="specifications_table" {{ collection.target() }}>
<thead>
<tr>
<th>{% trans %}specifications.property{% endtrans %}</th>
<th>{% trans %}specifications.symbol{% endtrans %}</th>
<th>{% trans %}specifications.value_min{% endtrans %}</th>
<th>{% trans %}specifications.value_typ{% endtrans %}</th>
<th>{% trans %}specifications.value_max{% endtrans %}</th>
<th>{% trans %}specifications.unit{% endtrans %}</th>
<th>{% trans %}specifications.text{% endtrans %}</th>
<th>{% trans %}specifications.group{% endtrans %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for param in form.parameters %}
{{ form_widget(param) }}
{% endfor %}
</tbody>
</table>
<button type="button" class="btn btn-success" {% if not is_granted('edit', part) %}disabled{% endif %} {{ collection.create_btn() }}>
<i class="fas fa-plus-square fa-fw"></i>
{% trans %}specification.create{% endtrans %}
</button>
</div>

View file

@ -0,0 +1,171 @@
{% block pricedetail_widget %}
{% form_theme form.currency 'Form/extendedBootstrap4_layout.html.twig' %}
{% import 'components/collection_type.macro.html.twig' as collection %}
<tr>
<td>{{ form_widget(form.min_discount_quantity, {'attr': {'class': 'form-control-sm'}}) }} {{ form_errors(form.min_discount_quantity) }}</td>
<td>
<div class="input-group input-group-sm">
{{ form_widget(form.price) }}
{{ form_widget(form.currency, {'attr': {'class': 'form-control-sm'}}) }}
</div>
{{ form_errors(form.price) }}
{{ form_errors(form.currency) }}
</td>
<td>{{ form_widget(form.price_related_quantity, {'attr': {'class': 'form-control-sm'}}) }} {{ form_errors(form.price_related_quantity) }}</td>
<td>
<button type="button" class="btn btn-danger order_btn_delete btn-sm" title="{% trans %}orderdetail.delete{% endtrans %}"
{{ collection.delete_btn() }}>
<i class="fas fa-trash-alt fa-fw"></i>
</button>
{{ form_errors(form) }}
</td>
</tr>
{% endblock %}
{% block orderdetail_widget %}
{% import 'components/collection_type.macro.html.twig' as collection %}
<tr>
<td>
{{ form_row(form.supplier, {'attr': {'class': 'form-control-sm form-control'}}) }}
{{ form_row(form.supplierpartnr, {'attr': {'class': 'form-control-sm'}}) }}
{{ form_row(form.supplier_product_url, {'attr': {'class': 'form-control-sm'}}) }}
{{ form_widget(form.obsolete) }}
</td>
<td>
<div {{ collection.controller(form.pricedetails, 'pricedetails.edit.delete.confirm') }}>
<table class="table table-sm table-bordered" {{ collection.target() }}>
<thead>
<tr>
<th>{% trans %}pricedetails.edit.min_qty{% endtrans %}</th>
<th>{% trans %}pricedetails.edit.price{% endtrans %}</th>
<th>{% trans %}pricedetails.edit.price_qty{% endtrans %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for price in form.pricedetails %}
{{ form_widget(price) }}
{% endfor %}
</tbody>
</table>
<button type="button" class="btn btn-success" {{ collection.create_pricedetail_btn() }}>
<i class="fas fa-plus-square fa-fw"></i>
{% trans %}pricedetail.create{% endtrans %}
</button>
</div>
</td>
<td>
<button type="button" class="btn btn-danger order_btn_delete" {{ collection.delete_btn() }} title="{% trans %}orderdetail.delete{% endtrans %}">
<i class="fas fa-trash-alt fa-fw"></i>
</button>
{{ form_errors(form) }}
</td>
</tr>
{% endblock %}
{% block parameter_widget %}
{% import 'components/collection_type.macro.html.twig' as collection %}
<tr {{ stimulus_controller('pages/parameters_autocomplete', {"url": path('typeahead_parameters', {"query": "__QUERY__", "type": form.vars["type"]})}) }}>
<td>{{ form_widget(form.name, {"attr": {"data-pages--parameters-autocomplete-target": "name"}}) }}{{ form_errors(form.name) }}</td>
<td {{ stimulus_controller('pages/latex_preview') }}>{{ form_widget(form.symbol, {"attr": {"data-pages--parameters-autocomplete-target": "symbol", "data-pages--latex-preview-target": "input"}}) }}{{ form_errors(form.symbol) }}<span {{ stimulus_target('pages/latex_preview', 'preview') }}></span></td>
<td>{{ form_widget(form.value_min) }}{{ form_errors(form.value_min) }}</td>
<td>{{ form_widget(form.value_typical) }}{{ form_errors(form.value_typical) }}</td>
<td>{{ form_widget(form.value_max) }}{{ form_errors(form.value_max) }}</td>
<td {{ stimulus_controller('pages/latex_preview') }}>{{ form_widget(form.unit, {"attr": {"data-pages--parameters-autocomplete-target": "unit", "data-pages--latex-preview-target": "input"}}) }}{{ form_errors(form.unit) }}<span {{ stimulus_target('pages/latex_preview', 'preview') }}></span></td>
<td>{{ form_widget(form.value_text) }}{{ form_errors(form.value_text) }}</td>
<td>{{ form_widget(form.group) }}{{ form_errors(form.group) }}</td>
<td>
<button type="button" class="btn btn-danger btn-sm order_btn_delete {% if form.parent.vars.allow_delete is defined and not form.parent.vars.allow_delete %}disabled{% endif %}" {{ collection.delete_btn() }} title="{% trans %}orderdetail.delete{% endtrans %}">
<i class="fas fa-trash-alt fa-fw"></i>
</button>
{{ form_errors(form) }}
</td>
</tr>
{% endblock %}
{% block part_lot_widget %}
{% import 'components/collection_type.macro.html.twig' as collection %}
<tr>
<td>
{{ form_widget(form) }}
</td>
<td>
<button type="button" class="btn btn-danger lot_btn_delete" {{ collection.delete_btn() }}>
<i class="fas fa-trash-alt fa-fw"></i>
{% trans %}part_lot.delete{% endtrans %}
</button>
{{ form_errors(form) }}
</td>
</tr>
{% endblock %}
{% block attachment_widget %}
{% import 'components/collection_type.macro.html.twig' as collection %}
<tr {{ stimulus_controller('elements/attachmenttype_change') }}>
<td>
{{ form_widget(form) }}
</td>
<td>
<button type="button" class="btn btn-danger lot_btn_delete" {{ collection.delete_btn() }}>
<i class="fas fa-trash-alt fa-fw"></i>
{% trans %}attachment.delete{% endtrans %}
</button>
{% set attach = form.vars.value %}
{% if attach is not null %}
{% if attachment_manager.fileExisting(attach) %}
{% if not attach.external %}
<br><br>
<h6>
<span class="badge bg-primary">
<i class="fas fa-fw {{ ext_to_fa_icon(attach.extension) }}"></i> {{ attach.filename }}
</span>
<br>
<span class="badge bg-secondary">
<i class="fas fa-hdd fa-fw"></i> {{ attachment_manager.humanFileSize(attach) }}
</span>
</h6>
{% else %}
<br><br>
<h6>
<span class="badge bg-primary">
<i class="fas fa-fw fa-globe"></i> {% trans %}attachment.external{% endtrans %}
</span>
</h6>
{% endif %}
{% if attach.secure %}
<h6>
<span class="badge bg-success">
<i class="fas fa-fw fa-shield-alt"></i> {% trans %}attachment.secure{% endtrans %}
</span>
</h6>
{% endif %}
{% if attach.secure and not is_granted('show_private', attach) %}
{# Leave blank #}
{% elseif attach.picture %}
<a href="{{ entity_url(attach, 'file_view') }}" rel="noopener" target="_blank" data-turbo="false">
<img class="img-fluid img-thumbnail thumbnail-sm" src="{{ attachment_thumbnail(attach, 'thumbnail_md') }}" alt="{% trans %}attachment.preview.alt{% endtrans %}" />
</a>
{% else %}
<a href="{{ entity_url(attach, 'file_view') }}" rel="noopener" target="_blank" data-turbo="false" class="link-external">{% trans %}attachment.view{% endtrans %}</a>
{% endif %}
{% else %}
<br><br>
<h6>
<span class="badge bg-warning">
<i class="fas fa-exclamation-circle fa-fw"></i> {% trans %}attachment.file_not_found{% endtrans %}
</span>
</h6>
{% endif %}
{% endif %}
</td>
</tr>
{% endblock %}

View file

@ -0,0 +1,120 @@
{% extends "main_card.html.twig" %}
{% block title %}
{% trans with {'%name%': part.name} %}part.edit.title{% endtrans %}
{% endblock %}
{% block card_title %}
<i class="fas fa-edit fa-fw" aria-hidden="true"></i>
{% trans with {'%name%': part.name} %}part.edit.card_title{% endtrans %}
<b><a href="{{ entity_url(part, 'info') }}" class="text-white">{{ part.name }}</a></b>
<div class="float-end">
{% trans %}id.label{% endtrans %}: {{ part.id }} {% if part.ipn is not empty %}(<i>{{ part.ipn }}</i>){% endif %}
</div>
{% endblock %}
{% block card_content %}
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="tab" role="tab" href="#common">
<i class="fas fa-id-card fa-fw"></i>
{% trans %}part.edit.tab.common{% endtrans %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" role="tab" href="#manufacturer">
<i class="fas fa-industry fa-fw"></i>
{% trans %}part.edit.tab.manufacturer{% endtrans %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" role="tab" href="#advanced">
<i class="fas fa-shapes fa-fw"></i>
{% trans %}part.edit.tab.advanced{% endtrans %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" role="tab" href="#part_lots">
<i class="fas fa-boxes fa-fw"></i>
{% trans %}part.edit.tab.part_lots{% endtrans %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" role="tab" href="#attachments">
<i class="fas fa-paperclip fa-fw"></i>
{% trans %}part.edit.tab.attachments{% endtrans %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" role="tab" href="#orderdetails">
<i class="fas fa-shopping-cart fa-fw"></i>
{% trans %}part.edit.tab.orderdetails{% endtrans %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" role="tab" href="#specifications">
<i class="fas fa-atlas fa-fw"></i>
{% trans %}part.edit.tab.specifications{% endtrans %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" role="tab" href="#comment">
<i class="fas fa-sticky-note fa-fw"></i>
{% trans %}part.edit.tab.comment{% endtrans %}
</a>
</li>
</ul>
{{ form_start(form) }}
<div class="tab-content">
<div class="tab-pane fade show active p-2" id="common" role="tabpanel">
{% include "parts/edit/_main.html.twig" %}
</div>
<div class="tab-pane fade p-2" id="manufacturer" role="tabpanel">
{% include "parts/edit/_manufacturer.html.twig" %}
</div>
<div class="tab-pane fade p-2" id="advanced" role="tabpanel">
{% include "parts/edit/_advanced.html.twig" %}
</div>
<div class="tab-pane fade p-2" id="part_lots" role="tabpanel">
{% include "parts/edit/_lots.html.twig" %}
</div>
<div class="tab-pane fade p-2" id="attachments" role="tabpanel">
{% include "parts/edit/_attachments.html.twig" %}
</div>
<div class="tab-pane fade p-2" id="orderdetails" role="tabpanel">
{% include "parts/edit/_orderdetails.html.twig" %}
</div>
<div class="tab-pane fade p-2" id="specifications" role="tabpanel">
{% include "parts/edit/_specifications.html.twig" %}
</div>
<div class="tab-pane fade p-2" id="comment" role="tabpanel">
{{ form_widget(form.comment)}}
</div>
</div>
<div class="form-group row">
<div class="col-sm-9 offset-sm-3">
<div class="btn-group">
{{ form_widget(form.save) }}
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
{{ form_widget(form.save_and_clone, {'attr': {'class': 'dropdown-item'}}) }}
<div class="dropdown-divider"></div>
<div class="p-2">
{{ form_row(form.log_comment)}}
</div>
</div>
</div>
</div>
</div>
{{ form_row(form.reset) }}
{{ form_errors(form) }}
{{ form_end(form) }}
{% endblock %}

View file

@ -0,0 +1,9 @@
{% extends "parts/edit/edit_part_info.html.twig" %}
{% block card_border %}border-success{% endblock %}
{% block card_type %}bg-success text-white{% endblock %}
{% block card_title %}
<i class="fas fa-edit fa-plus-square" aria-hidden="true"></i>
{% trans %}part.new.card_title{% endtrans %}
{% endblock %}