feat: move cost unit from assignment to job profile
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250318105943 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE assignment DROP cost_center');
|
||||||
|
$this->addSql('ALTER TABLE job_profile ADD cost_unit VARCHAR(255) DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE job_profile DROP cost_unit');
|
||||||
|
$this->addSql('ALTER TABLE assignment ADD cost_center VARCHAR(255) DEFAULT NULL');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,10 +43,6 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
#[Assert\NotNull(message: 'Bitte gib die Destination an')]
|
#[Assert\NotNull(message: 'Bitte gib die Destination an')]
|
||||||
private ?Destination $destination = null;
|
private ?Destination $destination = null;
|
||||||
|
|
||||||
#[ORM\Column(nullable: true)]
|
|
||||||
#[Assert\NotBlank(message: 'Bitte gib den Konstenträger an')]
|
|
||||||
private ?string $costCenter = null;
|
|
||||||
|
|
||||||
#[ORM\ManyToOne]
|
#[ORM\ManyToOne]
|
||||||
#[Assert\NotNull(message: 'Bitte gib das Jobprofil an')]
|
#[Assert\NotNull(message: 'Bitte gib das Jobprofil an')]
|
||||||
private ?JobProfile $jobProfile = null;
|
private ?JobProfile $jobProfile = null;
|
||||||
@@ -198,18 +194,6 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCostCenter(): ?string
|
|
||||||
{
|
|
||||||
return $this->costCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCostCenter(?string $costCenter): static
|
|
||||||
{
|
|
||||||
$this->costCenter = $costCenter;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getJobProfile(): ?JobProfile
|
public function getJobProfile(): ?JobProfile
|
||||||
{
|
{
|
||||||
return $this->jobProfile;
|
return $this->jobProfile;
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
#[Assert\NotNull(message: 'Bitte ordne eine Feedback-Vorlage zu')]
|
#[Assert\NotNull(message: 'Bitte ordne eine Feedback-Vorlage zu')]
|
||||||
private ?FeedbackSet $feedbackSet = null;
|
private ?FeedbackSet $feedbackSet = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?string $costUnit = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->uuid = Uuid::v4();
|
$this->uuid = Uuid::v4();
|
||||||
@@ -119,6 +122,18 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCostUnit(): ?string
|
||||||
|
{
|
||||||
|
return $this->costUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCostUnit(?string $costUnit): static
|
||||||
|
{
|
||||||
|
$this->costUnit = $costUnit;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function isQualified(Teamer $teamer): bool
|
public function isQualified(Teamer $teamer): bool
|
||||||
{
|
{
|
||||||
// Check licenses
|
// Check licenses
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ class AssignmentType extends AbstractType
|
|||||||
'hx-swap' => 'innerHTML',
|
'hx-swap' => 'innerHTML',
|
||||||
],
|
],
|
||||||
])
|
])
|
||||||
->add('costCenter', TextType::class, [
|
|
||||||
'label' => 'Kostenträger',
|
|
||||||
])
|
|
||||||
->add('jobProfile', EntityType::class, [
|
->add('jobProfile', EntityType::class, [
|
||||||
'label' => 'Jobprofil',
|
'label' => 'Jobprofil',
|
||||||
'class' => JobProfile::class,
|
'class' => JobProfile::class,
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ class JobProfileType extends AbstractType
|
|||||||
'choice_label' => 'name',
|
'choice_label' => 'name',
|
||||||
'placeholder' => 'Kein Feedback',
|
'placeholder' => 'Kein Feedback',
|
||||||
])
|
])
|
||||||
|
->add('costUnit', TextType::class, [
|
||||||
|
'label' => 'Kostenstelle',
|
||||||
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,4 +65,4 @@ class JobProfileType extends AbstractType
|
|||||||
'anti_xss' => true,
|
'anti_xss' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,26 +22,29 @@ class InvoiceApprover extends AbstractPdfRenderer
|
|||||||
throw new \InvalidArgumentException('Expected PDF but got '.$invoice->getMimeType());
|
throw new \InvalidArgumentException('Expected PDF but got '.$invoice->getMimeType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load template
|
||||||
|
$filepath = sprintf('%s/uploads/invoice/%s', $this->config['project_dir'], $originalFilename);
|
||||||
|
if (false === file_exists($filepath)) {
|
||||||
|
throw new \InvalidArgumentException('Uploaded document not found at '.$filepath);
|
||||||
|
}
|
||||||
|
|
||||||
$pdf = new Pdf();
|
$pdf = new Pdf();
|
||||||
|
|
||||||
$pdf->SetAuthor($teamer->getFullName(), true);
|
$pdf->SetAuthor($teamer->getFullName(), true);
|
||||||
$pdf->SetCreator($teamer->getFullName(), true);
|
$pdf->SetCreator($teamer->getFullName(), true);
|
||||||
|
|
||||||
// Load template
|
|
||||||
$filepath = sprintf('%s/uploads/invoice/%s', $this->config['project_dir'], $originalFilename);
|
|
||||||
$pdf->appendPdf($filepath);
|
$pdf->appendPdf($filepath);
|
||||||
$pdf->setPage(1);
|
$pdf->setPage(1);
|
||||||
|
|
||||||
// Cost unit
|
// Cost unit job profile
|
||||||
if (null !== $costUnit = $assignment->getDestination()->getCostUnit()) {
|
if (null !== $costUnit = $assignment->getJobProfile()->getCostUnit()) {
|
||||||
$pdf->SetFont('Arial', '', 11);
|
$pdf->SetFont('Arial', '', 11);
|
||||||
$pdf->Text(20,20, utf8_decode('Kostenstelle: '.$costUnit));
|
$pdf->Text(20,20, utf8_decode('Kostenstelle 1: '.$costUnit));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cost center
|
// Cost unit destination/hotel
|
||||||
if (null !== $costCenter = $assignment->getCostCenter()) {
|
if (null !== $costUnit = $assignment->getDestination()->getCostUnit()) {
|
||||||
$pdf->SetFont('Arial', '', 11);
|
$pdf->SetFont('Arial', '', 11);
|
||||||
$pdf->Text(20,25, utf8_decode('Kostenträger: '.$costCenter));
|
$pdf->Text(20,25, utf8_decode('Kostenstelle 2: '.$costUnit));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Approval
|
// Approval
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
{{ form_row(form.feedbackSet) }}
|
{{ form_row(form.feedbackSet) }}
|
||||||
{{ form_row(form.requiredTrainings) }}
|
{{ form_row(form.requiredTrainings) }}
|
||||||
{{ form_row(form.requiredLicenses) }}
|
{{ form_row(form.requiredLicenses) }}
|
||||||
|
{{ form_row(form.costUnit) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<button type="submit" class="btn">
|
<button type="submit" class="btn">
|
||||||
|
|||||||
@@ -27,7 +27,9 @@
|
|||||||
{% for jobProfile in jobProfiles %}
|
{% for jobProfile in jobProfiles %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{{ jobProfile.name }}
|
<a href="{{ path('app_admin_system_job_profile_edit', { 'id': jobProfile.id }) }}">
|
||||||
|
{{ jobProfile.name }}
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -81,4 +83,4 @@
|
|||||||
<a href="{{ path('app_admin_system_job_profile_create') }}" class="btn">
|
<a href="{{ path('app_admin_system_job_profile_create') }}" class="btn">
|
||||||
Neu
|
Neu
|
||||||
</a>
|
</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
<div class="grid grid-cols-1 gap-y-4">
|
<div class="grid grid-cols-1 gap-y-4">
|
||||||
{{ form_row(form.contact) }}
|
{{ form_row(form.contact) }}
|
||||||
{{ form_row(form.remarks) }}
|
{{ form_row(form.remarks) }}
|
||||||
{{ form_row(form.costCenter) }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user