feat: Add TargetType form and migration for plan targets
- Implemented TargetType form for managing target details including name, type, priority, stages, estimated size, profile criteria, pain points, value proposition, and preferred channels. - Created migration scripts for adding type and priority columns to plan objectives and tasks. - Added migration for creating plan targets and plan target stages tables, including foreign key constraints. - Introduced stakeholder management with forms and views for creating, editing, and listing stakeholders. - Enhanced UI with read more functionality for long text descriptions and filtering options in plan tab tables.
This commit is contained in:
1 parent
8c8d7a6f95
commit
8696acd01c
52 files changed
+3178
-125
No files matched your search
@@ -9,6 +9,8 @@ use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
|
||||
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\NotNull;
|
||||
use Symfony\Component\Validator\Constraints\Range;
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
|
||||
/**
|
||||
@@ -19,10 +21,17 @@ class PlanObjective
|
||||
{
|
||||
public const TABLE_NAME = 'plan_objectives';
|
||||
|
||||
public const TYPE_MAX_LENGTH = 64;
|
||||
|
||||
public const PRIORITY_MIN = 1;
|
||||
public const PRIORITY_MAX = 99;
|
||||
|
||||
private ?int $id = null;
|
||||
|
||||
private ?Plan $plan = null;
|
||||
|
||||
private ?string $type = null;
|
||||
|
||||
private ?string $title = null;
|
||||
|
||||
private ?string $description = null;
|
||||
@@ -32,6 +41,11 @@ class PlanObjective
|
||||
*/
|
||||
private int $position = 0;
|
||||
|
||||
/**
|
||||
* Importance of the objective, from 1 (highest) to 99 (lowest). Edited by hand.
|
||||
*/
|
||||
private ?int $priority = null;
|
||||
|
||||
/**
|
||||
* Toggled by hand for now.
|
||||
*/
|
||||
@@ -57,6 +71,11 @@ class PlanObjective
|
||||
->addJoinColumn('plan_id', 'id', false, false, 'CASCADE')
|
||||
->build();
|
||||
|
||||
$builder->createField('type', Types::STRING)
|
||||
->length(self::TYPE_MAX_LENGTH)
|
||||
->nullable()
|
||||
->build();
|
||||
|
||||
$builder->createField('title', Types::STRING)
|
||||
->length(255)
|
||||
->build();
|
||||
@@ -73,12 +92,24 @@ class PlanObjective
|
||||
->columnName('is_achieved')
|
||||
->option('default', false)
|
||||
->build();
|
||||
|
||||
$builder->createField('priority', Types::INTEGER)
|
||||
->option('default', self::PRIORITY_MIN)
|
||||
->build();
|
||||
}
|
||||
|
||||
public static function loadValidatorMetadata(ClassMetadata $metadata): void
|
||||
{
|
||||
$metadata->addPropertyConstraint('title', new NotBlank(message: 'mautic.plan.objective.title.required'));
|
||||
$metadata->addPropertyConstraint('title', new Length(max: 255));
|
||||
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.plan.objective.type.required'));
|
||||
$metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH));
|
||||
$metadata->addPropertyConstraint('priority', new NotNull(message: 'mautic.plan.objective.priority.range'));
|
||||
$metadata->addPropertyConstraint('priority', new Range(
|
||||
notInRangeMessage: 'mautic.plan.objective.priority.range',
|
||||
min: self::PRIORITY_MIN,
|
||||
max: self::PRIORITY_MAX,
|
||||
));
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -98,6 +129,18 @@ class PlanObjective
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(?string $type): static
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->title;
|
||||
@@ -134,6 +177,22 @@ class PlanObjective
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPriority(): ?int
|
||||
{
|
||||
return $this->priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* An objective without a priority yet (column added by Version_0_10_1) becomes
|
||||
* self::PRIORITY_MIN once set. Null is refused by validation.
|
||||
*/
|
||||
public function setPriority(?int $priority): static
|
||||
{
|
||||
$this->priority = $priority;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isAchieved(): bool
|
||||
{
|
||||
return $this->isAchieved;
|
||||
|
||||
Reference in new issue
Block a user