mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-03 15:04:32 +02:00
Improved the association edit panel
This commit is contained in:
parent
8ab9cf1417
commit
81f8b365e9
5 changed files with 70 additions and 1 deletions
|
@ -34,4 +34,13 @@ enum AssociationType: int
|
||||||
case COMPATIBLE = 1;
|
case COMPATIBLE = 1;
|
||||||
/** The owning part supersedes the other part (owner is newer version) */
|
/** The owning part supersedes the other part (owner is newer version) */
|
||||||
case SUPERSEDES = 2;
|
case SUPERSEDES = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the translation key for this association type.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTranslationKey(): string
|
||||||
|
{
|
||||||
|
return 'part_association.type.' . strtolower($this->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,18 @@ class PartAssociationType extends AbstractType
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
|
->add('other', PartSelectType::class, [
|
||||||
|
'label' => 'part_association.edit.other_part',
|
||||||
|
])
|
||||||
->add('type', EnumType::class, [
|
->add('type', EnumType::class, [
|
||||||
'class' => AssociationType::class,
|
'class' => AssociationType::class,
|
||||||
|
'label' => 'part_association.edit.type',
|
||||||
|
'choice_label' => fn(AssociationType $type) => $type->getTranslationKey(),
|
||||||
|
'help' => 'part_association.edit.type.help',
|
||||||
])
|
])
|
||||||
->add('other', PartSelectType::class)
|
|
||||||
->add('comment', TextType::class, [
|
->add('comment', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
'label' => 'part_association.edit.comment'
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ use App\Entity\Attachments\AttachmentType;
|
||||||
use App\Entity\Base\AbstractDBElement;
|
use App\Entity\Base\AbstractDBElement;
|
||||||
use App\Entity\Base\AbstractNamedDBElement;
|
use App\Entity\Base\AbstractNamedDBElement;
|
||||||
use App\Entity\Contracts\NamedElementInterface;
|
use App\Entity\Contracts\NamedElementInterface;
|
||||||
|
use App\Entity\Parts\PartAssociation;
|
||||||
use App\Entity\ProjectSystem\Project;
|
use App\Entity\ProjectSystem\Project;
|
||||||
use App\Entity\LabelSystem\LabelProfile;
|
use App\Entity\LabelSystem\LabelProfile;
|
||||||
use App\Entity\Parameters\AbstractParameter;
|
use App\Entity\Parameters\AbstractParameter;
|
||||||
|
@ -80,6 +81,7 @@ class ElementTypeNameGenerator
|
||||||
User::class => $this->translator->trans('user.label'),
|
User::class => $this->translator->trans('user.label'),
|
||||||
AbstractParameter::class => $this->translator->trans('parameter.label'),
|
AbstractParameter::class => $this->translator->trans('parameter.label'),
|
||||||
LabelProfile::class => $this->translator->trans('label_profile.label'),
|
LabelProfile::class => $this->translator->trans('label_profile.label'),
|
||||||
|
PartAssociation::class => $this->translator->trans('part_association.label'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,3 +184,19 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block part_association_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 %}
|
|
@ -11831,5 +11831,41 @@ Please note, that you can not impersonate a disabled user. If you try you will g
|
||||||
<target>Part-DB barcode</target>
|
<target>Part-DB barcode</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="hrPuOzr" name="part_association.label">
|
||||||
|
<segment>
|
||||||
|
<source>part_association.label</source>
|
||||||
|
<target>Part association</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="BntFEyV" name="part.edit.tab.associations">
|
||||||
|
<segment>
|
||||||
|
<source>part.edit.tab.associations</source>
|
||||||
|
<target>Associated parts</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="J8xCiOb" name="part_association.edit.other_part">
|
||||||
|
<segment>
|
||||||
|
<source>part_association.edit.other_part</source>
|
||||||
|
<target>Associated part</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="ov0J5BG" name="part_association.edit.type">
|
||||||
|
<segment>
|
||||||
|
<source>part_association.edit.type</source>
|
||||||
|
<target>Relation Type</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="Rdl3E1f" name="part_association.edit.comment">
|
||||||
|
<segment>
|
||||||
|
<source>part_association.edit.comment</source>
|
||||||
|
<target>Notes</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="rL3sVOB" name="part_association.edit.type.help">
|
||||||
|
<segment>
|
||||||
|
<source>part_association.edit.type.help</source>
|
||||||
|
<target>You can select here, how the chosen part is related to this part.</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue