Skip to content

Commit

Permalink
add filament-plugins integration
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Sep 16, 2024
1 parent 3c24bba commit 90ef081
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 5 deletions.
29 changes: 29 additions & 0 deletions module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "FilamentInvoices",
"alias": "filament-invoices",
"description": {
"ar": "قم باصدار وإدارة الفواتير الخاصة بالعملاء مع تقسيم الدفعات ودعم عملات متعددة",
"en": "Generate and manage your invoices / payments using multi currencies and multi types in FilamentPHP",
"gr": "Generate and manage your invoices / payments using multi currencies and multi types in FilamentPHP",
"sp": "Generate and manage your invoices / payments using multi currencies and multi types in FilamentPHP"
},
"keywords": [],
"priority": 0,
"providers": [
"TomatoPHP\\FilamentInvoices\\FilamentInvoicesServiceProvider"
],
"files": [],
"title": {
"ar": "الفواتير",
"en": "Invoices Manager",
"gr": "Invoices Manager",
"sp": "Invoices Manager"
},
"color": "#cc1448",
"icon": "heroicon-c-receipt-percent",
"placeholder": "https://raw.githubusercontent.com/tomatophp/filament-invoices/master/arts/3x1io-tomato-invoices.jpg",
"type": "plugin",
"version": "v1.0.3",
"github" : "https://github.com/tomatophp/filament-invoices",
"docs" : "https://github.com/tomatophp/filament-invoices"
}
1 change: 1 addition & 0 deletions resources/lang/ar/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
return [
'invoices' => [
'title' => 'الفواتير',
'group' => 'المدفوعات',
'single' => 'فاتورة',
'widgets' => [
'count' => 'إجمالي الفواتير',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/de/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
return [
'invoices' => [
'title' => 'Rechnungen',
'group' => 'Zahlungen',
'single' => 'Rechnung',
'widgets' => [
'count' => 'Gesamtanzahl Rechnungen',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
return [
'invoices' => [
'title' => 'Invoices',
'group' => 'Payments',
'single' => 'Invoice',
'widgets' => [
'count' => 'Total Invoices',
Expand Down
5 changes: 5 additions & 0 deletions src/Filament/Resources/InvoiceResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public static function getPluralLabel(): ?string
{
return trans('filament-invoices::messages.invoices.title');
}

public static function getNavigationGroup(): ?string
{
return trans('filament-invoices::messages.invoices.group');
}

public static function getLabel(): ?string
{
Expand Down
25 changes: 20 additions & 5 deletions src/FilamentInvoicesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,38 @@

use Filament\Contracts\Plugin;
use Filament\Panel;
use Nwidart\Modules\Module;
use TomatoPHP\FilamentInvoices\Filament\Resources\InvoiceResource;


class FilamentInvoicesPlugin implements Plugin
{
private bool $isActive = false;

public function getId(): string
{
return 'filament-invoices';
}

public function register(Panel $panel): void
{
$panel->resources([
InvoiceResource::class
])->pages([
InvoiceResource\Pages\InvoiceStatus::class
]);
if(class_exists(Module::class)){
if(\Nwidart\Modules\Facades\Module::find('FilamentInvoices')->isEnabled()){
$this->isActive = true;
}
}
else {
$this->isActive = true;
}

if($this->isActive) {

$panel->resources([
InvoiceResource::class
])->pages([
InvoiceResource\Pages\InvoiceStatus::class
]);
}
}

public function boot(Panel $panel): void
Expand Down

0 comments on commit 90ef081

Please sign in to comment.