|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* Copyright Iain Cambridge 2020-2023. |
|
7
|
|
|
* |
|
8
|
|
|
* Use of this software is governed by the Business Source License included in the LICENSE file and at https://getparthenon.com/docs/next/license. |
|
9
|
|
|
* |
|
10
|
|
|
* Change Date: TBD ( 3 years after 2.2.0 release ) |
|
11
|
|
|
* |
|
12
|
|
|
* On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace Parthenon\Billing\Athena; |
|
16
|
|
|
|
|
17
|
|
|
use Parthenon\Athena\AbstractSection; |
|
18
|
|
|
use Parthenon\Athena\EntityForm; |
|
19
|
|
|
use Parthenon\Athena\ListView; |
|
20
|
|
|
use Parthenon\Athena\Repository\CrudRepositoryInterface; |
|
21
|
|
|
use Parthenon\Billing\Entity\SubscriptionPlan; |
|
22
|
|
|
use Parthenon\Billing\Repository\SubscriptionPlanRepositoryInterface; |
|
23
|
|
|
|
|
24
|
|
|
class SubscriptionPlanSection extends AbstractSection |
|
25
|
|
|
{ |
|
26
|
|
|
public function __construct(private SubscriptionPlanRepositoryInterface $subscriptionPlanRepository) |
|
27
|
|
|
{ |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function getUrlTag(): string |
|
31
|
|
|
{ |
|
32
|
|
|
return 'billing-subscription-plan'; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function getRepository(): CrudRepositoryInterface |
|
36
|
|
|
{ |
|
37
|
|
|
return $this->subscriptionPlanRepository; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function getEntity() |
|
41
|
|
|
{ |
|
42
|
|
|
return new SubscriptionPlan(); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function getMenuSection(): string |
|
46
|
|
|
{ |
|
47
|
|
|
return 'Billing'; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function getMenuName(): string |
|
51
|
|
|
{ |
|
52
|
|
|
return 'Subscription Plan'; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function buildEntityForm(EntityForm $entityForm): EntityForm |
|
56
|
|
|
{ |
|
57
|
|
|
$entityForm->section('Main') |
|
58
|
|
|
->field('name', 'text') |
|
59
|
|
|
->field('public', 'checkbox') |
|
60
|
|
|
->field('external_reference', 'text', ['required' => false]) |
|
61
|
|
|
->end(); |
|
62
|
|
|
|
|
63
|
|
|
return $entityForm; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function buildListView(ListView $listView): ListView |
|
67
|
|
|
{ |
|
68
|
|
|
$listView->addField('name', 'text'); |
|
69
|
|
|
|
|
70
|
|
|
return $listView; |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|