diff --git a/assets/controllers/elements/collection_type_controller.js b/assets/controllers/elements/collection_type_controller.js
index 2a110f8d..488c6421 100644
--- a/assets/controllers/elements/collection_type_controller.js
+++ b/assets/controllers/elements/collection_type_controller.js
@@ -26,6 +26,7 @@ export default class extends Controller {
static values = {
deleteMessage: String,
prototype: String,
+ rowsToDelete: Number, //How many rows (including the current one) shall be deleted after the current row
}
static targets = ["target"];
@@ -125,7 +126,17 @@ export default class extends Controller {
const del = () => {
const target = event.target;
//Remove the row element from the table
- target.closest("tr").remove();
+ const current_row = target.closest("tr");
+ for(let i = this.rowsToDeleteValue; i > 1; i--) {
+ let nextSibling = current_row.nextElementSibling;
+ //Ensure that nextSibling is really a tr
+ if (nextSibling && nextSibling.tagName === "TR") {
+ nextSibling.remove();
+ }
+ }
+
+ //Finally delete the current row
+ current_row.remove();
}
if(this.deleteMessageValue) {
diff --git a/assets/controllers/elements/part_select_controller.js b/assets/controllers/elements/part_select_controller.js
new file mode 100644
index 00000000..ee13b4b9
--- /dev/null
+++ b/assets/controllers/elements/part_select_controller.js
@@ -0,0 +1,68 @@
+import {Controller} from "@hotwired/stimulus";
+
+import "tom-select/dist/css/tom-select.bootstrap5.css";
+import '../../css/components/tom-select_extensions.css';
+import TomSelect from "tom-select";
+import {marked} from "marked";
+
+export default class extends Controller {
+ _tomSelect;
+
+ connect() {
+
+ let settings = {
+ allowEmptyOption: true,
+ plugins: ['dropdown_input'],
+ searchField: ["name", "description", "category", "footprint"],
+ valueField: "id",
+ labelField: "name",
+ preload: "focus",
+ render: {
+ item: (data, escape) => {
+ return '' + (data.image ? "" : "") + escape(data.name) + '';
+ },
+ option: (data, escape) => {
+ if(data.text) {
+ return '' + escape(data.text) + '';
+ }
+
+ let tmp = '
' + marked.parseInline(data.description) + '
' : "") + + (data.category ? '' + escape(data.category) : ""); + + if (data.footprint) { //If footprint is defined for the part show it next to the category + tmp += ' ' + escape(data.footprint); + } + + return tmp + '
' + + '{% trans %}project.edit.associated_build.hint{% endtrans %}
+{# expand button #} + | {% trans %}project.bom.quantity{% endtrans %} | +{% trans %}project.bom.part{% endtrans %} | +{% trans %}project.bom.name{% endtrans %} | +{# Remove button #} + |
---|
{% trans %}part_lots.storage_location{% endtrans %} | {% trans %}part_lots.amount{% endtrans %} | {# Tags row #} + | {# Button row #} |
+
+
+
+
+
+ |
{{ dropdown.profile_dropdown('part_lot', lot.id, false) }} | diff --git a/templates/Parts/info/_projects.html.twig b/templates/Parts/info/_projects.html.twig new file mode 100644 index 00000000..7adb2182 --- /dev/null +++ b/templates/Parts/info/_projects.html.twig @@ -0,0 +1,35 @@ +{% import "components/attachments.macro.html.twig" as attachments %} +{% import "helper.twig" as helper %} + +
---|
+ | {% trans %}entity.info.name{% endtrans %} | +{% trans %}description.label{% endtrans %} | +{% trans %}project.bom.quantity{% endtrans %} | +{% trans %}project.bom.mountnames{% endtrans %} | +
---|---|---|---|---|
{% if bom_entry.project.masterPictureAttachment is not null %}{{ attachments.attachment_icon(bom_entry.project.masterPictureAttachment, attachment_manager) }}{% endif %} | +{{ bom_entry.project.name }} | {# Name #} +{{ bom_entry.project.description|format_markdown }} | {# Description #} +{{ bom_entry.quantity | format_amount(part.partUnit) }} | +{% for tag in bom_entry.mountnames|split(',') %} + {{ tag | trim }} + {% endfor %} | +
+
{% trans %}name.label{% endtrans %} | +{% trans %}description.label{% endtrans %} | +# {% trans %}project.info.bom_entries_count{% endtrans %} | +# {% trans %}project.info.sub_projects_count{% endtrans %} | +
---|---|---|---|
{# Name #} + {{ subproject.name }} + | +{# Description #} + {{ subproject.description | format_markdown }} + | ++ {{ subproject.bomEntries | length }} + | ++ {{ subproject.children | length }} + | +